diff options
Diffstat (limited to 'usr.sbin/bhyve/uart_emul.c')
-rw-r--r-- | usr.sbin/bhyve/uart_emul.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/usr.sbin/bhyve/uart_emul.c b/usr.sbin/bhyve/uart_emul.c index 58d6697e4fea..bc71d4760634 100644 --- a/usr.sbin/bhyve/uart_emul.c +++ b/usr.sbin/bhyve/uart_emul.c @@ -83,7 +83,6 @@ static struct { struct uart_ns16550_softc { struct uart_softc *backend; - pthread_mutex_t mtx; /* protects all softc elements */ uint8_t data; /* Data register (R/W) */ uint8_t ier; /* Interrupt enable register (R/W) */ uint8_t lcr; /* Line control register (R/W) */ @@ -204,14 +203,14 @@ uart_drain(int fd __unused, enum ev_type ev, void *arg) * to take out the softc lock to protect against concurrent * access from a vCPU i/o exit */ - pthread_mutex_lock(&sc->mtx); + uart_softc_lock(sc->backend); loopback = (sc->mcr & MCR_LOOPBACK) != 0; uart_rxfifo_drain(sc->backend, loopback); if (!loopback) uart_toggle_intr(sc); - pthread_mutex_unlock(&sc->mtx); + uart_softc_unlock(sc->backend); } void @@ -220,7 +219,7 @@ uart_ns16550_write(struct uart_ns16550_softc *sc, int offset, uint8_t value) int fifosz; uint8_t msr; - pthread_mutex_lock(&sc->mtx); + uart_softc_lock(sc->backend); /* * Take care of the special case DLAB accesses first @@ -329,7 +328,7 @@ uart_ns16550_write(struct uart_ns16550_softc *sc, int offset, uint8_t value) done: uart_toggle_intr(sc); - pthread_mutex_unlock(&sc->mtx); + uart_softc_unlock(sc->backend); } uint8_t @@ -337,7 +336,7 @@ uart_ns16550_read(struct uart_ns16550_softc *sc, int offset) { uint8_t iir, intr_reason, reg; - pthread_mutex_lock(&sc->mtx); + uart_softc_lock(sc->backend); /* * Take care of the special case DLAB accesses first @@ -414,7 +413,7 @@ uart_ns16550_read(struct uart_ns16550_softc *sc, int offset) done: uart_toggle_intr(sc); - pthread_mutex_unlock(&sc->mtx); + uart_softc_unlock(sc->backend); return (reg); } @@ -446,8 +445,6 @@ uart_ns16550_init(uart_intr_func_t intr_assert, uart_intr_func_t intr_deassert, sc->intr_deassert = intr_deassert; sc->backend = uart_init(); - pthread_mutex_init(&sc->mtx, NULL); - uart_reset(sc); return (sc); |