Index: src/sys/dev/sbus/magma.c =================================================================== RCS file: /cvsroot/src/sys/dev/sbus/magma.c,v retrieving revision 1.32 diff -u -p -r1.32 magma.c --- src/sys/dev/sbus/magma.c 24 Dec 2005 20:27:52 -0000 1.32 +++ src/sys/dev/sbus/magma.c 12 Feb 2006 19:42:11 -0000 @@ -40,13 +40,6 @@ #include __KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.32 2005/12/24 20:27:52 perry Exp $"); -#if 0 -#define MAGMA_DEBUG -#endif - -#include "magma.h" -#if NMAGMA > 0 - #include #include #include @@ -59,7 +52,6 @@ __KERNEL_RCSID(0, "$NetBSD: magma.c,v 1. #include #include #include -#include #include #include @@ -503,8 +495,7 @@ magma_attach(parent, self, aux) * hard interrupt routine * * returns 1 if it handled it, otherwise 0 - * - * runs at interrupt priority + * runs at IPL_SERIAL */ int magma_hard(arg) @@ -725,9 +716,7 @@ magma_hard(arg) /* * magma soft interrupt handler * - * returns 1 if it handled it, 0 otherwise - * - * runs at spltty() + * runs at IPL_SOFTSERIAL */ void magma_soft(arg) @@ -776,7 +765,7 @@ magma_soft(arg) (*tp->t_linesw->l_rint)(data, tp); } - s = splhigh(); /* block out hard interrupt routine */ + s = splserial(); /* block out hard interrupt routine */ flags = mp->mp_flags; CLR(mp->mp_flags, MTTYF_DONE | MTTYF_CARRIER_CHANGED | MTTYF_RING_OVERFLOW); splx(s); /* ok */ @@ -813,7 +802,7 @@ chkbpp: if( !ISSET(mp->mp_flags, MBPPF_OPEN) ) continue; - s = splhigh(); + s = splserial(); flags = mp->mp_flags; CLR(mp->mp_flags, MBPPF_WAKEUP); splx(s); @@ -1114,7 +1103,7 @@ mttyioctl(dev, cmd, data, flags, l) struct mtty_softc *ms = mtty_cd.cd_devs[MAGMA_CARD(dev)]; struct mtty_port *mp = &ms->ms_port[MAGMA_PORT(dev)]; struct tty *tp = mp->mp_tty; - int error; + int error, s; error = (*tp->t_linesw->l_ioctl)(tp, cmd, data, flags, l); if( error != EPASSTHROUGH ) return(error); @@ -1123,15 +1112,18 @@ mttyioctl(dev, cmd, data, flags, l) if( error != EPASSTHROUGH ) return(error); error = 0; - switch(cmd) { case TIOCSBRK: /* set break */ + s = splserial(); SET(mp->mp_flags, MTTYF_SET_BREAK); + splx(s); cd1400_enable_transmitter(mp->mp_cd1400, mp->mp_channel); break; case TIOCCBRK: /* clear break */ + s = splserial(); SET(mp->mp_flags, MTTYF_CLR_BREAK); + splx(s); cd1400_enable_transmitter(mp->mp_cd1400, mp->mp_channel); break; @@ -1189,7 +1181,7 @@ mttystop(tp, flags) { struct mtty_softc *ms = mtty_cd.cd_devs[MAGMA_CARD(tp->t_dev)]; struct mtty_port *mp = &ms->ms_port[MAGMA_PORT(tp->t_dev)]; - int s; + int s, s2; s = spltty(); @@ -1201,7 +1193,9 @@ mttystop(tp, flags) * the transmit interrupt routine will disable transmit when it * notices that MTTYF_STOP has been set. */ + s2 = splserial(); SET(mp->mp_flags, MTTYF_STOP); + splx(s2); } splx(s); @@ -1519,7 +1513,7 @@ mbppopen(dev, flags, mode, l) mp = &ms->ms_port[port]; - s = spltty(); + s = splserial(); if( ISSET(mp->mp_flags, MBPPF_OPEN) ) { splx(s); return(EBUSY); @@ -1562,8 +1556,11 @@ mbppclose(dev, flag, mode, l) { struct mbpp_softc *ms = mbpp_cd.cd_devs[MAGMA_CARD(dev)]; struct mbpp_port *mp = &ms->ms_port[MAGMA_PORT(dev)]; + int s; + s = splserial(); mp->mp_flags = 0; + splx(s); return(0); } @@ -1639,13 +1636,14 @@ mbpp_rw(dev, uio, flag) if( buffer == NULL ) return(ENOMEM); + s = splserial(); SET(mp->mp_flags, MBPPF_UIO); + splx(s); /* * start timeout, if needed */ if( mp->mp_timeout > 0 ) { - SET(mp->mp_flags, MBPPF_TIMEOUT); callout_reset(&mp->mp_timeout_ch, mp->mp_timeout, mbpp_timeout, mp); } @@ -1691,12 +1689,9 @@ again: /* goto bad */ * poll delay? */ if( mp->mp_delay > 0 ) { - s = splsoftclock(); - SET(mp->mp_flags, MBPPF_DELAY); callout_reset(&mp->mp_start_ch, mp->mp_delay, mbpp_start, mp); error = tsleep(mp, PCATCH | PZERO, "mbppdelay", 0); - splx(s); if( error ) break; } @@ -1714,16 +1709,8 @@ again: /* goto bad */ /* * clear timeouts */ - s = splsoftclock(); - if( ISSET(mp->mp_flags, MBPPF_TIMEOUT) ) { - callout_stop(&mp->mp_timeout_ch); - CLR(mp->mp_flags, MBPPF_TIMEOUT); - } - if( ISSET(mp->mp_flags, MBPPF_DELAY) ) { - callout_stop(&mp->mp_start_ch); - CLR(mp->mp_flags, MBPPF_DELAY); - } - splx(s); + callout_stop(&mp->mp_timeout_ch); + callout_stop(&mp->mp_start_ch); /* * adjust for those chars that we uiomoved but never actually wrote @@ -1741,8 +1728,11 @@ mbpp_timeout(arg) void *arg; { struct mbpp_port *mp = arg; + int s; - CLR(mp->mp_flags, MBPPF_UIO | MBPPF_TIMEOUT); + s = splserial(); + CLR(mp->mp_flags, MBPPF_UIO); + splx(s); wakeup(mp); } @@ -1752,7 +1742,6 @@ mbpp_start(arg) { struct mbpp_port *mp = arg; - CLR(mp->mp_flags, MBPPF_DELAY); wakeup(mp); } @@ -1818,7 +1807,7 @@ mbpp_recv(mp, ptr, len) /* start receiving */ s = spltty(); if( cd ) { - int rcor, rbpr; + int rcor, rbpr; cd1400_write_reg(cd, CD1400_CAR, 0); @@ -1877,5 +1866,3 @@ mbpp_mstohz(m) } return(h); } - -#endif /* NMAGMA */ Index: src/sys/dev/sbus/magmareg.h =================================================================== RCS file: /cvsroot/src/sys/dev/sbus/magmareg.h,v retrieving revision 1.10 diff -u -p -r1.10 magmareg.h --- src/sys/dev/sbus/magmareg.h 24 Dec 2005 20:27:52 -0000 1.10 +++ src/sys/dev/sbus/magmareg.h 12 Feb 2006 19:42:11 -0000 @@ -183,10 +183,8 @@ struct mbpp_port { }; #define MBPPF_OPEN (1<<0) -#define MBPPF_TIMEOUT (1<<1) -#define MBPPF_UIO (1<<2) -#define MBPPF_DELAY (1<<3) -#define MBPPF_WAKEUP (1<<4) +#define MBPPF_UIO (1<<1) +#define MBPPF_WAKEUP (1<<2) struct mbpp_softc { struct device ms_dev; /* device info */