[PATCH] lspci: zero address in IO isn't always unassigned

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

 



Zero is a valid address in I/O space, so display it and it's associated
size when IO is enabled in the PCI command register.

>From arch/powerpc/kernel/pci-common.c:

/* Here, we are a bit different than memory as typically IO space
 * starting at low addresses -is- valid. What we do instead [is] that
 * we consider as unassigned anything that doesn't have IO enabled
 * in the PCI command register, and that's it.
 */

Signed-off-by: Aaron Sierra <asierra@xxxxxxxxxxx>
---
 lib/sysfs.c |    2 +-
 lspci.c     |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/sysfs.c b/lib/sysfs.c
index 1ec4afb..2197fab 100644
--- a/lib/sysfs.c
+++ b/lib/sysfs.c
@@ -125,7 +125,7 @@ sysfs_get_resources(struct pci_dev *d)
 	break;
       if (sscanf(buf, "%llx %llx %llx", &start, &end, &flags) != 3)
 	a->error("Syntax error in %s", namebuf);
-      if (start)
+      if (end > start)
 	size = end - start + 1;
       else
 	size = 0;
diff --git a/lspci.c b/lspci.c
index 681ef6a..a67a516 100644
--- a/lspci.c
+++ b/lspci.c
@@ -372,7 +372,7 @@ show_bases(struct device *d, int cnt)
 	{
 	  pciaddr_t a = pos & PCI_BASE_ADDRESS_IO_MASK;
 	  printf("I/O ports at ");
-	  if (a)
+	  if (a || (cmd & PCI_COMMAND_IO))
 	    printf(PCIADDR_PORT_FMT, a);
 	  else if (flg & PCI_BASE_ADDRESS_IO_MASK)
 	    printf("<ignored>");
-- 
1.7.0.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