]> mj.ucw.cz Git - pciutils.git/commitdiff
Don't display 'disabled' for a virtual base address
authorYu Zhao <yu.zhao@intel.com>
Sun, 4 Jan 2009 08:10:39 +0000 (16:10 +0800)
committerMartin Mares <mj@ucw.cz>
Sun, 18 Jan 2009 21:58:06 +0000 (22:58 +0100)
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 <yu.zhao@intel.com>
lspci.c

diff --git a/lspci.c b/lspci.c
index 5456c5a8acfb0d7992f37262249cd108c233ac61..e453f1bfb23d1855c559175db3319d0f4c56163b 100644 (file)
--- 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<cnt; i++)
     {
@@ -368,6 +369,7 @@ show_bases(struct device *d, int cnt)
        {
          printf("[virtual] ");
          flg = pos;
+         virtual = 1;
        }
       if (flg & PCI_BASE_ADDRESS_SPACE_IO)
        {
@@ -379,7 +381,7 @@ show_bases(struct device *d, int cnt)
            printf("<ignored>");
          else
            printf("<unassigned>");
-         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("<unassigned>");
   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');