From 659d438b89875f4a141e2e342b9378669b7a8572 Mon Sep 17 00:00:00 2001 From: Yu Zhao Date: Sun, 4 Jan 2009 16:10:39 +0800 Subject: [PATCH] Don't display 'disabled' for a virtual base address Don't display 'disabled' for the virtual base address since the resource is reported by the OS not the hardware, which means the IO/MEM enable bits in the command register may be invalid. Signed-off-by: Yu Zhao --- lspci.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lspci.c b/lspci.c index 5456c5a..e453f1b 100644 --- a/lspci.c +++ b/lspci.c @@ -350,6 +350,7 @@ show_bases(struct device *d, int cnt) struct pci_dev *p = d->dev; word cmd = get_conf_word(d, PCI_COMMAND); int i; + int virtual = 0; for (i=0; i"); else printf(""); - if (!(cmd & PCI_COMMAND_IO)) + if (!virtual && !(cmd & PCI_COMMAND_IO)) printf(" [disabled]"); } else @@ -415,7 +417,7 @@ show_bases(struct device *d, int cnt) (t == PCI_BASE_ADDRESS_MEM_TYPE_64) ? "64-bit" : (t == PCI_BASE_ADDRESS_MEM_TYPE_1M) ? "low-1M" : "type 3", (flg & PCI_BASE_ADDRESS_MEM_PREFETCH) ? "" : "non-"); - if (!(cmd & PCI_COMMAND_MEMORY)) + if (!virtual && !(cmd & PCI_COMMAND_MEMORY)) printf(" [disabled]"); } show_size(len); @@ -431,6 +433,7 @@ show_rom(struct device *d, int reg) pciaddr_t len = (p->known_fields & PCI_FILL_SIZES) ? p->rom_size : 0; u32 flg = get_conf_long(d, reg); word cmd = get_conf_word(d, PCI_COMMAND); + int virtual = 0; if (!rom && !flg && !len) return; @@ -439,6 +442,7 @@ show_rom(struct device *d, int reg) { printf("[virtual] "); flg = rom; + virtual = 1; } printf("Expansion ROM at "); if (rom & PCI_ROM_ADDRESS_MASK) @@ -449,7 +453,7 @@ show_rom(struct device *d, int reg) printf(""); if (!(flg & PCI_ROM_ADDRESS_ENABLE)) printf(" [disabled]"); - else if (!(cmd & PCI_COMMAND_MEMORY)) + else if (!virtual && !(cmd & PCI_COMMAND_MEMORY)) printf(" [disabled by cmd]"); show_size(len); putchar('\n'); -- 2.39.2