]> mj.ucw.cz Git - pciutils.git/commitdiff
lspci: "virtual" resource regions recognized properly
authorMartin Mares <mj@ucw.cz>
Sun, 27 May 2018 11:49:55 +0000 (13:49 +0200)
committerMartin Mares <mj@ucw.cz>
Sun, 27 May 2018 11:49:55 +0000 (13:49 +0200)
We wanted to add a "[virtual]" marker to all resources which are
known to the kernel, but not configured in the hardware. That is,
those where the BAR is all zero.

However, the test was never triggered for I/O regions, since their
BAR is never zero: it always has the region type bit set.

Now, we test only the address part of the BAR.

lspci.c

diff --git a/lspci.c b/lspci.c
index 748452c82e5819c4628557f759c09d811556b2d5..3bf1925e7a686bbf675b46eb209fe33cfc80e612 100644 (file)
--- a/lspci.c
+++ b/lspci.c
@@ -395,8 +395,9 @@ show_bases(struct device *d, int cnt)
        putchar('\t');
       if (ioflg & PCI_IORESOURCE_PCI_EA_BEI)
          printf("[enhanced] ");
-      else if (pos && !flg)    /* Reported by the OS, but not by the device */
+      else if (pos && !(flg & ((flg & PCI_BASE_ADDRESS_SPACE_IO) ? PCI_BASE_ADDRESS_IO_MASK : PCI_BASE_ADDRESS_MEM_MASK)))
        {
+         /* Reported by the OS, but not by the device */
          printf("[virtual] ");
          flg = pos;
          virtual = 1;