summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
diff options
context:
space:
mode:
authornwhitehorn <nwhitehorn@FreeBSD.org>2014-02-05 14:44:22 +0000
committernwhitehorn <nwhitehorn@FreeBSD.org>2014-02-05 14:44:22 +0000
commitc9c7c29042edbacac0655e50d2cb5bce2dfcf868 (patch)
treea1c26991ebc26c8653ff139a31f4170c40ded476 /sys/powerpc
parent1df1f0b35425dc8e9fad0cd70aa71dcd532433d4 (diff)
downloadFreeBSD-src-c9c7c29042edbacac0655e50d2cb5bce2dfcf868.zip
FreeBSD-src-c9c7c29042edbacac0655e50d2cb5bce2dfcf868.tar.gz
Move Open Firmware device root on PowerPC, ARM, and MIPS systems to
a sub-node of nexus (ofwbus) rather than direct attach under nexus. This fixes FDT on x86 and will make coexistence with ACPI on ARM systems easier. SPARC is unchanged. Reviewed by: imp, ian
Diffstat (limited to 'sys/powerpc')
-rw-r--r--sys/powerpc/mambo/mambo.c2
-rw-r--r--sys/powerpc/mpc85xx/lbc.c2
-rw-r--r--sys/powerpc/mpc85xx/pci_mpc85xx.c2
-rw-r--r--sys/powerpc/ofw/ofw_cpu.c2
-rw-r--r--sys/powerpc/ofw/openpic_ofw.c2
-rw-r--r--sys/powerpc/powermac/cpcht.c2
-rw-r--r--sys/powerpc/powermac/grackle.c2
-rw-r--r--sys/powerpc/powermac/smu.c2
-rw-r--r--sys/powerpc/powermac/uninorth.c2
-rw-r--r--sys/powerpc/powermac/uninorthpci.c2
-rw-r--r--sys/powerpc/powerpc/nexus.c39
-rw-r--r--sys/powerpc/pseries/rtas_dev.c2
-rw-r--r--sys/powerpc/pseries/rtas_pci.c2
-rw-r--r--sys/powerpc/pseries/vdevice.c2
-rw-r--r--sys/powerpc/pseries/xics.c4
-rw-r--r--sys/powerpc/psim/iobus.c2
16 files changed, 45 insertions, 26 deletions
diff --git a/sys/powerpc/mambo/mambo.c b/sys/powerpc/mambo/mambo.c
index aa1b9a4..2c54476 100644
--- a/sys/powerpc/mambo/mambo.c
+++ b/sys/powerpc/mambo/mambo.c
@@ -75,7 +75,7 @@ static driver_t mambobus_driver = {
static devclass_t mambobus_devclass;
-DRIVER_MODULE(mambo, nexus, mambobus_driver, mambobus_devclass, 0, 0);
+DRIVER_MODULE(mambo, ofwbus, mambobus_driver, mambobus_devclass, 0, 0);
static int
mambobus_probe(device_t dev)
diff --git a/sys/powerpc/mpc85xx/lbc.c b/sys/powerpc/mpc85xx/lbc.c
index 5c27ca4..62b56c3 100644
--- a/sys/powerpc/mpc85xx/lbc.c
+++ b/sys/powerpc/mpc85xx/lbc.c
@@ -113,7 +113,7 @@ static driver_t lbc_driver = {
devclass_t lbc_devclass;
-DRIVER_MODULE(lbc, nexus, lbc_driver, lbc_devclass, 0, 0);
+DRIVER_MODULE(lbc, ofwbus, lbc_driver, lbc_devclass, 0, 0);
/*
* Calculate address mask used by OR(n) registers. Use memory region size to
diff --git a/sys/powerpc/mpc85xx/pci_mpc85xx.c b/sys/powerpc/mpc85xx/pci_mpc85xx.c
index 0699b22..f1b958f 100644
--- a/sys/powerpc/mpc85xx/pci_mpc85xx.c
+++ b/sys/powerpc/mpc85xx/pci_mpc85xx.c
@@ -170,7 +170,7 @@ static devclass_t fsl_pcib_devclass;
DEFINE_CLASS_1(pcib, fsl_pcib_driver, fsl_pcib_methods,
sizeof(struct fsl_pcib_softc), ofw_pci_driver);
-DRIVER_MODULE(pcib, nexus, fsl_pcib_driver, fsl_pcib_devclass, 0, 0);
+DRIVER_MODULE(pcib, ofwbus, fsl_pcib_driver, fsl_pcib_devclass, 0, 0);
static int
fsl_pcib_probe(device_t dev)
diff --git a/sys/powerpc/ofw/ofw_cpu.c b/sys/powerpc/ofw/ofw_cpu.c
index 6cc6484..e830e3e 100644
--- a/sys/powerpc/ofw/ofw_cpu.c
+++ b/sys/powerpc/ofw/ofw_cpu.c
@@ -74,7 +74,7 @@ static driver_t ofw_cpulist_driver = {
static devclass_t ofw_cpulist_devclass;
-DRIVER_MODULE(ofw_cpulist, nexus, ofw_cpulist_driver, ofw_cpulist_devclass,
+DRIVER_MODULE(ofw_cpulist, ofwbus, ofw_cpulist_driver, ofw_cpulist_devclass,
0, 0);
static int
diff --git a/sys/powerpc/ofw/openpic_ofw.c b/sys/powerpc/ofw/openpic_ofw.c
index 2ddfb61..16b7575 100644
--- a/sys/powerpc/ofw/openpic_ofw.c
+++ b/sys/powerpc/ofw/openpic_ofw.c
@@ -93,7 +93,7 @@ static driver_t openpic_ofw_driver = {
sizeof(struct openpic_softc),
};
-DRIVER_MODULE(openpic, nexus, openpic_ofw_driver, openpic_devclass, 0, 0);
+DRIVER_MODULE(openpic, ofwbus, openpic_ofw_driver, openpic_devclass, 0, 0);
DRIVER_MODULE(openpic, simplebus, openpic_ofw_driver, openpic_devclass, 0, 0);
DRIVER_MODULE(openpic, macio, openpic_ofw_driver, openpic_devclass, 0, 0);
diff --git a/sys/powerpc/powermac/cpcht.c b/sys/powerpc/powermac/cpcht.c
index 5e5b7b6..004f8f0 100644
--- a/sys/powerpc/powermac/cpcht.c
+++ b/sys/powerpc/powermac/cpcht.c
@@ -135,7 +135,7 @@ struct cpcht_softc {
static devclass_t cpcht_devclass;
DEFINE_CLASS_1(pcib, cpcht_driver, cpcht_methods, sizeof(struct cpcht_softc),
ofw_pci_driver);
-DRIVER_MODULE(cpcht, nexus, cpcht_driver, cpcht_devclass, 0, 0);
+DRIVER_MODULE(cpcht, ofwbus, cpcht_driver, cpcht_devclass, 0, 0);
#define CPCHT_IOPORT_BASE 0xf4000000UL /* Hardwired */
#define CPCHT_IOPORT_SIZE 0x00400000UL
diff --git a/sys/powerpc/powermac/grackle.c b/sys/powerpc/powermac/grackle.c
index 03c975d..b4a8a3b 100644
--- a/sys/powerpc/powermac/grackle.c
+++ b/sys/powerpc/powermac/grackle.c
@@ -102,7 +102,7 @@ static device_method_t grackle_methods[] = {
static devclass_t grackle_devclass;
DEFINE_CLASS_1(pcib, grackle_driver, grackle_methods,
sizeof(struct grackle_softc), ofw_pci_driver);
-DRIVER_MODULE(grackle, nexus, grackle_driver, grackle_devclass, 0, 0);
+DRIVER_MODULE(grackle, ofwbus, grackle_driver, grackle_devclass, 0, 0);
static int
grackle_probe(device_t dev)
diff --git a/sys/powerpc/powermac/smu.c b/sys/powerpc/powermac/smu.c
index 5c622e3..5b74da3 100644
--- a/sys/powerpc/powermac/smu.c
+++ b/sys/powerpc/powermac/smu.c
@@ -210,7 +210,7 @@ static driver_t smu_driver = {
static devclass_t smu_devclass;
-DRIVER_MODULE(smu, nexus, smu_driver, smu_devclass, 0, 0);
+DRIVER_MODULE(smu, ofwbus, smu_driver, smu_devclass, 0, 0);
static MALLOC_DEFINE(M_SMU, "smu", "SMU Sensor Information");
#define SMU_MAILBOX 0x8000860c
diff --git a/sys/powerpc/powermac/uninorth.c b/sys/powerpc/powermac/uninorth.c
index ab051a5..421e625 100644
--- a/sys/powerpc/powermac/uninorth.c
+++ b/sys/powerpc/powermac/uninorth.c
@@ -143,7 +143,7 @@ static devclass_t unin_chip_devclass;
*/
static device_t unin_chip;
-DRIVER_MODULE(unin, nexus, unin_chip_driver, unin_chip_devclass, 0, 0);
+DRIVER_MODULE(unin, ofwbus, unin_chip_driver, unin_chip_devclass, 0, 0);
/*
* Add an interrupt to the dev's resource list if present
diff --git a/sys/powerpc/powermac/uninorthpci.c b/sys/powerpc/powermac/uninorthpci.c
index 5cf7a79..9da06ff 100644
--- a/sys/powerpc/powermac/uninorthpci.c
+++ b/sys/powerpc/powermac/uninorthpci.c
@@ -98,7 +98,7 @@ static devclass_t uninorth_devclass;
DEFINE_CLASS_1(pcib, uninorth_driver, uninorth_methods,
sizeof(struct uninorth_softc), ofw_pci_driver);
-DRIVER_MODULE(uninorth, nexus, uninorth_driver, uninorth_devclass, 0, 0);
+DRIVER_MODULE(uninorth, ofwbus, uninorth_driver, uninorth_devclass, 0, 0);
static int
uninorth_probe(device_t dev)
diff --git a/sys/powerpc/powerpc/nexus.c b/sys/powerpc/powerpc/nexus.c
index 2e9bbe6..8a4d815 100644
--- a/sys/powerpc/powerpc/nexus.c
+++ b/sys/powerpc/powerpc/nexus.c
@@ -49,7 +49,6 @@ __FBSDID("$FreeBSD$");
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
-#include <dev/ofw/ofw_nexus.h>
#include <dev/ofw/openfirm.h>
#include <machine/bus.h>
@@ -57,15 +56,12 @@ __FBSDID("$FreeBSD$");
#include <machine/resource.h>
/*
- * The nexus (which is a pseudo-bus actually) iterates over the nodes that
- * hang from the Open Firmware root node and adds them as devices to this bus
- * (except some special nodes which are excluded) so that drivers can be
- * attached to them.
- *
- * Additionally, interrupt setup/teardown and some resource management are
- * done at this level.
+ * The nexus handles root-level resource allocation requests and interrupt
+ * mapping. All direct subdevices of nexus are attached by DEVICE_IDENTIFY().
*/
+static device_probe_t nexus_probe;
+static device_attach_t nexus_attach;
static bus_setup_intr_t nexus_setup_intr;
static bus_teardown_intr_t nexus_teardown_intr;
static bus_activate_resource_t nexus_activate_resource;
@@ -77,7 +73,12 @@ static bus_config_intr_t nexus_config_intr;
static ofw_bus_map_intr_t nexus_ofw_map_intr;
static device_method_t nexus_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, nexus_probe),
+ DEVMETHOD(device_attach, nexus_attach),
+
/* Bus interface */
+ DEVMETHOD(bus_add_child, bus_generic_add_child),
DEVMETHOD(bus_activate_resource, nexus_activate_resource),
DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
DEVMETHOD(bus_setup_intr, nexus_setup_intr),
@@ -95,13 +96,31 @@ static device_method_t nexus_methods[] = {
static devclass_t nexus_devclass;
-DEFINE_CLASS_1(nexus, nexus_driver, nexus_methods,
- sizeof(struct ofw_nexus_softc), ofw_nexus_driver);
+DEFINE_CLASS_0(nexus, nexus_driver, nexus_methods, 1);
EARLY_DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0,
BUS_PASS_BUS);
MODULE_VERSION(nexus, 1);
static int
+nexus_probe(device_t dev)
+{
+
+ device_quiet(dev); /* suppress attach message for neatness */
+
+ return (BUS_PROBE_DEFAULT);
+}
+
+static int
+nexus_attach(device_t dev)
+{
+
+ bus_generic_probe(dev);
+ bus_generic_attach(dev);
+
+ return (0);
+}
+
+static int
nexus_setup_intr(device_t bus __unused, device_t child, struct resource *r,
int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg,
void **cookiep)
diff --git a/sys/powerpc/pseries/rtas_dev.c b/sys/powerpc/pseries/rtas_dev.c
index 36cb199..79d70e2 100644
--- a/sys/powerpc/pseries/rtas_dev.c
+++ b/sys/powerpc/pseries/rtas_dev.c
@@ -73,7 +73,7 @@ static driver_t rtasdev_driver = {
static devclass_t rtasdev_devclass;
-DRIVER_MODULE(rtasdev, nexus, rtasdev_driver, rtasdev_devclass, 0, 0);
+DRIVER_MODULE(rtasdev, ofwbus, rtasdev_driver, rtasdev_devclass, 0, 0);
static int
rtasdev_probe(device_t dev)
diff --git a/sys/powerpc/pseries/rtas_pci.c b/sys/powerpc/pseries/rtas_pci.c
index 0835a27..90a7e6b 100644
--- a/sys/powerpc/pseries/rtas_pci.c
+++ b/sys/powerpc/pseries/rtas_pci.c
@@ -99,7 +99,7 @@ struct rtaspci_softc {
static devclass_t rtaspci_devclass;
DEFINE_CLASS_1(pcib, rtaspci_driver, rtaspci_methods,
sizeof(struct rtaspci_softc), ofw_pci_driver);
-DRIVER_MODULE(rtaspci, nexus, rtaspci_driver, rtaspci_devclass, 0, 0);
+DRIVER_MODULE(rtaspci, ofwbus, rtaspci_driver, rtaspci_devclass, 0, 0);
static int
rtaspci_probe(device_t dev)
diff --git a/sys/powerpc/pseries/vdevice.c b/sys/powerpc/pseries/vdevice.c
index e733a9d..d2c399b 100644
--- a/sys/powerpc/pseries/vdevice.c
+++ b/sys/powerpc/pseries/vdevice.c
@@ -103,7 +103,7 @@ static driver_t vdevice_driver = {
static devclass_t vdevice_devclass;
-DRIVER_MODULE(vdevice, nexus, vdevice_driver, vdevice_devclass, 0, 0);
+DRIVER_MODULE(vdevice, ofwbus, vdevice_driver, vdevice_devclass, 0, 0);
static int
vdevice_probe(device_t dev)
diff --git a/sys/powerpc/pseries/xics.c b/sys/powerpc/pseries/xics.c
index 7bfbb3d..47b53d6 100644
--- a/sys/powerpc/pseries/xics.c
+++ b/sys/powerpc/pseries/xics.c
@@ -122,9 +122,9 @@ static driver_t xics_driver = {
static devclass_t xicp_devclass;
static devclass_t xics_devclass;
-EARLY_DRIVER_MODULE(xicp, nexus, xicp_driver, xicp_devclass, 0, 0,
+EARLY_DRIVER_MODULE(xicp, ofwbus, xicp_driver, xicp_devclass, 0, 0,
BUS_PASS_INTERRUPT-1);
-EARLY_DRIVER_MODULE(xics, nexus, xics_driver, xics_devclass, 0, 0,
+EARLY_DRIVER_MODULE(xics, ofwbus, xics_driver, xics_devclass, 0, 0,
BUS_PASS_INTERRUPT);
static int
diff --git a/sys/powerpc/psim/iobus.c b/sys/powerpc/psim/iobus.c
index 6ed8cd3..6a6ac27 100644
--- a/sys/powerpc/psim/iobus.c
+++ b/sys/powerpc/psim/iobus.c
@@ -116,7 +116,7 @@ static driver_t iobus_driver = {
devclass_t iobus_devclass;
-DRIVER_MODULE(iobus, nexus, iobus_driver, iobus_devclass, 0, 0);
+DRIVER_MODULE(iobus, ofwbus, iobus_driver, iobus_devclass, 0, 0);
static int
iobus_probe(device_t dev)
OpenPOWER on IntegriCloud