diff options
author | jhb <jhb@FreeBSD.org> | 2008-09-15 22:26:32 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2008-09-15 22:26:32 +0000 |
commit | c0edaf988ab997509a5c7a738c5fb5c5305cc014 (patch) | |
tree | c5d594dd29d8cb1dbd07768c75b6649ad621cee2 /sys/dev/ppbus/ppbconf.c | |
parent | a55e334c2b95f0796667f2ecdd2434e08fe6f8fc (diff) | |
download | FreeBSD-src-c0edaf988ab997509a5c7a738c5fb5c5305cc014.zip FreeBSD-src-c0edaf988ab997509a5c7a738c5fb5c5305cc014.tar.gz |
Rework the handling of interrupt handlers for children of ppc and ppbus:
- Retire IVARs for passing IRQs around. Instead, ppbus and ppc now allow
child devices to access the interrupt by via a rid 0 IRQ resource
using bus_alloc_resource_any().
- ppc creates its own interrupt event to manage the interrupt handlers of
child devices. ppc does not allow child devices to use filters. It
could allow this if needed, but none of the current drivers use them
and it adds a good bit of complication. It uses
intr_event_execute_handlers() to fire the child device interrupt handlers
from its threaded interrupt handler.
- Remove the ppbus_dummy_intr() hack. Now the ppc device always has an
interrupt handler registered and we no longer bounce all the way up to
nexus to manage adding/removing ppbus child interrupt handlers. Instead,
the child handlers are added and removed to the private interrupt event
in the ppc device.
Diffstat (limited to 'sys/dev/ppbus/ppbconf.c')
-rw-r--r-- | sys/dev/ppbus/ppbconf.c | 40 |
1 files changed, 2 insertions, 38 deletions
diff --git a/sys/dev/ppbus/ppbconf.c b/sys/dev/ppbus/ppbconf.c index 7fbd801..c0401c8 100644 --- a/sys/dev/ppbus/ppbconf.c +++ b/sys/dev/ppbus/ppbconf.c @@ -121,9 +121,6 @@ ppbus_read_ivar(device_t bus, device_t dev, int index, uintptr_t* val) case PPBUS_IVAR_AVM: *val = (u_long)ppbdev->avm; break; - case PPBUS_IVAR_IRQ: - BUS_READ_IVAR(device_get_parent(bus), bus, PPC_IVAR_IRQ, val); - break; default: return (ENOENT); } @@ -383,38 +380,9 @@ end_scan: #endif /* !DONTPROBE_1284 */ -static void -ppbus_dummy_intr(void *arg) -{ -} - static int ppbus_attach(device_t dev) { - struct ppb_data *ppb = (struct ppb_data *)device_get_softc(dev); - uintptr_t irq; - int error, rid; - - /* Attach a dummy interrupt handler to suck up any stray interrupts. */ - BUS_READ_IVAR(device_get_parent(dev), dev, PPC_IVAR_IRQ, &irq); - - if (irq > 0) { - rid = 0; - ppb->irq_res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, irq, - irq, 1, RF_SHAREABLE); - if (ppb->irq_res != NULL) { - error = bus_setup_intr(dev, ppb->irq_res, - INTR_TYPE_TTY | INTR_MPSAFE, NULL, ppbus_dummy_intr, - ppb, &ppb->intr_cookie); - if (error) { - device_printf(dev, - "failed to setup interrupt handler\n"); - bus_release_resource(dev, SYS_RES_IRQ, 0, - ppb->irq_res); - return (error); - } - } - } /* Locate our children */ bus_generic_probe(dev); @@ -433,7 +401,6 @@ ppbus_attach(device_t dev) static int ppbus_detach(device_t dev) { - struct ppb_data *ppb = (struct ppb_data *)device_get_softc(dev); device_t *children; int nchildren, i; @@ -445,10 +412,6 @@ ppbus_detach(device_t dev) free(children, M_TEMP); } - if (ppb->irq_res != NULL) { - bus_teardown_intr(dev, ppb->irq_res, ppb->intr_cookie); - bus_release_resource(dev, SYS_RES_IRQ, 0, ppb->irq_res); - } return (0); } @@ -602,7 +565,8 @@ static device_method_t ppbus_methods[] = { DEVMETHOD(bus_write_ivar, ppbus_write_ivar), DEVMETHOD(bus_setup_intr, ppbus_setup_intr), DEVMETHOD(bus_teardown_intr, ppbus_teardown_intr), - DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), + DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource), + DEVMETHOD(bus_release_resource, bus_generic_release_resource), { 0, 0 } }; |