From 55aaf894e8a76fe780757ef6d9d1119c367946cf Mon Sep 17 00:00:00 2001 From: Marius Strobl 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/amd64/amd64/legacy.c | 5 +++++ sys/amd64/include/legacyvar.h | 2 ++ sys/amd64/pci/pci_bus.c | 5 +++++ 3 files changed, 12 insertions(+) (limited to 'sys/amd64') diff --git a/sys/amd64/amd64/legacy.c b/sys/amd64/amd64/legacy.c index 2247c9b4f010..f719611cfef2 100644 --- a/sys/amd64/amd64/legacy.c +++ b/sys/amd64/amd64/legacy.c @@ -207,6 +207,9 @@ legacy_read_ivar(device_t dev, device_t child, int which, uintptr_t *result) struct legacy_device *atdev = DEVTOAT(child); switch (which) { + case LEGACY_IVAR_PCIDOMAIN: + *result = 0; + break; case LEGACY_IVAR_PCIBUS: *result = atdev->lg_pcibus; break; @@ -223,6 +226,8 @@ legacy_write_ivar(device_t dev, device_t child, int which, uintptr_t value) struct legacy_device *atdev = DEVTOAT(child); switch (which) { + case LEGACY_IVAR_PCIDOMAIN: + return EINVAL; case LEGACY_IVAR_PCIBUS: atdev->lg_pcibus = value; break; diff --git a/sys/amd64/include/legacyvar.h b/sys/amd64/include/legacyvar.h index 91f784f1f143..5ab7b3567238 100644 --- a/sys/amd64/include/legacyvar.h +++ b/sys/amd64/include/legacyvar.h @@ -30,12 +30,14 @@ #define _MACHINE_LEGACYVAR_H_ enum legacy_device_ivars { + LEGACY_IVAR_PCIDOMAIN, LEGACY_IVAR_PCIBUS }; #define LEGACY_ACCESSOR(var, ivar, type) \ __BUS_ACCESSOR(legacy, var, LEGACY, ivar, type) +LEGACY_ACCESSOR(pcidomain, PCIDOMAIN, uint32_t) LEGACY_ACCESSOR(pcibus, PCIBUS, uint32_t) #undef LEGACY_ACCESSOR diff --git a/sys/amd64/pci/pci_bus.c b/sys/amd64/pci/pci_bus.c index d07c18dc6aa8..4a514f4ddfad 100644 --- a/sys/amd64/pci/pci_bus.c +++ b/sys/amd64/pci/pci_bus.c @@ -276,6 +276,9 @@ legacy_pcib_read_ivar(device_t dev, device_t child, int which, { switch (which) { + case PCIB_IVAR_DOMAIN: + *result = 0; + return 0; case PCIB_IVAR_BUS: *result = legacy_get_pcibus(dev); return 0; @@ -289,6 +292,8 @@ legacy_pcib_write_ivar(device_t dev, device_t child, int which, { switch (which) { + case PCIB_IVAR_DOMAIN: + return EINVAL; case PCIB_IVAR_BUS: legacy_set_pcibus(dev, value); return 0; -- cgit v1.3