X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ls-map.c;h=a77eb0c85f55ab3b9bc176be358f6bf234900bc2;hb=6182921907ef3cc31be3394eb468b24bcd3955a8;hp=3044d6fdb3887a25d6c0a5f20a9614c532ac946c;hpb=864efa8c4ea34815e18c020adf7aeb91a3ae8b31;p=pciutils.git diff --git a/ls-map.c b/ls-map.c index 3044d6f..a77eb0c 100644 --- a/ls-map.c +++ b/ls-map.c @@ -3,7 +3,9 @@ * * Copyright (c) 1997--2008 Martin Mares * - * Can be freely distributed and used under the terms of the GNU GPL. + * Can be freely distributed and used under the terms of the GNU GPL v2+. + * + * SPDX-License-Identifier: GPL-2.0-or-later */ #include @@ -38,7 +40,7 @@ map_bridge(struct bus_info *bi, struct device *d, int np, int ns, int nl) b->func = p->func; b->first = get_conf_byte(d, ns); b->last = get_conf_byte(d, nl); - printf("## %02x.%02x:%d is a bridge from %02x to %02x-%02x\n", + printf("## %02x:%02x.%d is a bridge from %02x to %02x-%02x\n", p->bus, p->dev, p->func, b->this, b->first, b->last); if (b->this != p->bus) printf("!!! Bridge points to invalid primary bus.\n"); @@ -52,13 +54,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 +69,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)) { @@ -165,6 +167,7 @@ map_the_bus(void) { if (pacc->method == PCI_ACCESS_PROC_BUS_PCI || pacc->method == PCI_ACCESS_SYS_BUS_PCI || + pacc->method == PCI_ACCESS_WIN32_CFGMGR32 || pacc->method == PCI_ACCESS_DUMP) printf("WARNING: Bus mapping can be reliable only with direct hardware access enabled.\n\n"); bus_info = xmalloc(sizeof(struct bus_info) * 256);