diff options
author | Bruce Evans <bde@FreeBSD.org> | 1996-11-13 18:31:57 +0000 |
---|---|---|
committer | Bruce Evans <bde@FreeBSD.org> | 1996-11-13 18:31:57 +0000 |
commit | 750059bbc545114a38babaa13a1443c3b6b0b00e (patch) | |
tree | a78d3dc6b9a66741e6c7c5479ddebb9fb0fecb74 /sys/i386/isa/cy.c | |
parent | 0c064d6185b605a5e036c20f896aa91fb6275629 (diff) | |
download | src-750059bbc545114a38babaa13a1443c3b6b0b00e.tar.gz src-750059bbc545114a38babaa13a1443c3b6b0b00e.zip |
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.
Notes
Notes:
svn path=/head/; revision=19718
Diffstat (limited to 'sys/i386/isa/cy.c')
-rw-r--r-- | sys/i386/isa/cy.c | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/sys/i386/isa/cy.c b/sys/i386/isa/cy.c index 0c84e33adeae..5a4805b52de0 100644 --- a/sys/i386/isa/cy.c +++ b/sys/i386/isa/cy.c @@ -27,7 +27,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: cy.c,v 1.40 1996/10/14 16:10:00 davidg Exp $ + * $Id: cy.c,v 1.41 1996/10/14 16:43:11 davidg Exp $ */ #include "cy.h" @@ -1460,6 +1460,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; @@ -1567,13 +1571,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)) @@ -1952,10 +1949,27 @@ comparam(tp, t) com->state &= ~CS_TTGO; 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. + */ +#if 0 + outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS); +#else + cd_outb(iobase, CD1400_MSVR1, com->cy_align, + com->mcr_image |= MCR_RTS); +#endif + } /* * Set up state to handle output flow control. @@ -1994,6 +2008,7 @@ comparam(tp, t) enable_intr(); splx(s); + comstart(tp); return (0); } @@ -2042,12 +2057,8 @@ comstart(tp) com->mcr_image &= ~MCR_RTS); #endif } 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) #if 0 outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS); #else |