diff options
author | marius <marius@FreeBSD.org> | 2007-09-30 11:05:18 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2007-09-30 11:05:18 +0000 |
commit | d60b8a3096c2760d921f7f4b6e99280cb82f8c7b (patch) | |
tree | 8043b70223b1a26b9d8903a04633a168390b18dc /sys/dev/pccbb | |
parent | 9ea9e12f35ecb014cf0a8b5047b850605706741b (diff) | |
download | FreeBSD-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/dev/pccbb')
-rw-r--r-- | sys/dev/pccbb/pccbb.c | 5 | ||||
-rw-r--r-- | sys/dev/pccbb/pccbb_pci.c | 3 | ||||
-rw-r--r-- | sys/dev/pccbb/pccbbvar.h | 1 |
3 files changed, 9 insertions, 0 deletions
diff --git a/sys/dev/pccbb/pccbb.c b/sys/dev/pccbb/pccbb.c index f511ebb..7b8fb62 100644 --- a/sys/dev/pccbb/pccbb.c +++ b/sys/dev/pccbb/pccbb.c @@ -1470,6 +1470,9 @@ cbb_read_ivar(device_t brdev, device_t child, int which, uintptr_t *result) struct cbb_softc *sc = device_get_softc(brdev); switch (which) { + case PCIB_IVAR_DOMAIN: + *result = sc->domain; + return (0); case PCIB_IVAR_BUS: *result = sc->secbus; return (0); @@ -1483,6 +1486,8 @@ cbb_write_ivar(device_t brdev, device_t child, int which, uintptr_t value) struct cbb_softc *sc = device_get_softc(brdev); switch (which) { + case PCIB_IVAR_DOMAIN: + return (EINVAL); case PCIB_IVAR_BUS: sc->secbus = value; return (0); diff --git a/sys/dev/pccbb/pccbb_pci.c b/sys/dev/pccbb/pccbb_pci.c index 8ad7e54..73a52b0 100644 --- a/sys/dev/pccbb/pccbb_pci.c +++ b/sys/dev/pccbb/pccbb_pci.c @@ -316,6 +316,7 @@ cbb_pci_attach(device_t brdev) sc->dev = brdev; sc->cbdev = NULL; sc->exca[0].pccarddev = NULL; + sc->domain = pci_get_domain(brdev); sc->secbus = pci_read_config(brdev, PCIR_SECBUS_2, 1); sc->subbus = pci_read_config(brdev, PCIR_SUBBUS_2, 1); sc->pribus = pcib_get_bus(parent); @@ -346,6 +347,8 @@ cbb_pci_attach(device_t brdev) /*Sysctls*/ sctx = device_get_sysctl_ctx(brdev); soid = device_get_sysctl_tree(brdev); + SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "domain", + CTLFLAG_RD, &sc->domain, 0, "Domain number"); SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "pribus", CTLFLAG_RD, &sc->pribus, 0, "Primary bus number"); SYSCTL_ADD_UINT(sctx, SYSCTL_CHILDREN(soid), OID_AUTO, "secbus", diff --git a/sys/dev/pccbb/pccbbvar.h b/sys/dev/pccbb/pccbbvar.h index c8201a2..ef2d82f 100644 --- a/sys/dev/pccbb/pccbbvar.h +++ b/sys/dev/pccbb/pccbbvar.h @@ -62,6 +62,7 @@ struct cbb_softc { void *intrhand; bus_space_tag_t bst; bus_space_handle_t bsh; + uint32_t domain; unsigned int pribus; unsigned int secbus; unsigned int subbus; |