X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=ls-map.c;h=a77eb0c85f55ab3b9bc176be358f6bf234900bc2;hb=1660c7373d683c3c63fdcfcf15d271ae4168e907;hp=c812f503d63a30b211d9df7ed88851a5d244b551;hpb=c7a349934e4b9160d5788c60f168bae1f0b6dd9d;p=pciutils.git diff --git a/ls-map.c b/ls-map.c index c812f50..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)) { @@ -164,6 +166,8 @@ void 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);