From 4cd087d884827e5e4cc493fcbe46e7fb6e331416 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sun, 27 May 2018 13:49:55 +0200 Subject: [PATCH] lspci: "virtual" resource regions recognized properly 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lspci.c b/lspci.c index 748452c..3bf1925 100644 --- 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; -- 2.39.5