]> mj.ucw.cz Git - pciutils.git/commitdiff
Added the -D switch.
authorMartin Mares <mj@ucw.cz>
Mon, 13 Mar 2006 21:13:14 +0000 (21:13 +0000)
committerMartin Mares <mj@ucw.cz>
Fri, 5 May 2006 12:18:35 +0000 (14:18 +0200)
git-archimport-id: mj@ucw.cz--public/pciutils--main--2.2--patch-94

ChangeLog
lspci.c
lspci.man

index 6b1c4b827e977908e59f93b39a236cd39c6d7e22..2f76a15e30d93a2839d078b9c6c4d5f48310d2bd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2006-03-13  Martin Mares  <mj@ucw.cz>
 
+       * lspci.man: Documented the -D switch.
+
+       * lspci.c (show_slot_name, scan_device): If there are multiple PCI
+       domains or if the `-D' switch is used, show the domain number for
+       all devices.
+
        * lspci.c (show_verbose): Report cache line size in bytes.
 
        * update-pciids.sh: Use curl if available. Patch by Matthew Wilcox.
diff --git a/lspci.c b/lspci.c
index 56ec99a14d5faead476d24eae7a8fe987bb2ba59..1fc6bfe05f92698db7be8b4ea936f243e6afb25d 100644 (file)
--- a/lspci.c
+++ b/lspci.c
@@ -23,8 +23,9 @@ static struct pci_filter filter;      /* Device filter */
 static int show_tree;                  /* Show bus tree */
 static int machine_readable;           /* Generate machine-readable output */
 static int map_mode;                   /* Bus mapping mode enabled */
+static int show_domains;               /* Show domain numbers */
 
-static char options[] = "nvbxs:d:ti:mgM" GENERIC_OPTIONS ;
+static char options[] = "nvbxs:d:ti:mgMD" GENERIC_OPTIONS ;
 
 static char help_msg[] = "\
 Usage: lspci [<switches>]\n\
@@ -40,6 +41,7 @@ Usage: lspci [<switches>]\n\
 -t\t\tShow bus tree\n\
 -m\t\tProduce machine-readable output\n\
 -i <file>\tUse specified ID database instead of %s\n\
+-D\t\tAlways show domain numbers\n\
 -M\t\tEnable `bus mapping' mode (dangerous; root only)\n"
 GENERIC_HELP
 ;
@@ -104,6 +106,8 @@ scan_device(struct pci_dev *p)
 {
   struct device *d;
 
+  if (p->domain)
+    show_domains = 1;
   if (!pci_filter_match(&filter, p))
     return NULL;
   d = xmalloc(sizeof(struct device));
@@ -239,7 +243,7 @@ show_slot_name(struct device *d)
 {
   struct pci_dev *p = d->dev;
 
-  if (p->domain)
+  if (show_domains)
     printf("%04x:", p->domain);
   printf("%02x:%02x.%d", p->bus, p->dev, p->func);
 }
@@ -2317,6 +2321,9 @@ main(int argc, char **argv)
       case 'M':
        map_mode++;
        break;
+      case 'D':
+       show_domains = 1;
+       break;
       default:
        if (parse_generic_option(i, pacc, optarg))
          break;
index a65c6795932ed8163bcbf7cefc296cd7de1eea90..07f153069af0a925258560e9421d46f2d7f6b7dc 100644 (file)
--- a/lspci.man
+++ b/lspci.man
@@ -101,6 +101,10 @@ as the PCI ID list instead of @IDSDIR@/pci.ids.
 Dump PCI device data in machine readable form (both normal and verbose format supported)
 for easy parsing by scripts.
 .TP
+.B -D
+Always show PCI domain numbers. By default, lspci suppresses them on machines which
+have only domain 0.
+.TP
 .B -M
 Invoke bus mapping mode which performs a thorough scan of all PCI devices, including
 those behind misconfigured bridges etc. This option is available only to root and it