diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 0234b80ba2af..a1c8495794a2 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -3335,10 +3335,14 @@ siocnputc(dev, c) else iobase = siocniobase; s = spltty(); + if (sio_inited) + mtx_lock_spin(&sio_lock); siocnopen(&sp, iobase, comdefaultrate); siocntxwait(iobase); outb(iobase + com_data, c); siocnclose(&sp, iobase); + if (sio_inited) + mtx_unlock_spin(&sio_lock); splx(s); } diff --git a/sys/isa/sio.c b/sys/isa/sio.c index 0234b80ba2af..a1c8495794a2 100644 --- a/sys/isa/sio.c +++ b/sys/isa/sio.c @@ -3335,10 +3335,14 @@ siocnputc(dev, c) else iobase = siocniobase; s = spltty(); + if (sio_inited) + mtx_lock_spin(&sio_lock); siocnopen(&sp, iobase, comdefaultrate); siocntxwait(iobase); outb(iobase + com_data, c); siocnclose(&sp, iobase); + if (sio_inited) + mtx_unlock_spin(&sio_lock); splx(s); }