[PATCH 3/3] PCIUtils: don't display 'disabled' for the virtual base address

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>

---
 lspci.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lspci.c b/lspci.c
index cb6740f..ee73244 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 v = 0;
 
   for (i=0; i<cnt; i++)
     {
@@ -368,6 +369,7 @@ show_bases(struct device *d, int cnt)
 	{
 	  printf("[virtual] ");
 	  flg = pos;
+	  v = 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 (!v && !(cmd & PCI_COMMAND_IO))
 	    printf(" [disabled]");
 	}
       else
@@ -402,7 +404,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 (!v && !(cmd & PCI_COMMAND_MEMORY))
 	    printf(" [disabled]");
 	}
       show_size(len);
@@ -418,6 +420,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 v = 0;
 
   if (!rom && !flg && !len)
     return;
@@ -426,6 +429,7 @@ show_rom(struct device *d, int reg)
     {
       printf("[virtual] ");
       flg = rom;
+      v = 1;
     }
   printf("Expansion ROM at ");
   if (rom & PCI_ROM_ADDRESS_MASK)
@@ -436,7 +440,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 (!v && !(cmd & PCI_COMMAND_MEMORY))
     printf(" [disabled by cmd]");
   show_size(len);
   putchar('\n');
-- 
1.5.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux