]> git.ipfire.org Git - thirdparty/pciutils.git/commitdiff
lspci: zero address in IO isn't always unassigned
authorAaron Sierra <asierra@xes-inc.com>
Fri, 25 May 2012 19:11:39 +0000 (14:11 -0500)
committerMartin Mares <mj@ucw.cz>
Mon, 28 May 2012 13:16:55 +0000 (15:16 +0200)
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@xes-inc.com>
lib/sysfs.c
lspci.c

index 1ec4afbfc75399310b5e2ce6cd1e3ac8305182e7..2197fab6793eab6686e1a846595e9c6a9699362a 100644 (file)
@@ -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 681ef6a769b38dac6122e5e46a1a9cf260fa1f3d..a67a516840ea0e6e8d9cf454e243f7c9725089f4 100644 (file)
--- 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>");