summaryrefslogtreecommitdiffstats
path: root/sys/sparc64/pci/ofw_pcib_subr.c
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2007-06-18 21:49:42 +0000
committermarius <marius@FreeBSD.org>2007-06-18 21:49:42 +0000
commitd1ccb2d7c785a4111ecde1ed4493572d8c7e6b0b (patch)
tree967421577f0cba4602a476185885c29ead6b6624 /sys/sparc64/pci/ofw_pcib_subr.c
parent5af2c4982c0f7030084988f19a669c74fcd12a07 (diff)
downloadFreeBSD-src-d1ccb2d7c785a4111ecde1ed4493572d8c7e6b0b.zip
FreeBSD-src-d1ccb2d7c785a4111ecde1ed4493572d8c7e6b0b.tar.gz
- Move ofw_pci_alloc_busno() to the ofw_pci KOBJ interface,
allowing the driver for the host-PCI-bridge to indicate that reenumeration of the PCI busses isn't supported by returning -1 instead of a valid PCI bus number. This is needed in order support both Tomatillo, which don't support reenumeration and thus are apparently intended to be used for independently numbered PCI domains only, and Psycho bridges, whose busses need to be reenumerated on at least some E450, without the #ifndef currently used for sun4v in order to support multiple independently PCI domains. The actual allocation/incrementation of the PCI bus numbers is now done in psycho(4), though it no longer establish a mapping between bus numbers and device nodes like ofw_pci_alloc_busno() did as that functionality wasn't used (but can easily brought back if really needed). The now no longer used sys/sparc64/pci/ofw_pci.c is also removed from sys/conf/files.sun4v as ofw_pci_alloc_busno() wasn't used there in the first place. - In ofw_pci_default_{adjust_busrange,intr_pending}() sanity check that the device has a parent before passing it on. - Make psycho_softcs static to sys/sparc64/pci/psycho.c as it's not used outside of that module. - In sys/sparc64/pci/ofw_pcib_subr.c remove the superfluous inclusion of opt_global.h and correct the debug output for adjusting the subordinate bus number.
Diffstat (limited to 'sys/sparc64/pci/ofw_pcib_subr.c')
-rw-r--r--sys/sparc64/pci/ofw_pcib_subr.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/sys/sparc64/pci/ofw_pcib_subr.c b/sys/sparc64/pci/ofw_pcib_subr.c
index 834ebe3..7cc867b 100644
--- a/sys/sparc64/pci/ofw_pcib_subr.c
+++ b/sys/sparc64/pci/ofw_pcib_subr.c
@@ -27,7 +27,6 @@
__FBSDID("$FreeBSD$");
#include "opt_ofw_pci.h"
-#include "opt_global.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -54,7 +53,7 @@ ofw_pcib_gen_setup(device_t bridge)
{
struct ofw_pcib_gen_softc *sc;
#ifndef SUN4V
- u_int secbus;
+ int secbus;
#endif
sc = device_get_softc(bridge);
@@ -64,18 +63,20 @@ ofw_pcib_gen_setup(device_t bridge)
("ofw_pcib_gen_setup: no ofw pci parent bus!"));
/*
- * Setup the secondary bus number register, by allocating a new unique
- * bus number for it; the firmware preset does not always seem to be
- * correct.
+ * Setup the secondary bus number register, if supported, by
+ * allocating a new unique bus number for it; the firmware
+ * preset does not always seem to be correct in that case.
*/
#ifndef SUN4V
- secbus = ofw_pci_alloc_busno(sc->ops_node);
- pci_write_config(bridge, PCIR_PRIBUS_1, pci_get_bus(bridge), 1);
- pci_write_config(bridge, PCIR_SECBUS_1, secbus, 1);
- pci_write_config(bridge, PCIR_SUBBUS_1, secbus, 1);
- sc->ops_pcib_sc.subbus = sc->ops_pcib_sc.secbus = secbus;
- /* Notify parent bridges. */
- OFW_PCI_ADJUST_BUSRANGE(device_get_parent(bridge), secbus);
+ secbus = OFW_PCI_ALLOC_BUSNO(bridge);
+ if (secbus != -1) {
+ pci_write_config(bridge, PCIR_PRIBUS_1, pci_get_bus(bridge), 1);
+ pci_write_config(bridge, PCIR_SECBUS_1, secbus, 1);
+ pci_write_config(bridge, PCIR_SUBBUS_1, secbus, 1);
+ sc->ops_pcib_sc.subbus = sc->ops_pcib_sc.secbus = secbus;
+ /* Notify parent bridges. */
+ OFW_PCI_ADJUST_BUSRANGE(device_get_parent(bridge), secbus);
+ }
#endif
ofw_bus_setup_iinfo(sc->ops_node, &sc->ops_iinfo,
@@ -135,7 +136,7 @@ ofw_pcib_gen_adjust_busrange(device_t bridge, u_int subbus)
if (subbus > sc->ops_pcib_sc.subbus) {
#ifdef OFW_PCI_DEBUG
device_printf(bridge,
- "adjusting secondary bus number from %d to %d\n",
+ "adjusting subordinate bus number from %d to %d\n",
sc->ops_pcib_sc.subbus, subbus);
#endif
pci_write_config(bridge, PCIR_SUBBUS_1, subbus, 1);
OpenPOWER on IntegriCloud