diff options
author | bde <bde@FreeBSD.org> | 1996-11-13 18:31:57 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1996-11-13 18:31:57 +0000 |
commit | 9f1b68b59760da580a30207937de555fe35c107b (patch) | |
tree | a78d3dc6b9a66741e6c7c5479ddebb9fb0fecb74 /sys/dev/sio/sio.c | |
parent | 6bc86ef427c4f4e9594a1362d2edd1f9c431f1bb (diff) | |
download | FreeBSD-src-9f1b68b59760da580a30207937de555fe35c107b.zip FreeBSD-src-9f1b68b59760da580a30207937de555fe35c107b.tar.gz |
Don't fiddle with RTS if RTS flow control is off. This gives applications
almost complete control over RTS (control of its initial value is still
missing).
This fixes PR 1644 for sio.
The author of PR 1644 wants it in 2.1.6 and 2.2. This may be safe since
the complications are only in rarely used cases that I hope I've covered.
Diffstat (limited to 'sys/dev/sio/sio.c')
-rw-r--r-- | sys/dev/sio/sio.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index 2a73b2f..697deb8 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * $Id: sio.c,v 1.147 1996/09/30 12:22:27 bde Exp $ + * $Id: sio.c,v 1.148 1996/11/02 02:26:01 pst Exp $ */ #include "opt_comconsole.h" @@ -1619,6 +1619,10 @@ sioioctl(dev, cmd, data, flag, p) case TIOCCDTR: (void)commctl(com, TIOCM_DTR, DMBIC); break; + /* + * XXX should disallow changing MCR_RTS if CS_RTS_IFLOW is set. The + * changes get undone on the next call to comparam(). + */ case TIOCMSET: (void)commctl(com, *(int *)data, DMSET); break; @@ -1724,13 +1728,6 @@ repeat: * of input, so enable RTS if it is now disabled and * there is room in the high-level buffer. */ - /* - * XXX this used not to look at CS_RTS_IFLOW. The - * change is to allow full control of MCR_RTS via - * ioctls after turning CS_RTS_IFLOW off. Check - * for races. We shouldn't allow the ioctls while - * CS_RTS_IFLOW is on. - */ if ((com->state & CS_RTS_IFLOW) && !(com->mcr_image & MCR_RTS) && !(tp->t_state & TS_TBLOCK)) @@ -1957,10 +1954,22 @@ retry: outb(iobase + com_cfcr, com->cfcr_image = cfcr); if (!(tp->t_state & TS_TTSTOP)) com->state |= CS_TTGO; - if (cflag & CRTS_IFLOW) - com->state |= CS_RTS_IFLOW; /* XXX - secondary changes? */ - else + if (cflag & CRTS_IFLOW) { + com->state |= CS_RTS_IFLOW; + /* + * If CS_RTS_IFLOW just changed from off to on, the change + * needs to be propagated to MCR_RTS. This isn't urgent, + * so do it later by calling comstart() instead of repeating + * a lot of code from comstart() here. + */ + } else if (com->state & CS_RTS_IFLOW) { com->state &= ~CS_RTS_IFLOW; + /* + * CS_RTS_IFLOW just changed from on to off. Force MCR_RTS + * on here, since comstart() won't do it later. + */ + outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS); + } /* * Set up state to handle output flow control. @@ -1986,6 +1995,7 @@ retry: enable_intr(); splx(s); + comstart(tp); return (0); } @@ -2009,12 +2019,8 @@ comstart(tp) if (com->mcr_image & MCR_RTS && com->state & CS_RTS_IFLOW) outb(com->modem_ctl_port, com->mcr_image &= ~MCR_RTS); } else { - /* - * XXX don't raise MCR_RTS if CTS_RTS_IFLOW is off. Set it - * appropriately in comparam() if RTS-flow is being changed. - * Check for races. - */ - if (!(com->mcr_image & MCR_RTS) && com->iptr < com->ihighwater) + if (!(com->mcr_image & MCR_RTS) && com->iptr < com->ihighwater + && com->state & CS_RTS_IFLOW) outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS); } enable_intr(); |