]> git.ipfire.org Git - thirdparty/pciutils.git/commitdiff
lspci: Bus mapping works in non-zero domain
authorMartin Mares <mj@ucw.cz>
Fri, 21 Jan 2022 12:58:56 +0000 (13:58 +0100)
committerMartin Mares <mj@ucw.cz>
Fri, 21 Jan 2022 12:58:56 +0000 (13:58 +0100)
ls-map.c
lspci.man

index c3ef54b7b1f59f60ac891a11157bc403f35becf0..10830fbfb730ecc4e29c5ced2fb501d97d2c90e8 100644 (file)
--- a/ls-map.c
+++ b/ls-map.c
@@ -52,13 +52,14 @@ map_bridge(struct bus_info *bi, struct device *d, int np, int ns, int nl)
 static void
 do_map_bus(int bus)
 {
+  int domain = (filter.domain >= 0 ? filter.domain : 0);
   int dev, func;
   int verbose = pacc->debugging;
   struct bus_info *bi = bus_info + bus;
   struct device *d;
 
   if (verbose)
-    printf("Mapping bus %02x\n", bus);
+    printf("Mapping bus %04x:%02x\n", domain, bus);
   for (dev = 0; dev < 32; dev++)
     if (filter.slot < 0 || filter.slot == dev)
       {
@@ -66,15 +67,14 @@ do_map_bus(int bus)
        for (func = 0; func < func_limit; func++)
          if (filter.func < 0 || filter.func == func)
            {
-             /* XXX: Bus mapping supports only domain 0 */
-             struct pci_dev *p = pci_get_dev(pacc, 0, bus, dev, func);
+             struct pci_dev *p = pci_get_dev(pacc, domain, bus, dev, func);
              u16 vendor = pci_read_word(p, PCI_VENDOR_ID);
              if (vendor && vendor != 0xffff)
                {
                  if (!func && (pci_read_byte(p, PCI_HEADER_TYPE) & 0x80))
                    func_limit = 8;
                  if (verbose)
-                   printf("Discovered device %02x:%02x.%d\n", bus, dev, func);
+                   printf("Discovered device %04x:%02x:%02x.%d\n", domain, bus, dev, func);
                  bi->exists = 1;
                  if (d = scan_device(p))
                    {
index 05e602eb0c4bf90f5525754f7fe3536c1aba2877..c12aaa87c6e35dbb5a1f780869cb5816082121e1 100644 (file)
--- a/lspci.man
+++ b/lspci.man
@@ -167,7 +167,9 @@ Applies only to Linux systems with recent enough module tools.
 Invoke bus mapping mode which performs a thorough scan of all PCI devices, including
 those behind misconfigured bridges, etc. This option gives meaningful results only
 with a direct hardware access mode, which usually requires root privileges.
-Please note that the bus mapper only scans PCI domain 0.
+By default, the bus mapper scans domain. You can use the
+.B -s
+option to select a different domain.
 .TP
 .B --version
 Shows