diff options
| author | mycroft <mycroft@NetBSD.org> | 1995-07-04 06:47:18 +0000 |
|---|---|---|
| committer | mycroft <mycroft@NetBSD.org> | 1995-07-04 06:47:18 +0000 |
| commit | eb99dcc09a6464e71076e716dc91c98cc8fa4917 (patch) | |
| tree | 0afca5b06ac2376a1c13b60b2a4d1140928d120e /sys | |
| parent | 69f3d14493ac95d1048098b6375222a1143aaf6f (diff) | |
Fix a condition where ttywait() wouldn't be woken up. Also, short-circuit
the case of no pending input in compoll().
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/dev/ic/com.c | 25 | ||||
| -rw-r--r-- | sys/dev/isa/com.c | 25 |
2 files changed, 30 insertions, 20 deletions
diff --git a/sys/dev/ic/com.c b/sys/dev/ic/com.c index 62cbfd608c0..8c5c5480544 100644 --- a/sys/dev/ic/com.c +++ b/sys/dev/ic/com.c @@ -1,4 +1,4 @@ -/* $NetBSD: com.c,v 1.60 1995/06/28 04:31:28 cgd Exp $ */ +/* $NetBSD: com.c,v 1.61 1995/07/04 06:47:18 mycroft Exp $ */ /*- * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved. @@ -664,8 +664,15 @@ comstart(tp) if ((tp->t_cflag & CRTSCTS) != 0 && (sc->sc_msr & MSR_CTS) == 0) goto out; - if (tp->t_outq.c_cc == 0) - goto out; + if (tp->t_outq.c_cc <= tp->t_lowat) { + if (tp->t_state & TS_ASLEEP) { + tp->t_state &= ~TS_ASLEEP; + wakeup((caddr_t)&tp->t_outq); + } + if (tp->t_outq.c_cc == 0) + goto out; + selwakeup(&tp->t_wsel); + } tp->t_state |= TS_BUSY; if (sc->sc_hwflags & COM_HW_FIFO) { u_char buffer[16], *cp = buffer; @@ -675,13 +682,6 @@ comstart(tp) } while (--n); } else outb(iobase + com_data, getc(&tp->t_outq)); - if (tp->t_outq.c_cc <= tp->t_lowat) { - if (tp->t_state & TS_ASLEEP) { - tp->t_state &= ~TS_ASLEEP; - wakeup((caddr_t)&tp->t_outq); - } - selwakeup(&tp->t_wsel); - } out: splx(s); } @@ -762,6 +762,11 @@ compoll(arg) ibufp = sc->sc_ibuf; ibufend = sc->sc_ibufp; + if (ibufp == ibufend) { + splx(s); + continue; + } + sc->sc_ibufp = sc->sc_ibuf = (ibufp == sc->sc_ibufs[0]) ? sc->sc_ibufs[1] : sc->sc_ibufs[0]; sc->sc_ibufhigh = sc->sc_ibuf + COM_IHIGHWATER; diff --git a/sys/dev/isa/com.c b/sys/dev/isa/com.c index 62cbfd608c0..8c5c5480544 100644 --- a/sys/dev/isa/com.c +++ b/sys/dev/isa/com.c @@ -1,4 +1,4 @@ -/* $NetBSD: com.c,v 1.60 1995/06/28 04:31:28 cgd Exp $ */ +/* $NetBSD: com.c,v 1.61 1995/07/04 06:47:18 mycroft Exp $ */ /*- * Copyright (c) 1993, 1994, 1995 Charles M. Hannum. All rights reserved. @@ -664,8 +664,15 @@ comstart(tp) if ((tp->t_cflag & CRTSCTS) != 0 && (sc->sc_msr & MSR_CTS) == 0) goto out; - if (tp->t_outq.c_cc == 0) - goto out; + if (tp->t_outq.c_cc <= tp->t_lowat) { + if (tp->t_state & TS_ASLEEP) { + tp->t_state &= ~TS_ASLEEP; + wakeup((caddr_t)&tp->t_outq); + } + if (tp->t_outq.c_cc == 0) + goto out; + selwakeup(&tp->t_wsel); + } tp->t_state |= TS_BUSY; if (sc->sc_hwflags & COM_HW_FIFO) { u_char buffer[16], *cp = buffer; @@ -675,13 +682,6 @@ comstart(tp) } while (--n); } else outb(iobase + com_data, getc(&tp->t_outq)); - if (tp->t_outq.c_cc <= tp->t_lowat) { - if (tp->t_state & TS_ASLEEP) { - tp->t_state &= ~TS_ASLEEP; - wakeup((caddr_t)&tp->t_outq); - } - selwakeup(&tp->t_wsel); - } out: splx(s); } @@ -762,6 +762,11 @@ compoll(arg) ibufp = sc->sc_ibuf; ibufend = sc->sc_ibufp; + if (ibufp == ibufend) { + splx(s); + continue; + } + sc->sc_ibufp = sc->sc_ibuf = (ibufp == sc->sc_ibufs[0]) ? sc->sc_ibufs[1] : sc->sc_ibufs[0]; sc->sc_ibufhigh = sc->sc_ibuf + COM_IHIGHWATER; |
