aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/uart/uart_core.c
diff options
context:
space:
mode:
authorMarius Strobl <marius@FreeBSD.org>2005-03-02 11:30:14 +0000
committerMarius Strobl <marius@FreeBSD.org>2005-03-02 11:30:14 +0000
commit2682e7b6618d1b69b1ddc9d55755b59c2a52c00e (patch)
tree260a60c8748312619ab3b320320919ad285baa2c /sys/dev/uart/uart_core.c
parent559bf8bc959a8a35828de6509d88ecfc22b9d4f9 (diff)
downloadsrc-2682e7b6618d1b69b1ddc9d55755b59c2a52c00e.tar.gz
src-2682e7b6618d1b69b1ddc9d55755b59c2a52c00e.zip
- 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
Notes
Notes: svn path=/head/; revision=143025
Diffstat (limited to 'sys/dev/uart/uart_core.c')
-rw-r--r--sys/dev/uart/uart_core.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/dev/uart/uart_core.c b/sys/dev/uart/uart_core.c
index 00fdf1610a39..7b068187e565 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);