diff options
Diffstat (limited to 'sys/pc98/cbus')
-rw-r--r-- | sys/pc98/cbus/clock.c | 32 | ||||
-rw-r--r-- | sys/pc98/cbus/pcrtc.c | 32 | ||||
-rw-r--r-- | sys/pc98/cbus/sio.c | 86 |
3 files changed, 75 insertions, 75 deletions
diff --git a/sys/pc98/cbus/clock.c b/sys/pc98/cbus/clock.c index 08af871..96b7e10 100644 --- a/sys/pc98/cbus/clock.c +++ b/sys/pc98/cbus/clock.c @@ -232,7 +232,7 @@ clkintr(struct clockframe frame) { if (timecounter->tc_get_timecount == i8254_get_timecount) { - mtx_enter(&clock_lock, MTX_SPIN); + mtx_lock_spin(&clock_lock); if (i8254_ticked) i8254_ticked = 0; else { @@ -240,7 +240,7 @@ clkintr(struct clockframe frame) i8254_lastcount = 0; } clkintr_pending = 0; - mtx_exit(&clock_lock, MTX_SPIN); + mtx_unlock_spin(&clock_lock); } timer_func(&frame); switch (timer0_state) { @@ -257,14 +257,14 @@ clkintr(struct clockframe frame) break; case ACQUIRE_PENDING: - mtx_enter(&clock_lock, MTX_SPIN); + mtx_lock_spin(&clock_lock); i8254_offset = i8254_get_timecount(NULL); i8254_lastcount = 0; timer0_max_count = TIMER_DIV(new_rate); outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT); outb(TIMER_CNTR0, timer0_max_count & 0xff); outb(TIMER_CNTR0, timer0_max_count >> 8); - mtx_exit(&clock_lock, MTX_SPIN); + mtx_unlock_spin(&clock_lock); timer_func = new_function; timer0_state = ACQUIRED; break; @@ -272,7 +272,7 @@ clkintr(struct clockframe frame) case RELEASE_PENDING: if ((timer0_prescaler_count += timer0_max_count) >= hardclock_max_count) { - mtx_enter(&clock_lock, MTX_SPIN); + mtx_lock_spin(&clock_lock); i8254_offset = i8254_get_timecount(NULL); i8254_lastcount = 0; timer0_max_count = hardclock_max_count; @@ -280,7 +280,7 @@ clkintr(struct clockframe frame) TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT); outb(TIMER_CNTR0, timer0_max_count & 0xff); outb(TIMER_CNTR0, timer0_max_count >> 8); - mtx_exit(&clock_lock, MTX_SPIN); + mtx_unlock_spin(&clock_lock); timer0_prescaler_count = 0; timer_func = hardclock; timer0_state = RELEASED; @@ -465,7 +465,7 @@ getit(void) { int high, low; - mtx_enter(&clock_lock, MTX_SPIN); + mtx_lock_spin(&clock_lock); /* Select timer0 and latch counter value. */ outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); @@ -473,7 +473,7 @@ getit(void) low = inb(TIMER_CNTR0); high = inb(TIMER_CNTR0); - mtx_exit(&clock_lock, MTX_SPIN); + mtx_unlock_spin(&clock_lock); return ((high << 8) | low); } @@ -610,10 +610,10 @@ sysbeep(int pitch, int period) splx(x); return (-1); /* XXX Should be EBUSY, but nobody cares anyway. */ } - mtx_enter(&clock_lock, MTX_SPIN); + mtx_lock_spin(&clock_lock); outb(TIMER_CNTR2, pitch); outb(TIMER_CNTR2, (pitch>>8)); - mtx_exit(&clock_lock, MTX_SPIN); + mtx_unlock_spin(&clock_lock); if (!beeping) { /* enable counter2 output to speaker */ outb(IO_PPI, inb(IO_PPI) | 3); @@ -861,7 +861,7 @@ set_timer_freq(u_int freq, int intr_freq) { int new_timer0_max_count; - mtx_enter(&clock_lock, MTX_SPIN); + mtx_lock_spin(&clock_lock); timer_freq = freq; new_timer0_max_count = hardclock_max_count = TIMER_DIV(intr_freq); if (new_timer0_max_count != timer0_max_count) { @@ -870,7 +870,7 @@ set_timer_freq(u_int freq, int intr_freq) outb(TIMER_CNTR0, timer0_max_count & 0xff); outb(TIMER_CNTR0, timer0_max_count >> 8); } - mtx_exit(&clock_lock, MTX_SPIN); + mtx_unlock_spin(&clock_lock); } /* @@ -885,11 +885,11 @@ void i8254_restore(void) { - mtx_enter(&clock_lock, MTX_SPIN); + mtx_lock_spin(&clock_lock); outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT); outb(TIMER_CNTR0, timer0_max_count & 0xff); outb(TIMER_CNTR0, timer0_max_count >> 8); - mtx_exit(&clock_lock, MTX_SPIN); + mtx_unlock_spin(&clock_lock); } /* @@ -1540,7 +1540,7 @@ i8254_get_timecount(struct timecounter *tc) u_int eflags; eflags = read_eflags(); - mtx_enter(&clock_lock, MTX_SPIN); + mtx_lock_spin(&clock_lock); /* Select timer0 and latch counter value. */ outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); @@ -1564,7 +1564,7 @@ i8254_get_timecount(struct timecounter *tc) } i8254_lastcount = count; count += i8254_offset; - mtx_exit(&clock_lock, MTX_SPIN); + mtx_unlock_spin(&clock_lock); return (count); } diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c index 08af871..96b7e10 100644 --- a/sys/pc98/cbus/pcrtc.c +++ b/sys/pc98/cbus/pcrtc.c @@ -232,7 +232,7 @@ clkintr(struct clockframe frame) { if (timecounter->tc_get_timecount == i8254_get_timecount) { - mtx_enter(&clock_lock, MTX_SPIN); + mtx_lock_spin(&clock_lock); if (i8254_ticked) i8254_ticked = 0; else { @@ -240,7 +240,7 @@ clkintr(struct clockframe frame) i8254_lastcount = 0; } clkintr_pending = 0; - mtx_exit(&clock_lock, MTX_SPIN); + mtx_unlock_spin(&clock_lock); } timer_func(&frame); switch (timer0_state) { @@ -257,14 +257,14 @@ clkintr(struct clockframe frame) break; case ACQUIRE_PENDING: - mtx_enter(&clock_lock, MTX_SPIN); + mtx_lock_spin(&clock_lock); i8254_offset = i8254_get_timecount(NULL); i8254_lastcount = 0; timer0_max_count = TIMER_DIV(new_rate); outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT); outb(TIMER_CNTR0, timer0_max_count & 0xff); outb(TIMER_CNTR0, timer0_max_count >> 8); - mtx_exit(&clock_lock, MTX_SPIN); + mtx_unlock_spin(&clock_lock); timer_func = new_function; timer0_state = ACQUIRED; break; @@ -272,7 +272,7 @@ clkintr(struct clockframe frame) case RELEASE_PENDING: if ((timer0_prescaler_count += timer0_max_count) >= hardclock_max_count) { - mtx_enter(&clock_lock, MTX_SPIN); + mtx_lock_spin(&clock_lock); i8254_offset = i8254_get_timecount(NULL); i8254_lastcount = 0; timer0_max_count = hardclock_max_count; @@ -280,7 +280,7 @@ clkintr(struct clockframe frame) TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT); outb(TIMER_CNTR0, timer0_max_count & 0xff); outb(TIMER_CNTR0, timer0_max_count >> 8); - mtx_exit(&clock_lock, MTX_SPIN); + mtx_unlock_spin(&clock_lock); timer0_prescaler_count = 0; timer_func = hardclock; timer0_state = RELEASED; @@ -465,7 +465,7 @@ getit(void) { int high, low; - mtx_enter(&clock_lock, MTX_SPIN); + mtx_lock_spin(&clock_lock); /* Select timer0 and latch counter value. */ outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); @@ -473,7 +473,7 @@ getit(void) low = inb(TIMER_CNTR0); high = inb(TIMER_CNTR0); - mtx_exit(&clock_lock, MTX_SPIN); + mtx_unlock_spin(&clock_lock); return ((high << 8) | low); } @@ -610,10 +610,10 @@ sysbeep(int pitch, int period) splx(x); return (-1); /* XXX Should be EBUSY, but nobody cares anyway. */ } - mtx_enter(&clock_lock, MTX_SPIN); + mtx_lock_spin(&clock_lock); outb(TIMER_CNTR2, pitch); outb(TIMER_CNTR2, (pitch>>8)); - mtx_exit(&clock_lock, MTX_SPIN); + mtx_unlock_spin(&clock_lock); if (!beeping) { /* enable counter2 output to speaker */ outb(IO_PPI, inb(IO_PPI) | 3); @@ -861,7 +861,7 @@ set_timer_freq(u_int freq, int intr_freq) { int new_timer0_max_count; - mtx_enter(&clock_lock, MTX_SPIN); + mtx_lock_spin(&clock_lock); timer_freq = freq; new_timer0_max_count = hardclock_max_count = TIMER_DIV(intr_freq); if (new_timer0_max_count != timer0_max_count) { @@ -870,7 +870,7 @@ set_timer_freq(u_int freq, int intr_freq) outb(TIMER_CNTR0, timer0_max_count & 0xff); outb(TIMER_CNTR0, timer0_max_count >> 8); } - mtx_exit(&clock_lock, MTX_SPIN); + mtx_unlock_spin(&clock_lock); } /* @@ -885,11 +885,11 @@ void i8254_restore(void) { - mtx_enter(&clock_lock, MTX_SPIN); + mtx_lock_spin(&clock_lock); outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT); outb(TIMER_CNTR0, timer0_max_count & 0xff); outb(TIMER_CNTR0, timer0_max_count >> 8); - mtx_exit(&clock_lock, MTX_SPIN); + mtx_unlock_spin(&clock_lock); } /* @@ -1540,7 +1540,7 @@ i8254_get_timecount(struct timecounter *tc) u_int eflags; eflags = read_eflags(); - mtx_enter(&clock_lock, MTX_SPIN); + mtx_lock_spin(&clock_lock); /* Select timer0 and latch counter value. */ outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); @@ -1564,7 +1564,7 @@ i8254_get_timecount(struct timecounter *tc) } i8254_lastcount = count; count += i8254_offset; - mtx_exit(&clock_lock, MTX_SPIN); + mtx_unlock_spin(&clock_lock); return (count); } diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c index fbc78bc..31914fe 100644 --- a/sys/pc98/cbus/sio.c +++ b/sys/pc98/cbus/sio.c @@ -1418,7 +1418,7 @@ sioprobe(dev, xrid) * but mask them in the processor as well in case there are some * (misconfigured) shared interrupts. */ - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); /* EXTRA DELAY? */ /* @@ -1528,7 +1528,7 @@ sioprobe(dev, xrid) CLR_FLAG(dev, COM_C_IIR_TXRDYBUG); } sio_setreg(com, com_cfcr, CFCR_8BITS); - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); bus_release_resource(dev, SYS_RES_IOPORT, rid, port); return (iobase == siocniobase ? 0 : result); } @@ -1586,7 +1586,7 @@ sioprobe(dev, xrid) } #endif - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); irqs = irqmap[1] & ~irqmap[0]; if (bus_get_resource(idev, SYS_RES_IRQ, 0, &xirq, NULL) == 0 && @@ -1864,7 +1864,7 @@ sioattach(dev, xrid) } else com->it_in.c_ispeed = com->it_in.c_ospeed = TTYDEF_SPEED; if (siosetwater(com, com->it_in.c_ispeed) != 0) { - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); /* * Leave i/o resources allocated if this is a `cn'-level * console, so that other devices can't snarf them. @@ -1873,7 +1873,7 @@ sioattach(dev, xrid) bus_release_resource(dev, SYS_RES_IOPORT, rid, port); return (ENOMEM); } - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); termioschars(&com->it_in); com->it_out = com->it_in; @@ -2274,7 +2274,7 @@ open_top: } } - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); #ifdef PC98 if (IS_8251(com->pc98_if_type)) { com_tiocm_bis(com, TIOCM_LE); @@ -2302,7 +2302,7 @@ open_top: #ifdef PC98 } #endif - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); /* * Handle initial DCD. Callout devices get a fake initial * DCD (trapdoor DCD). If we are callout, then any sleeping @@ -2625,7 +2625,7 @@ sioinput(com) * semantics instead of the save-and-disable semantics * that are used everywhere else. */ - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); incc = com->iptr - buf; if (tp->t_rawq.c_cc + incc > tp->t_ihiwat && (com->state & CS_RTS_IFLOW @@ -2646,7 +2646,7 @@ sioinput(com) tp->t_lflag &= ~FLUSHO; comstart(tp); } - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); } while (buf < com->iptr); } else { do { @@ -2655,7 +2655,7 @@ sioinput(com) * semantics instead of the save-and-disable semantics * that are used everywhere else. */ - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); line_status = buf[com->ierroff]; recv_data = *buf++; if (line_status @@ -2670,7 +2670,7 @@ sioinput(com) recv_data |= TTY_PE; } (*linesw[tp->t_line].l_rint)(recv_data, tp); - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); } while (buf < com->iptr); } com_events -= (com->iptr - com->ibuf); @@ -2712,9 +2712,9 @@ siointr(arg) #ifndef COM_MULTIPORT com = (struct com_s *)arg; - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); siointr1(com); - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); #else /* COM_MULTIPORT */ bool_t possibly_more_intrs; int unit; @@ -2726,7 +2726,7 @@ siointr(arg) * devices, then the edge from one may be lost because another is * on. */ - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); do { possibly_more_intrs = FALSE; for (unit = 0; unit < sio_numunits; ++unit) { @@ -2764,7 +2764,7 @@ siointr(arg) /* XXX COM_UNLOCK(); */ } } while (possibly_more_intrs); - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); #endif /* COM_MULTIPORT */ } @@ -3361,7 +3361,7 @@ repeat: * Discard any events related to never-opened or * going-away devices. */ - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); incc = com->iptr - com->ibuf; com->iptr = com->ibuf; if (com->state & CS_CHECKMSR) { @@ -3369,13 +3369,13 @@ repeat: com->state &= ~CS_CHECKMSR; } com_events -= incc; - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); continue; } if (com->iptr != com->ibuf) { - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); sioinput(com); - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); } if (com->state & CS_CHECKMSR) { u_char delta_modem_status; @@ -3383,13 +3383,13 @@ repeat: #ifdef PC98 if (!IS_8251(com->pc98_if_type)) { #endif - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); delta_modem_status = com->last_modem_status ^ com->prev_modem_status; com->prev_modem_status = com->last_modem_status; com_events -= LOTS_OF_EVENTS; com->state &= ~CS_CHECKMSR; - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); if (delta_modem_status & MSR_DCD) (*linesw[tp->t_line].l_modem) (tp, com->prev_modem_status & MSR_DCD); @@ -3398,10 +3398,10 @@ repeat: #endif } if (com->state & CS_ODONE) { - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); com_events -= LOTS_OF_EVENTS; com->state &= ~CS_ODONE; - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); if (!(com->state & CS_BUSY) && !(com->extra_state & CSE_BUSYCHECK)) { timeout(siobusycheck, com, hz / 100); @@ -3665,7 +3665,7 @@ comparam(tp, t) if (com->state >= (CS_BUSY | CS_TTGO)) siointr1(com); - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); splx(s); comstart(tp); if (com->ibufold != NULL) { @@ -3703,7 +3703,7 @@ siosetwater(com, speed) ibufsize = 2048; #endif if (ibufsize == com->ibufsize) { - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); return (0); } @@ -3713,7 +3713,7 @@ siosetwater(com, speed) */ ibuf = malloc(2 * ibufsize, M_DEVBUF, M_NOWAIT); if (ibuf == NULL) { - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); return (ENOMEM); } @@ -3731,7 +3731,7 @@ siosetwater(com, speed) * Read current input buffer, if any. Continue with interrupts * disabled. */ - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); if (com->iptr != com->ibuf) sioinput(com); @@ -3766,7 +3766,7 @@ comstart(tp) if (com == NULL) return; s = spltty(); - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); if (tp->t_state & TS_TTSTOP) com->state &= ~CS_TTGO; else @@ -3805,7 +3805,7 @@ comstart(tp) outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS); #endif } - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) { ttwwakeup(tp); splx(s); @@ -3825,7 +3825,7 @@ comstart(tp) #endif com->obufs[0].l_next = NULL; com->obufs[0].l_queued = TRUE; - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); if (com->state & CS_BUSY) { qp = com->obufq.l_next; while ((next = qp->l_next) != NULL) @@ -3837,7 +3837,7 @@ comstart(tp) com->obufq.l_next = &com->obufs[0]; com->state |= CS_BUSY; } - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); } if (tp->t_outq.c_cc != 0 && !com->obufs[1].l_queued) { com->obufs[1].l_tail @@ -3849,7 +3849,7 @@ comstart(tp) #endif com->obufs[1].l_next = NULL; com->obufs[1].l_queued = TRUE; - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); if (com->state & CS_BUSY) { qp = com->obufq.l_next; while ((next = qp->l_next) != NULL) @@ -3861,14 +3861,14 @@ comstart(tp) com->obufq.l_next = &com->obufs[1]; com->state |= CS_BUSY; } - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); } tp->t_state |= TS_BUSY; } - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); if (com->state >= (CS_BUSY | CS_TTGO)) siointr1(com); /* fake interrupt to start output */ - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); ttwwakeup(tp); splx(s); } @@ -3886,7 +3886,7 @@ comstop(tp, rw) com = com_addr(DEV_TO_UNIT(tp->t_dev)); if (com == NULL || com->gone) return; - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); if (rw & FWRITE) { #ifdef PC98 if (!IS_8251(com->pc98_if_type)) { @@ -3932,7 +3932,7 @@ comstop(tp, rw) com_events -= (com->iptr - com->ibuf); com->iptr = com->ibuf; } - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); comstart(tp); } @@ -3975,7 +3975,7 @@ commctl(com, bits, how) mcr |= MCR_RTS; if (com->gone) return(0); - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); switch (how) { case DMSET: outb(com->modem_ctl_port, @@ -3988,7 +3988,7 @@ commctl(com, bits, how) outb(com->modem_ctl_port, com->mcr_image &= ~mcr); break; } - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); return (0); } @@ -4047,9 +4047,9 @@ comwakeup(chan) com = com_addr(unit); if (com != NULL && !com->gone && (com->state >= (CS_BUSY | CS_TTGO) || com->poll)) { - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); siointr1(com); - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); } } @@ -4071,10 +4071,10 @@ comwakeup(chan) u_int delta; u_long total; - mtx_enter(&sio_lock, MTX_SPIN); + mtx_lock_spin(&sio_lock); delta = com->delta_error_counts[errnum]; com->delta_error_counts[errnum] = 0; - mtx_exit(&sio_lock, MTX_SPIN); + mtx_unlock_spin(&sio_lock); if (delta == 0) continue; total = com->error_counts[errnum] += delta; |