From d60b8a3096c2760d921f7f4b6e99280cb82f8c7b Mon Sep 17 00:00:00 2001 From: marius Date: Sun, 30 Sep 2007 11:05:18 +0000 Subject: Make the PCI code aware of PCI domains (aka PCI segments) so we can support machines having multiple independently numbered PCI domains and don't support reenumeration without ambiguity amongst the devices as seen by the OS and represented by PCI location strings. This includes introducing a function pci_find_dbsf(9) which works like pci_find_bsf(9) but additionally takes a domain number argument and limiting pci_find_bsf(9) to only search devices in domain 0 (the only domain in single-domain systems). Bge(4) and ofw_pcibus(4) are changed to use pci_find_dbsf(9) instead of pci_find_bsf(9) in order to no longer report false positives when searching for siblings and dupe devices in the same domain respectively. Along with this change the sole host-PCI bridge driver converted to actually make use of PCI domain support is uninorth(4), the others continue to use domain 0 only for now and need to be converted as appropriate later on. Note that this means that the format of the location strings as used by pciconf(8) has been changed and that consumers of potentially need to be recompiled. Suggested by: jhb Reviewed by: grehan, jhb, marcel Approved by: re (kensmith), jhb (PCI maintainer hat) --- sys/powerpc/powermac/grackle.c | 4 +++- sys/powerpc/powermac/uninorth.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'sys/powerpc') diff --git a/sys/powerpc/powermac/grackle.c b/sys/powerpc/powermac/grackle.c index 9b3cffa..f606b65 100644 --- a/sys/powerpc/powermac/grackle.c +++ b/sys/powerpc/powermac/grackle.c @@ -345,10 +345,12 @@ grackle_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) sc = device_get_softc(dev); switch (which) { + case PCIB_IVAR_DOMAIN: + *result = 0; + return (0); case PCIB_IVAR_BUS: *result = sc->sc_bus; return (0); - break; } return (ENOENT); diff --git a/sys/powerpc/powermac/uninorth.c b/sys/powerpc/powermac/uninorth.c index 97bd80d..f3b0996 100644 --- a/sys/powerpc/powermac/uninorth.c +++ b/sys/powerpc/powermac/uninorth.c @@ -329,10 +329,12 @@ uninorth_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) sc = device_get_softc(dev); switch (which) { + case PCIB_IVAR_DOMAIN: + *result = device_get_unit(dev); + return (0); case PCIB_IVAR_BUS: *result = sc->sc_bus; return (0); - break; } return (ENOENT); -- cgit v1.1