diff options
author | Pali Rohár <pali@kernel.org> | 2022-01-02 20:49:30 +0100 |
---|---|---|
committer | Pali Rohár <pali@kernel.org> | 2022-11-05 11:41:55 +0100 |
commit | 8d750a8deb1280e6fd3fdcc7b63b2593be5988c5 (patch) | |
tree | 545808b4586b393b04d131f590110be71158f699 /lib | |
parent | 55704534e519d38ed4c2362925b2a68cf4c1e476 (diff) | |
download | pciutils-8d750a8deb1280e6fd3fdcc7b63b2593be5988c5.tar.gz |
libpci: Add new internal function pci_generic_scan_domain()
Function pci_generic_scan() scans PCI domain 0. This new function
pci_generic_scan_domain() scans specified PCI domain number.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/aix-device.c | 2 | ||||
-rw-r--r-- | lib/generic.c | 16 | ||||
-rw-r--r-- | lib/internal.h | 3 | ||||
-rw-r--r-- | lib/sylixos-device.c | 2 |
4 files changed, 16 insertions, 7 deletions
diff --git a/lib/aix-device.c b/lib/aix-device.c index f7d8e78..9355395 100644 --- a/lib/aix-device.c +++ b/lib/aix-device.c @@ -206,7 +206,7 @@ aix_scan(struct pci_access *a) bus_number = pci_buses[i].bus_number; if (!busmap[bus_number]) { - pci_generic_scan_bus(a, busmap, bus_number); + pci_generic_scan_bus(a, busmap, 0, bus_number); } } } diff --git a/lib/generic.c b/lib/generic.c index d178a44..6211c90 100644 --- a/lib/generic.c +++ b/lib/generic.c @@ -11,7 +11,7 @@ #include "internal.h" void -pci_generic_scan_bus(struct pci_access *a, byte *busmap, int bus) +pci_generic_scan_bus(struct pci_access *a, byte *busmap, int domain, int bus) { int dev, multi, ht; struct pci_dev *t; @@ -24,6 +24,7 @@ pci_generic_scan_bus(struct pci_access *a, byte *busmap, int bus) } busmap[bus] = 1; t = pci_alloc_dev(a); + t->domain = domain; t->bus = bus; for (dev=0; dev<32; dev++) { @@ -41,6 +42,7 @@ pci_generic_scan_bus(struct pci_access *a, byte *busmap, int bus) multi = ht & 0x80; ht &= 0x7f; d = pci_alloc_dev(a); + d->domain = t->domain; d->bus = t->bus; d->dev = t->dev; d->func = t->func; @@ -55,7 +57,7 @@ pci_generic_scan_bus(struct pci_access *a, byte *busmap, int bus) break; case PCI_HEADER_TYPE_BRIDGE: case PCI_HEADER_TYPE_CARDBUS: - pci_generic_scan_bus(a, busmap, pci_read_byte(t, PCI_SECONDARY_BUS)); + pci_generic_scan_bus(a, busmap, domain, pci_read_byte(t, PCI_SECONDARY_BUS)); break; default: a->debug("Device %04x:%02x:%02x.%d has unknown header type %02x.\n", d->domain, d->bus, d->dev, d->func, ht); @@ -66,12 +68,18 @@ pci_generic_scan_bus(struct pci_access *a, byte *busmap, int bus) } void -pci_generic_scan(struct pci_access *a) +pci_generic_scan_domain(struct pci_access *a, int domain) { byte busmap[256]; memset(busmap, 0, sizeof(busmap)); - pci_generic_scan_bus(a, busmap, 0); + pci_generic_scan_bus(a, busmap, domain, 0); +} + +void +pci_generic_scan(struct pci_access *a) +{ + pci_generic_scan_domain(a, 0); } static int diff --git a/lib/internal.h b/lib/internal.h index 11cf5a6..475f0b8 100644 --- a/lib/internal.h +++ b/lib/internal.h @@ -67,7 +67,8 @@ struct pci_methods { }; /* generic.c */ -void pci_generic_scan_bus(struct pci_access *, byte *busmap, int bus); +void pci_generic_scan_bus(struct pci_access *, byte *busmap, int domain, int bus); +void pci_generic_scan_domain(struct pci_access *, int domain); void pci_generic_scan(struct pci_access *); void pci_generic_fill_info(struct pci_dev *, unsigned int flags); int pci_generic_block_read(struct pci_dev *, int pos, byte *buf, int len); diff --git a/lib/sylixos-device.c b/lib/sylixos-device.c index a23438e..07195d5 100644 --- a/lib/sylixos-device.c +++ b/lib/sylixos-device.c @@ -25,7 +25,7 @@ sylixos_scan(struct pci_access *a) for (bus = 0; bus < PCI_MAX_BUS; bus++) if (!busmap[bus]) - pci_generic_scan_bus(a, busmap, bus); + pci_generic_scan_bus(a, busmap, 0, bus); } static void |