summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2014-05-13 17:12:07 +0000
committerian <ian@FreeBSD.org>2014-05-13 17:12:07 +0000
commit42a63a26cfe02dc91a47c8dba60ca2aae1fa1e2a (patch)
tree96994974626d0b161a11247118a5976f448b97df
parent3d20d204d8598105e6dd4fb0d595e33d2461a02b (diff)
downloadFreeBSD-src-42a63a26cfe02dc91a47c8dba60ca2aae1fa1e2a.zip
FreeBSD-src-42a63a26cfe02dc91a47c8dba60ca2aae1fa1e2a.tar.gz
MFC r256870, r256898, r256899, r256900 (by nwhitehorn):
Standards-conformance and code deduplication: - Use bus reference phandles in place of FDT offsets as IRQ domain keys - Unify the identical macio/fdt/mambo OpenPIC drivers into one - Be more forgiving (following ePAPR) about what we need from the device tree to identify an OpenPIC - Correctly map all IRQs into an interrupt domain - Set IRQ_*_CONFORM for interrupts on an unknown PIC type instead of failing attachment for that device. Allow lots of interrupts (useful on multi-domain platforms) and do not set device_quiet() on all devices attached under nexus(4).
-rw-r--r--sys/conf/files.powerpc4
-rw-r--r--sys/dev/cfi/cfi_bus_nexus.c15
-rw-r--r--sys/dev/fdt/fdt_common.c30
-rw-r--r--sys/dev/fdt/fdt_pci.c2
-rw-r--r--sys/dev/fdt/fdt_powerpc.c3
-rw-r--r--sys/dev/fdt/fdtbus.c6
-rw-r--r--sys/dev/ofw/ofw_fdt.c2
-rw-r--r--sys/powerpc/mambo/mambo_openpic.c179
-rw-r--r--sys/powerpc/ofw/openpic_ofw.c (renamed from sys/powerpc/powermac/openpic_macio.c)51
-rw-r--r--sys/powerpc/powerpc/openpic_fdt.c93
10 files changed, 73 insertions, 312 deletions
diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc
index f97bde6..8953375 100644
--- a/sys/conf/files.powerpc
+++ b/sys/conf/files.powerpc
@@ -128,7 +128,6 @@ powerpc/mambo/mambocall.S optional mambo
powerpc/mambo/mambo.c optional mambo
powerpc/mambo/mambo_console.c optional mambo
powerpc/mambo/mambo_disk.c optional mambo
-powerpc/mambo/mambo_openpic.c optional mambo
powerpc/mpc85xx/atpic.c optional mpc85xx isa
powerpc/mpc85xx/ds1553_bus_fdt.c optional ds1553 fdt
powerpc/mpc85xx/ds1553_core.c optional ds1553
@@ -147,6 +146,7 @@ powerpc/ofw/ofw_syscons.c optional sc aim
powerpc/ofw/ofwcall32.S optional aim powerpc
powerpc/ofw/ofwcall64.S optional aim powerpc64
powerpc/ofw/ofwmagic.S optional aim
+powerpc/ofw/openpic_ofw.c optional aim | fdt
powerpc/ofw/rtas.c optional aim
powerpc/powermac/ata_kauai.c optional powermac ata | powermac atamacio
powerpc/powermac/ata_macio.c optional powermac ata | powermac atamacio
@@ -162,7 +162,6 @@ powerpc/powermac/kiic.c optional powermac kiic
powerpc/powermac/macgpio.c optional powermac pci
powerpc/powermac/macio.c optional powermac pci
powerpc/powermac/nvbl.c optional powermac nvbl
-powerpc/powermac/openpic_macio.c optional powermac pci
powerpc/powermac/platform_powermac.c optional powermac
powerpc/powermac/powermac_thermal.c optional powermac
powerpc/powermac/pswitch.c optional powermac pswitch
@@ -200,7 +199,6 @@ powerpc/powerpc/mmu_if.m standard
powerpc/powerpc/mp_machdep.c optional smp
powerpc/powerpc/nexus.c standard
powerpc/powerpc/openpic.c standard
-powerpc/powerpc/openpic_fdt.c optional fdt
powerpc/powerpc/pic_if.m standard
powerpc/powerpc/pmap_dispatch.c standard
powerpc/powerpc/platform.c standard
diff --git a/sys/dev/cfi/cfi_bus_nexus.c b/sys/dev/cfi/cfi_bus_nexus.c
index 4e1fa4e..a87ee14 100644
--- a/sys/dev/cfi/cfi_bus_nexus.c
+++ b/sys/dev/cfi/cfi_bus_nexus.c
@@ -50,14 +50,25 @@ __FBSDID("$FreeBSD$");
static int
cfi_nexus_probe(device_t dev)
{
+ return (BUS_PROBE_NOWILDCARD);
+}
+
+static int
+cfi_nexus_attach(device_t dev)
+{
+ int error;
+
+ error = cfi_probe(dev);
+ if (error != 0)
+ return (error);
- return cfi_probe(dev);
+ return cfi_attach(dev);
}
static device_method_t cfi_nexus_methods[] = {
/* device interface */
DEVMETHOD(device_probe, cfi_nexus_probe),
- DEVMETHOD(device_attach, cfi_attach),
+ DEVMETHOD(device_attach, cfi_nexus_attach),
DEVMETHOD(device_detach, cfi_detach),
{0, 0}
diff --git a/sys/dev/fdt/fdt_common.c b/sys/dev/fdt/fdt_common.c
index dad4297..740ccb5 100644
--- a/sys/dev/fdt/fdt_common.c
+++ b/sys/dev/fdt/fdt_common.c
@@ -478,21 +478,31 @@ fdt_intr_decode(phandle_t intr_parent, pcell_t *intr, int *interrupt,
int *trig, int *pol)
{
fdt_pic_decode_t intr_decode;
+ phandle_t intr_offset;
int i, rv;
+ intr_offset = OF_xref_phandle(intr_parent);
+
for (i = 0; fdt_pic_table[i] != NULL; i++) {
/* XXX check if pic_handle has interrupt-controller prop? */
intr_decode = fdt_pic_table[i];
- rv = intr_decode(intr_parent, intr, interrupt, trig, pol);
+ rv = intr_decode(intr_offset, intr, interrupt, trig, pol);
- if (rv == 0)
+ if (rv == 0) {
/* This was recognized as our PIC and decoded. */
+ *interrupt = FDT_MAP_IRQ(intr_parent, *interrupt);
return (0);
+ }
}
- return (ENXIO);
+ /* Not in table, so guess */
+ *interrupt = FDT_MAP_IRQ(intr_parent, fdt32_to_cpu(*intr));
+ *trig = INTR_TRIGGER_CONFORM;
+ *pol = INTR_POLARITY_CONFORM;
+
+ return (0);
}
int
@@ -500,7 +510,7 @@ fdt_intr_to_rl(phandle_t node, struct resource_list *rl,
struct fdt_sense_level *intr_sl)
{
phandle_t intr_par;
- ihandle_t iph;
+ phandle_t iph;
pcell_t *intr;
pcell_t intr_cells;
int interrupt, trig, pol;
@@ -517,8 +527,7 @@ fdt_intr_to_rl(phandle_t node, struct resource_list *rl,
debugf("no intr-parent phandle\n");
intr_par = OF_parent(node);
} else {
- iph = fdt32_to_cpu(iph);
- intr_par = OF_instance_to_package(iph);
+ intr_par = OF_xref_phandle(iph);
}
if (OF_getprop(intr_par, "#interrupt-cells", &intr_cells,
@@ -540,7 +549,7 @@ fdt_intr_to_rl(phandle_t node, struct resource_list *rl,
interrupt = -1;
trig = pol = 0;
- if (fdt_intr_decode(intr_par, &intr[i * intr_cells],
+ if (fdt_intr_decode(iph, &intr[i * intr_cells],
&interrupt, &trig, &pol) != 0) {
rv = ENXIO;
goto out;
@@ -557,7 +566,7 @@ fdt_intr_to_rl(phandle_t node, struct resource_list *rl,
intr_sl[i].trig = trig;
intr_sl[i].pol = pol;
- irq = FDT_MAP_IRQ(intr_par, interrupt);
+ irq = FDT_MAP_IRQ(iph, interrupt);
resource_list_add(rl, SYS_RES_IRQ, i, irq, irq, 1);
}
@@ -570,7 +579,6 @@ int
fdt_get_phyaddr(phandle_t node, device_t dev, int *phy_addr, void **phy_sc)
{
phandle_t phy_node;
- ihandle_t phy_ihandle;
pcell_t phy_handle, phy_reg;
uint32_t i;
device_t parent, child;
@@ -579,9 +587,7 @@ fdt_get_phyaddr(phandle_t node, device_t dev, int *phy_addr, void **phy_sc)
sizeof(phy_handle)) <= 0)
return (ENXIO);
- phy_ihandle = (ihandle_t)phy_handle;
- phy_ihandle = fdt32_to_cpu(phy_ihandle);
- phy_node = OF_instance_to_package(phy_ihandle);
+ phy_node = OF_xref_phandle(phy_handle);
if (OF_getprop(phy_node, "reg", (void *)&phy_reg,
sizeof(phy_reg)) <= 0)
diff --git a/sys/dev/fdt/fdt_pci.c b/sys/dev/fdt/fdt_pci.c
index a4cf9d1..bcfe300 100644
--- a/sys/dev/fdt/fdt_pci.c
+++ b/sys/dev/fdt/fdt_pci.c
@@ -320,7 +320,7 @@ fdt_pci_route_intr(int bus, int slot, int func, int pin,
trig, pol);
#if defined(__powerpc__)
- powerpc_config_intr(FDT_MAP_IRQ(intr_par, *interrupt), trig,
+ powerpc_config_intr(FDT_MAP_IRQ(iph, *interrupt), trig,
pol);
#endif
return (0);
diff --git a/sys/dev/fdt/fdt_powerpc.c b/sys/dev/fdt/fdt_powerpc.c
index ac81c08..d3e9d4e 100644
--- a/sys/dev/fdt/fdt_powerpc.c
+++ b/sys/dev/fdt/fdt_powerpc.c
@@ -123,7 +123,8 @@ fdt_pic_decode_openpic(phandle_t node, pcell_t *intr, int *interrupt,
int *trig, int *pol)
{
- if (!fdt_is_compatible(node, "chrp,open-pic"))
+ if (!fdt_is_compatible(node, "chrp,open-pic") &&
+ !fdt_is_type(node, "open-pic"))
return (ENXIO);
/*
diff --git a/sys/dev/fdt/fdtbus.c b/sys/dev/fdt/fdtbus.c
index 5390dd0..f113b8e 100644
--- a/sys/dev/fdt/fdtbus.c
+++ b/sys/dev/fdt/fdtbus.c
@@ -158,9 +158,7 @@ fdtbus_probe(device_t dev)
debugf("%s(dev=%p); pass=%u\n", __func__, dev, bus_current_pass);
- device_set_desc(dev, "FDT main bus");
- if (!bootverbose)
- device_quiet(dev);
+ device_set_desc(dev, "Flattened Device Tree");
return (BUS_PROBE_NOWILDCARD);
}
@@ -182,7 +180,7 @@ fdtbus_attach(device_t dev)
* IRQ rman.
*/
start = 0;
- end = FDT_INTR_MAX - 1;
+ end = ~0;
sc->sc_irq.rm_start = start;
sc->sc_irq.rm_end = end;
sc->sc_irq.rm_type = RMAN_ARRAY;
diff --git a/sys/dev/ofw/ofw_fdt.c b/sys/dev/ofw/ofw_fdt.c
index 7b3b0e9..4191e7e 100644
--- a/sys/dev/ofw/ofw_fdt.c
+++ b/sys/dev/ofw/ofw_fdt.c
@@ -329,7 +329,7 @@ fdt_nextprop(int offset, char *buf, size_t size)
depth = -1;
} while (depth >= 0);
- return (-1);
+ return (0);
}
/*
diff --git a/sys/powerpc/mambo/mambo_openpic.c b/sys/powerpc/mambo/mambo_openpic.c
deleted file mode 100644
index 883c9d7..0000000
--- a/sys/powerpc/mambo/mambo_openpic.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/*-
- * Copyright 2008 by Nathan Whitehorn. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-#include <sys/conf.h>
-#include <sys/kernel.h>
-
-#include <dev/ofw/ofw_bus.h>
-#include <dev/ofw/openfirm.h>
-
-#include <machine/bus.h>
-#include <machine/intr_machdep.h>
-#include <machine/md_var.h>
-#include <machine/pio.h>
-#include <machine/resource.h>
-
-#include <vm/vm.h>
-#include <vm/pmap.h>
-
-#include <sys/rman.h>
-
-#include <machine/openpicvar.h>
-
-#include "pic_if.h"
-
-/*
- * Mambo interface
- */
-static int openpic_mambo_probe(device_t);
-static int openpic_mambo_attach(device_t);
-static int openpicbus_mambo_probe(device_t dev);
-static int openpicbus_mambo_attach(device_t dev);
-static struct resource *openpicbus_alloc_resource(device_t bus, device_t dev,
- int type, int *rid, u_long start, u_long end, u_long count, u_int flags);
-
-static device_method_t openpicbus_mambo_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, openpicbus_mambo_probe),
- DEVMETHOD(device_attach, openpicbus_mambo_attach),
-
- /* Bus interface */
- DEVMETHOD(bus_alloc_resource, openpicbus_alloc_resource),
-
- {0,0}
-};
-
-struct openpicbus_softc {
- vm_offset_t picaddr;
-};
-
-static driver_t openpicbus_mambo_driver = {
- "openpicbus",
- openpicbus_mambo_methods,
- sizeof(struct openpicbus_softc),
-};
-
-static device_method_t openpic_mambo_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, openpic_mambo_probe),
- DEVMETHOD(device_attach, openpic_mambo_attach),
-
- /* PIC interface */
- DEVMETHOD(pic_config, openpic_config),
- DEVMETHOD(pic_dispatch, openpic_dispatch),
- DEVMETHOD(pic_enable, openpic_enable),
- DEVMETHOD(pic_eoi, openpic_eoi),
- DEVMETHOD(pic_ipi, openpic_ipi),
- DEVMETHOD(pic_mask, openpic_mask),
- DEVMETHOD(pic_unmask, openpic_unmask),
-
- { 0, 0 },
-};
-
-static driver_t openpic_mambo_driver = {
- "openpic",
- openpic_mambo_methods,
- sizeof(struct openpic_softc),
-};
-
-static devclass_t openpicbus_devclass;
-
-DRIVER_MODULE(openpicbus, nexus, openpicbus_mambo_driver,
- openpicbus_devclass, 0, 0);
-DRIVER_MODULE(openpic, openpicbus, openpic_mambo_driver,
- openpic_devclass, 0, 0);
-
-static int
-openpicbus_mambo_probe(device_t dev)
-{
- const char *type = ofw_bus_get_type(dev);
-
- if (type == NULL || strcmp(type, "open-pic") != 0)
- return (ENXIO);
-
- device_set_desc(dev, "Mambo OpenPIC Container");
-
- return (0);
-}
-
-static int
-openpicbus_mambo_attach(device_t dev)
-{
- uint64_t picaddr;
- phandle_t nexus;
- struct openpicbus_softc *sc;
-
- sc = device_get_softc(dev);
-
- nexus = OF_parent(ofw_bus_get_node(dev));
-
- OF_getprop(nexus,"platform-open-pic",
- &picaddr,sizeof(picaddr));
-
- sc->picaddr = picaddr;
-
- device_add_child(dev,"openpic",-1);
-
- return (bus_generic_attach(dev));
-}
-
-static struct resource *
-openpicbus_alloc_resource(device_t bus, device_t dev, int type, int *rid,
- u_long start, u_long end, u_long count, u_int flags)
-{
- struct openpicbus_softc *sc;
-
- sc = device_get_softc(bus);
-
- count = 0x40000;
- start = sc->picaddr;
- end = start + count;
-
- return (bus_alloc_resource(bus, type, rid, start, end, count, flags));
-}
-
-static int
-openpic_mambo_probe(device_t dev)
-{
-
- device_set_desc(dev, OPENPIC_DEVSTR);
- return (0);
-}
-
-static int
-openpic_mambo_attach(device_t dev)
-{
-
- return (openpic_common_attach(dev,
- ofw_bus_get_node(device_get_parent(dev))));
-}
diff --git a/sys/powerpc/powermac/openpic_macio.c b/sys/powerpc/ofw/openpic_ofw.c
index b40f951..60d8345 100644
--- a/sys/powerpc/powermac/openpic_macio.c
+++ b/sys/powerpc/ofw/openpic_ofw.c
@@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
#include <dev/ofw/openfirm.h>
#include <machine/bus.h>
@@ -55,15 +56,15 @@ __FBSDID("$FreeBSD$");
#include "pic_if.h"
/*
- * MacIO interface
+ * OFW interface
*/
-static int openpic_macio_probe(device_t);
-static int openpic_macio_attach(device_t);
+static int openpic_ofw_probe(device_t);
+static int openpic_ofw_attach(device_t);
-static device_method_t openpic_macio_methods[] = {
+static device_method_t openpic_ofw_methods[] = {
/* Device interface */
- DEVMETHOD(device_probe, openpic_macio_probe),
- DEVMETHOD(device_attach, openpic_macio_attach),
+ DEVMETHOD(device_probe, openpic_ofw_probe),
+ DEVMETHOD(device_attach, openpic_ofw_attach),
/* PIC interface */
DEVMETHOD(pic_bind, openpic_bind),
@@ -75,26 +76,35 @@ static device_method_t openpic_macio_methods[] = {
DEVMETHOD(pic_mask, openpic_mask),
DEVMETHOD(pic_unmask, openpic_unmask),
- { 0, 0 },
+ DEVMETHOD_END
};
-static driver_t openpic_macio_driver = {
+static driver_t openpic_ofw_driver = {
"openpic",
- openpic_macio_methods,
+ openpic_ofw_methods,
sizeof(struct openpic_softc),
};
-DRIVER_MODULE(openpic, macio, openpic_macio_driver, openpic_devclass, 0, 0);
+DRIVER_MODULE(openpic, nexus, 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);
static int
-openpic_macio_probe(device_t dev)
+openpic_ofw_probe(device_t dev)
{
const char *type = ofw_bus_get_type(dev);
- if (strcmp(type, "open-pic") != 0)
+ if (type == NULL)
return (ENXIO);
- /* On some U4 systems, there is a phantom MPIC in the mac-io cell */
+ if (!ofw_bus_is_compatible(dev, "chrp,open-pic") &&
+ strcmp(type, "open-pic") != 0)
+ return (ENXIO);
+
+ /*
+ * On some U4 systems, there is a phantom MPIC in the mac-io cell.
+ * The uninorth driver will pick up the real PIC, so ignore it here.
+ */
if (OF_finddevice("/u4") != (phandle_t)-1)
return (ENXIO);
@@ -103,8 +113,17 @@ openpic_macio_probe(device_t dev)
}
static int
-openpic_macio_attach(device_t dev)
+openpic_ofw_attach(device_t dev)
{
-
- return (openpic_common_attach(dev, ofw_bus_get_node(dev)));
+ phandle_t xref, node;
+
+ node = ofw_bus_get_node(dev);
+
+ if (OF_getprop(node, "phandle", &xref, sizeof(xref)) == -1 &&
+ OF_getprop(node, "ibm,phandle", &xref, sizeof(xref)) == -1 &&
+ OF_getprop(node, "linux,phandle", &xref, sizeof(xref)) == -1)
+ xref = node;
+
+ return (openpic_common_attach(dev, xref));
}
+
diff --git a/sys/powerpc/powerpc/openpic_fdt.c b/sys/powerpc/powerpc/openpic_fdt.c
deleted file mode 100644
index 1cd9369..0000000
--- a/sys/powerpc/powerpc/openpic_fdt.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*-
- * Copyright (c) 2009-2010 The FreeBSD Foundation
- * All rights reserved.
- *
- * This software was developed by Semihalf under sponsorship from
- * the FreeBSD Foundation.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/bus.h>
-
-#include <machine/bus.h>
-#include <machine/intr_machdep.h>
-
-#include <dev/ofw/ofw_bus.h>
-#include <dev/ofw/ofw_bus_subr.h>
-
-#include <machine/openpicvar.h>
-
-#include "pic_if.h"
-
-static int openpic_fdt_probe(device_t);
-static int openpic_fdt_attach(device_t);
-
-static device_method_t openpic_fdt_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, openpic_fdt_probe),
- DEVMETHOD(device_attach, openpic_fdt_attach),
-
- /* PIC interface */
- DEVMETHOD(pic_bind, openpic_bind),
- DEVMETHOD(pic_config, openpic_config),
- DEVMETHOD(pic_dispatch, openpic_dispatch),
- DEVMETHOD(pic_enable, openpic_enable),
- DEVMETHOD(pic_eoi, openpic_eoi),
- DEVMETHOD(pic_ipi, openpic_ipi),
- DEVMETHOD(pic_mask, openpic_mask),
- DEVMETHOD(pic_unmask, openpic_unmask),
-
- { 0, 0 },
-};
-
-static driver_t openpic_fdt_driver = {
- "openpic",
- openpic_fdt_methods,
- sizeof(struct openpic_softc)
-};
-
-DRIVER_MODULE(openpic, simplebus, openpic_fdt_driver, openpic_devclass, 0, 0);
-
-static int
-openpic_fdt_probe(device_t dev)
-{
-
- if (!ofw_bus_is_compatible(dev, "chrp,open-pic"))
- return (ENXIO);
-
- device_set_desc(dev, OPENPIC_DEVSTR);
- return (BUS_PROBE_DEFAULT);
-}
-
-static int
-openpic_fdt_attach(device_t dev)
-{
-
- return (openpic_common_attach(dev, ofw_bus_get_node(dev)));
-}
OpenPOWER on IntegriCloud