From c87f3d73cc4344edda4880877ce7306d127a8357 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 21 Jan 2022 13:58:56 +0100 Subject: [PATCH] lspci: Bus mapping works in non-zero domain --- ls-map.c | 8 ++++---- lspci.man | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ls-map.c b/ls-map.c index c3ef54b..10830fb 100644 --- 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)) { diff --git a/lspci.man b/lspci.man index 05e602e..c12aaa8 100644 --- 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 -- 2.39.2