From 635122569d3e0d2e050b97909cfee75f401e3a30 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 3 May 2023 21:56:48 -0300 Subject: [PATCH] pcireg: Add 64-bit BAR support --- pcireg/pcireg.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pcireg/pcireg.c b/pcireg/pcireg.c index 286848e..7b33531 100644 --- a/pcireg/pcireg.c +++ b/pcireg/pcireg.c @@ -952,22 +952,23 @@ dump_info(uint8_t bus, uint8_t dev, uint8_t func) if (reg_val.u8[0] & 1) { printf("I/O at %04X", reg_val.u16[0] & 0xfffc); } else { - printf("Memory at %04X%04X (", reg_val.u16[1], reg_val.u16[0] & 0xfff0); - switch (reg_val.u8[0] & 0x06) { + printf("Memory at "); + switch (reg_val.u32 & 0x00000006) { case 0x00: - printf("32-bit"); + printf("%08X (32-bit", reg_val.u32 & 0xfffffff0); break; case 0x02: - printf("below 1 MB"); + printf("%05X (below 1 MB", reg_val.u32 & 0xfffffff0); break; case 0x04: - printf("64-bit"); + /* Next BAR has the upper 32 bits. */ + printf("%08X_%08X (64-bit", pci_readl(bus, dev, func, 0x14 + (i++ << 2)), reg_val.u32 & 0xfffffff0); break; case 0x06: - printf("invalid location"); + printf("%08X (invalid location", reg_val.u32 & 0xfffffff0); break; } printf(", ");