aboutsummaryrefslogtreecommitdiff
path: root/sys/powerpc/psim
diff options
context:
space:
mode:
authorMarcel Moolenaar <marcel@FreeBSD.org>2007-08-11 19:25:32 +0000
committerMarcel Moolenaar <marcel@FreeBSD.org>2007-08-11 19:25:32 +0000
commit77d40ffd9877d089982d29a457bd816a1e72b19a (patch)
tree5173256f6143a83fb0650d3f3d3b059f81b0c1b3 /sys/powerpc/psim
parent93cccbf874db5f7805f2729d088e68ac45bfdc34 (diff)
downloadsrc-77d40ffd9877d089982d29a457bd816a1e72b19a.tar.gz
src-77d40ffd9877d089982d29a457bd816a1e72b19a.zip
Revamp the interrupt handling in support of INTR_FILTER. This includes:
o Revamp the PIC I/F to only abstract the PIC hardware. The resource handling has been moved to nexus, where it belongs. o Include EOI and MASK+EOI methods to the PIC I/F in support of INTR_FILTER. o With the allocation of interrupt resources and setup of interrupt handlers in the common platform code we can delay talking to the PIC hardware after enumeration of all devices. Introduce a call to powerpc_intr_enable() in configure_final() to achieve that and have powerpc_setup_intr() only program the PIC when !cold. o As a consequence of the above, remove all early_attach() glue from the OpenPIC and Heathrow PIC drivers and have them register themselves when they're found during enumeration. o Decouple the interrupt vector from the interrupt request line. Allocate vectors increasingly so that they can be used for the intrcnt index as well. Extend the Heathrow PIC driver to translate between IRQ and vector. The OpenPIC driver already has the support for vectors in hardware. Approved by: re (blanket)
Notes
Notes: svn path=/head/; revision=171805
Diffstat (limited to 'sys/powerpc/psim')
-rw-r--r--sys/powerpc/psim/openpic_iobus.c142
1 files changed, 14 insertions, 128 deletions
diff --git a/sys/powerpc/psim/openpic_iobus.c b/sys/powerpc/psim/openpic_iobus.c
index 9be65a85bc7a..a3a69d318c2d 100644
--- a/sys/powerpc/psim/openpic_iobus.c
+++ b/sys/powerpc/psim/openpic_iobus.c
@@ -60,117 +60,33 @@ __FBSDID("$FreeBSD$");
#include "pic_if.h"
-struct openpic_iobus_softc {
- struct openpic_softc osc;
- struct resource *sc_memr; /* iobus mem resource */
- device_t sc_ndev; /* nexus device */
-};
-
-static struct openpic_iobus_softc *ppicsoftc;
-
/*
- * MacIO interface
+ * PSIM IOBus interface
*/
-static void openpic_psim_identify(driver_t *, device_t);
-static int openpic_psim_probe(device_t);
-static int openpic_psim_attach(device_t);
static int openpic_iobus_probe(device_t);
-static int openpic_iobus_attach(device_t);
-/*
- * Nexus attachment
- */
-static device_method_t openpic_psim_methods[] = {
+static device_method_t openpic_iobus_methods[] = {
/* Device interface */
- DEVMETHOD(device_identify, openpic_psim_identify),
- DEVMETHOD(device_probe, openpic_psim_probe),
- DEVMETHOD(device_attach, openpic_psim_attach),
+ DEVMETHOD(device_probe, openpic_iobus_probe),
+ DEVMETHOD(device_attach, openpic_attach),
/* PIC interface */
- DEVMETHOD(pic_allocate_intr, openpic_allocate_intr),
- DEVMETHOD(pic_setup_intr, openpic_setup_intr),
- DEVMETHOD(pic_teardown_intr, openpic_teardown_intr),
- DEVMETHOD(pic_release_intr, openpic_release_intr),
+ DEVMETHOD(pic_dispatch, openpic_dispatch),
+ DEVMETHOD(pic_enable, openpic_enable),
+ DEVMETHOD(pic_eoi, openpic_eoi),
+ DEVMETHOD(pic_mask, openpic_mask),
+ DEVMETHOD(pic_unmask, openpic_unmask),
{ 0, 0 }
};
-static driver_t openpic_psim_driver = {
- "openpic",
- openpic_psim_methods,
- sizeof(struct openpic_iobus_softc)
-};
-
-static devclass_t openpic_psim_devclass;
-
-DRIVER_MODULE(openpic_psim, nexus, openpic_psim_driver, openpic_psim_devclass,
- 0, 0);
-
-static void
-openpic_psim_identify(driver_t *driver, device_t parent)
-{
- device_t child;
- phandle_t pic;
-
- pic = OF_finddevice("/iobus/opic");
- if (pic == -1)
- return;
-
- child = BUS_ADD_CHILD(parent, 0, "openpic", 0);
- if (child != NULL)
- nexus_set_device_type(child, "psim");
-}
-
-static int
-openpic_psim_probe(device_t dev)
-{
- char *name;
- char *type;
-
- name = nexus_get_name(dev);
- type = nexus_get_device_type(dev);
-
- if (strcmp(name, "openpic") != 0 ||
- strcmp(type, "psim") != 0)
- return (ENXIO);
-
- device_set_desc(dev, OPENPIC_DEVSTR);
- return (0);
-}
-
-static int
-openpic_psim_attach(device_t dev)
-{
- KASSERT(ppicsoftc == NULL, ("iobus openpic: already probed"));
- ppicsoftc = device_get_softc(dev);
- ppicsoftc->sc_ndev = dev;
-
- nexus_install_intcntlr(dev);
- openpic_early_attach(dev);
- return (0);
-}
-
-/*
- * PSIM IOBus attachment
- */
-static device_method_t openpic_iobus_methods[] = {
- /* Device interface */
- DEVMETHOD(device_probe, openpic_iobus_probe),
- DEVMETHOD(device_attach, openpic_iobus_attach),
-
- { 0, 0 },
-};
-
static driver_t openpic_iobus_driver = {
- "openpiciobus",
+ "openpic",
openpic_iobus_methods,
- 0
+ sizeof(struct openpic_softc)
};
-static devclass_t openpic_iobus_devclass;
-
-DRIVER_MODULE(openpiciobus, iobus, openpic_iobus_driver,
- openpic_iobus_devclass, 0, 0);
+DRIVER_MODULE(openpic, iobus, openpic_iobus_driver, openpic_devclass, 0, 0);
static int
openpic_iobus_probe(device_t dev)
@@ -179,42 +95,12 @@ openpic_iobus_probe(device_t dev)
name = iobus_get_name(dev);
if (strcmp(name, "interrupt-controller") != 0)
- return (ENXIO);
+ return (ENXIO);
/*
* The description was already printed out in the nexus
* probe, so don't do it again here
*/
- device_set_desc(dev, "OpenPIC IOBus interrupt cell");
- if (!bootverbose)
- device_quiet(dev);
+ device_set_desc(dev, OPENPIC_DEVSTR);
return (0);
}
-
-static int
-openpic_iobus_attach(device_t dev)
-{
- struct openpic_iobus_softc *sc;
- int rid;
-
- sc = ppicsoftc;
- KASSERT(sc != NULL, ("pic not nexus-probed\n"));
-
- rid = 0;
- sc->sc_memr = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
- RF_ACTIVE);
-
- if (sc->sc_memr == NULL) {
- device_printf(dev, "Could not alloc mem resource!\n");
- return (ENXIO);
- }
-
- sc->osc.sc_psim = 1;
- sc->osc.sc_bt = rman_get_bustag(sc->sc_memr);
- sc->osc.sc_bh = rman_get_bushandle(sc->sc_memr);
- sc->osc.sc_altdev = dev;
-
- return (openpic_attach(sc->sc_ndev));
-}
-
-