Subject: port-i386/373: bogons in com.c
To: None <gnats-admin>
From: Mark Weaver <mhw@cs.brown.edu>
List: netbsd-bugs
Date: 07/31/1994 04:20:09
>Number: 373
>Category: port-i386
>Synopsis: bogons in com.c
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: gnats-admin (GNATS administrator)
>State: open
>Class: sw-bug
>Submitter-Id: mhw
>Arrival-Date: Sun Jul 31 04:20:06 1994
>Originator: Mark Weaver
>Organization:
--------------------------------------------------------------------
Email: Mark_Weaver@brown.edu | Brown University
PGP Key: finger mhw@cs.brown.edu | Dept of Computer Science
>Release: NetBSD 1.0-BETA (27-July-1994)
>Environment:
System: NetBSD cis-ts3-slip4.cis.brown.edu 1.0_BETA NetBSD 1.0_BETA (EXCELSIOR) #5: Sun Jul 31 06:15:34 EDT 1994 mhw@cis-ts3-slip4.cis.brown.edu:/usr/src/sys/arch/i386/compile/EXCELSIOR i386
>Description:
There are two problems in com.c. First, it shouldn't call
ttstart directly, it should call (*linesw[tp->t_line].l_start).
Second, in comparam, it attempts to twiddle the TS_TTSTOP flag
when CRTSCTS or MDMBUF changes, but it copies cflag over before
comparing the old and the new, so it never thinks they've changed.
These problems were originally brought up by
Ryutaroh Matsumoto <ryutaroh@fujiyama.iijnet.or.jp>,
although his patch was incorrect. I've tested the patch
below with SLIP, tip, and my serial mouse and everything
works perfectly.
>How-To-Repeat:
>Fix:
diff -c src/sys/arch/i386/isa/com.c.mhw1 src/sys/arch/i386/isa/com.c
*** src/sys/arch/i386/isa/com.c.mhw1 Sun Jul 31 06:13:27 1994
--- src/sys/arch/i386/isa/com.c Sun Jul 31 06:14:45 1994
***************
*** 557,567 ****
s = spltty();
- /* and copy to tty */
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = t->c_cflag;
-
if (ospeed == 0)
outb(iobase + com_mcr, sc->sc_mcr &= ~MCR_DTR);
else
--- 557,562 ----
***************
*** 591,597 ****
(tp->t_cflag & CRTSCTS) != (t->c_cflag & CRTSCTS)) {
if ((t->c_cflag & CRTSCTS) == 0) {
tp->t_state &= ~TS_TTSTOP;
! ttstart(tp);
} else
tp->t_state |= TS_TTSTOP;
}
--- 586,592 ----
(tp->t_cflag & CRTSCTS) != (t->c_cflag & CRTSCTS)) {
if ((t->c_cflag & CRTSCTS) == 0) {
tp->t_state &= ~TS_TTSTOP;
! (*linesw[tp->t_line].l_start)(tp);
} else
tp->t_state |= TS_TTSTOP;
}
***************
*** 605,615 ****
(tp->t_cflag & MDMBUF) != (t->c_cflag & MDMBUF)) {
if ((t->c_cflag & MDMBUF) == 0) {
tp->t_state &= ~TS_TTSTOP;
! ttstart(tp);
} else
tp->t_state |= TS_TTSTOP;
}
splx(s);
return 0;
}
--- 600,615 ----
(tp->t_cflag & MDMBUF) != (t->c_cflag & MDMBUF)) {
if ((t->c_cflag & MDMBUF) == 0) {
tp->t_state &= ~TS_TTSTOP;
! (*linesw[tp->t_line].l_start)(tp);
} else
tp->t_state |= TS_TTSTOP;
}
+ /* and copy to tty */
+ tp->t_ispeed = t->c_ispeed;
+ tp->t_ospeed = t->c_ospeed;
+ tp->t_cflag = t->c_cflag;
+
splx(s);
return 0;
}
***************
*** 722,728 ****
/* the line is up and we want to do rts/cts flow control */
if (msr & MSR_CTS) {
tp->t_state &= ~TS_TTSTOP;
! ttstart(tp);
} else
tp->t_state |= TS_TTSTOP;
}
--- 722,728 ----
/* the line is up and we want to do rts/cts flow control */
if (msr & MSR_CTS) {
tp->t_state &= ~TS_TTSTOP;
! (*linesw[tp->t_line].l_start)(tp);
} else
tp->t_state |= TS_TTSTOP;
}
>Audit-Trail:
>Unformatted:
------------------------------------------------------------------------------