summaryrefslogtreecommitdiffstats
path: root/sys/sparc64/pci
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2007-09-30 11:05:18 +0000
committermarius <marius@FreeBSD.org>2007-09-30 11:05:18 +0000
commitd60b8a3096c2760d921f7f4b6e99280cb82f8c7b (patch)
tree8043b70223b1a26b9d8903a04633a168390b18dc /sys/sparc64/pci
parent9ea9e12f35ecb014cf0a8b5047b850605706741b (diff)
downloadFreeBSD-src-d60b8a3096c2760d921f7f4b6e99280cb82f8c7b.zip
FreeBSD-src-d60b8a3096c2760d921f7f4b6e99280cb82f8c7b.tar.gz
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 <sys/pciio.h> potentially need to be recompiled. Suggested by: jhb Reviewed by: grehan, jhb, marcel Approved by: re (kensmith), jhb (PCI maintainer hat)
Diffstat (limited to 'sys/sparc64/pci')
-rw-r--r--sys/sparc64/pci/apb.c2
-rw-r--r--sys/sparc64/pci/ofw_pcibus.c11
-rw-r--r--sys/sparc64/pci/psycho.c3
3 files changed, 12 insertions, 4 deletions
diff --git a/sys/sparc64/pci/apb.c b/sys/sparc64/pci/apb.c
index 58ec72c..9455882 100644
--- a/sys/sparc64/pci/apb.c
+++ b/sys/sparc64/pci/apb.c
@@ -184,6 +184,8 @@ apb_attach(device_t dev)
ofw_pcib_gen_setup(dev);
if (bootverbose) {
+ device_printf(dev, " domain %d\n",
+ sc->sc_bsc.ops_pcib_sc.domain);
device_printf(dev, " secondary bus %d\n",
sc->sc_bsc.ops_pcib_sc.secbus);
device_printf(dev, " subordinate bus %d\n",
diff --git a/sys/sparc64/pci/ofw_pcibus.c b/sys/sparc64/pci/ofw_pcibus.c
index a3e1e8b..0a03696 100644
--- a/sys/sparc64/pci/ofw_pcibus.c
+++ b/sys/sparc64/pci/ofw_pcibus.c
@@ -174,17 +174,19 @@ ofw_pcibus_attach(device_t dev)
struct ofw_pci_register pcir;
struct ofw_pcibus_devinfo *dinfo;
phandle_t node, child;
- u_int slot, busno, func;
+ u_int busno, domain, func, slot;
pcib = device_get_parent(dev);
+ domain = pcib_get_domain(dev);
/*
* Ask the bridge for the bus number - in some cases, we need to
* renumber buses, so the firmware information cannot be trusted.
*/
busno = pcib_get_bus(dev);
if (bootverbose)
- device_printf(dev, "physical bus=%d\n", busno);
+ device_printf(dev, "domain=%d, physical bus=%d\n",
+ domain, busno);
node = ofw_bus_get_node(dev);
for (child = OF_child(node); child != 0; child = OF_peer(child)) {
@@ -192,11 +194,12 @@ ofw_pcibus_attach(device_t dev)
continue;
slot = OFW_PCI_PHYS_HI_DEVICE(pcir.phys_hi);
func = OFW_PCI_PHYS_HI_FUNCTION(pcir.phys_hi);
- if (pci_find_bsf(busno, slot, func) != NULL)
+ /* Some OFW device trees contain dupes. */
+ if (pci_find_dbsf(domain, busno, slot, func) != NULL)
continue;
ofw_pcibus_setup_device(pcib, busno, slot, func);
dinfo = (struct ofw_pcibus_devinfo *)pci_read_device(pcib,
- busno, slot, func, sizeof(*dinfo));
+ domain, busno, slot, func, sizeof(*dinfo));
if (dinfo == NULL)
continue;
if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) !=
diff --git a/sys/sparc64/pci/psycho.c b/sys/sparc64/pci/psycho.c
index be6a4e3..0c2c92d 100644
--- a/sys/sparc64/pci/psycho.c
+++ b/sys/sparc64/pci/psycho.c
@@ -1030,6 +1030,9 @@ psycho_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_pci_secbus;
return (0);
OpenPOWER on IntegriCloud