diff options
author | marius <marius@FreeBSD.org> | 2005-03-02 11:30:14 +0000 |
---|---|---|
committer | marius <marius@FreeBSD.org> | 2005-03-02 11:30:14 +0000 |
commit | 271a50396925d26b7554c390da5882b7ad4c3399 (patch) | |
tree | 260a60c8748312619ab3b320320919ad285baa2c /sys/dev/uart/uart_core.c | |
parent | 965a0e0ac47fbd9bf95b4bf35b6de7cd65b6105b (diff) | |
download | FreeBSD-src-271a50396925d26b7554c390da5882b7ad4c3399.zip FreeBSD-src-271a50396925d26b7554c390da5882b7ad4c3399.tar.gz |
- Allocate the interrupt resource as RF_SHAREABLE allowing uart(4) to work
with shared IRQs in case the bus code, MD interrupt code, etc. permits.
Together with sys/sparc64/sparc64/intr_machdep.c rev. 1.21 this fixes
an endless loop in uart_intr() when using the second NS16550 on the ISA
bus of sparc64 machines.
- Destroy the hardware mutex on detach and in case attaching fails.
Approved by: marcel
Diffstat (limited to 'sys/dev/uart/uart_core.c')
-rw-r--r-- | sys/dev/uart/uart_core.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/uart/uart_core.c b/sys/dev/uart/uart_core.c index 00fdf16..7b06818 100644 --- a/sys/dev/uart/uart_core.c +++ b/sys/dev/uart/uart_core.c @@ -321,14 +321,16 @@ uart_bus_attach(device_t dev) */ sc->sc_rres = bus_alloc_resource(dev, sc->sc_rtype, &sc->sc_rrid, 0, ~0, sc->sc_class->uc_range, RF_ACTIVE); - if (sc->sc_rres == NULL) + if (sc->sc_rres == NULL) { + mtx_destroy(&sc->sc_hwmtx); return (ENXIO); + } sc->sc_bas.bsh = rman_get_bushandle(sc->sc_rres); sc->sc_bas.bst = rman_get_bustag(sc->sc_rres); sc->sc_irid = 0; sc->sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->sc_irid, - RF_ACTIVE); + RF_ACTIVE | RF_SHAREABLE); if (sc->sc_ires != NULL) { error = BUS_SETUP_INTR(device_get_parent(dev), dev, sc->sc_ires, INTR_TYPE_TTY | INTR_FAST, uart_intr, @@ -438,6 +440,8 @@ uart_bus_attach(device_t dev) } bus_release_resource(dev, sc->sc_rtype, sc->sc_rrid, sc->sc_rres); + mtx_destroy(&sc->sc_hwmtx); + return (error); } @@ -467,6 +471,8 @@ uart_bus_detach(device_t dev) } bus_release_resource(dev, sc->sc_rtype, sc->sc_rrid, sc->sc_rres); + mtx_destroy(&sc->sc_hwmtx); + if (sc->sc_class->size > sizeof(*sc)) { device_set_softc(dev, NULL); free(sc, M_UART); |