]> mj.ucw.cz Git - pciutils.git/commitdiff
Better displaying of disabled and unassigned base address regions.
authorMartin Mares <mj@ucw.cz>
Wed, 9 Sep 1998 07:38:51 +0000 (07:38 +0000)
committerMartin Mares <mj@ucw.cz>
Fri, 5 May 2006 12:09:55 +0000 (14:09 +0200)
ChangeLog
lspci.c

index e8c9686aee686343516bb6266677f63a7de03a0d..03a843ddad8b28b44a74ee64da96095954f6f403 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Wed Sep  9 12:03:24 1998  Martin Mares  <mj@albireo.ucw.cz>
+
+       * lspci.c (show_bases): Better displaying of unassigned and
+       disabled bases. Thanks to Gabriel Paubert <paubert@iram.es>
+       for an idea.
+
 Wed Sep  2 10:58:01 1998  Martin Mares  <mj@albireo.ucw.cz>
 
        * setpci.c (pread): Recognize glibc 1.99 numbered as 2.0 on the PPC.
diff --git a/lspci.c b/lspci.c
index 8a1fdbff41c5cd325ea8b9ba4a5044b03162edd0..bff710cea3942d82b0412b1975b4e0a9034ff8f0 100644 (file)
--- a/lspci.c
+++ b/lspci.c
@@ -1,5 +1,5 @@
 /*
- *     $Id: lspci.c,v 1.14 1998/07/17 08:57:14 mj Exp $
+ *     $Id: lspci.c,v 1.15 1998/09/09 07:38:54 mj Exp $
  *
  *     Linux PCI Utilities -- List All PCI Devices
  *
@@ -269,46 +269,65 @@ show_bases(struct device *d, int cnt)
       if (buscentric_view)
        pos = flg;
       else
-       pos = d->kernel_base_addr[i];
-      if (!pos || pos == 0xffffffff)
+       {
+         pos = d->kernel_base_addr[i];
+         if (!pos)
+           continue;
+       }
+      if (pos == 0xffffffff)
        continue;
+      if (verbose > 1)
+       printf("\tRegion %d: ", i);
+      else
+       putchar('\t');
       if (flg & PCI_BASE_ADDRESS_SPACE_IO)
        {
-         if (cmd & PCI_COMMAND_IO)
-           {
-             if (verbose > 1)
-               printf("\tRegion %d: ", i);
-             else
-               putchar('\t');
-             printf("I/O ports at %04lx\n", pos & PCI_BASE_ADDRESS_IO_MASK);
-           }
+         unsigned long a = pos & PCI_BASE_ADDRESS_IO_MASK;
+         printf("I/O ports at ");
+         if (a)
+           printf("%04lx", a);
+         else
+           printf("<unassigned>");
+         if (!(cmd & PCI_COMMAND_IO))
+           printf(" [disabled]");
        }
-      else if (cmd & PCI_COMMAND_MEMORY)
+      else
        {
          int t = flg & PCI_BASE_ADDRESS_MEM_TYPE_MASK;
-         if (verbose > 1)
-           printf("\tRegion %d: ", i);
-         else
-           putchar('\t');
+         unsigned long a = pos & PCI_BASE_ADDRESS_MEM_MASK;
+         int x64 = 0;
          printf("Memory at ");
          if (t == PCI_BASE_ADDRESS_MEM_TYPE_64)
            {
              if (i < cnt - 1)
                {
+                 u32 z;
                  i++;
-                 if (!buscentric_view)
-                   printf("%08x", get_conf_long(d, PCI_BASE_ADDRESS_0 + 4*i));
+                 z = get_conf_long(d, PCI_BASE_ADDRESS_0 + 4*i);
+                 if (buscentric_view)
+                   printf("%08x", z);
+                 if (z)
+                   x64 = 1;
                }
              else
-               printf("????????");
+               {
+                 printf("????????");
+                 x64 = 1;
+               }
            }
-         printf("%08lx (%s, %sprefetchable)\n",
-                pos & PCI_BASE_ADDRESS_MEM_MASK,
+         if (x64 || a)
+           printf("%08lx", a);
+         else
+           printf("<unassigned>");
+         printf(" (%s, %sprefetchable)",
                 (t == PCI_BASE_ADDRESS_MEM_TYPE_32) ? "32-bit" :
                 (t == PCI_BASE_ADDRESS_MEM_TYPE_64) ? "64-bit" :
-                (t == PCI_BASE_ADDRESS_MEM_TYPE_1M) ? "low-1M 32-bit" : "???",
+                (t == PCI_BASE_ADDRESS_MEM_TYPE_1M) ? "low-1M" : "type 3",
                 (flg & PCI_BASE_ADDRESS_MEM_PREFETCH) ? "" : "non-");
+         if (!(cmd & PCI_COMMAND_MEMORY))
+           printf(" [disabled]");
        }
+      putchar('\n');
     }
 }