Subject: kern/4373: Probe for 16650 UART breaks if com port is console
To: None <gnats-bugs@gnats.netbsd.org>
From: Dave Huang <khym@bga.com>
List: netbsd-bugs
Date: 10/28/1997 18:36:16
>Number:         4373
>Category:       kern
>Synopsis:       Probe for 16650 UART breaks if com port is console
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 28 16:50:05 1997
>Last-Modified:
>Originator:     Dave Huang
>Organization:
Name: Dave Huang     |   Mammal, mammal / their names are called /
INet: khym@bga.com   |   they raise a paw / the bat, the cat /
FurryMUCK: Dahan     |   dolphin and dog / koala bear and hog -- TMBG
Dahan: Hani G Y+C 21 Y++ L+++ W- C++ T++ A+ E+ S++ V++ F- Q+++ P+ B+ PA+ PL++
>Release:        NetBSD 1.3_ALPHA as of October 28, 1997
>Environment:
	
System: NetBSD dahan.metonymy.com 1.3_ALPHA NetBSD 1.3_ALPHA (SPIFF) #146: Mon Oct 27 23:25:58 CST 1997 khym@dahan.metonymy.com:/usr/src.local/sys/arch/i386/compile/SPIFF i386


>Description:
	The 16650 probe prints the UART type before restoring the LCR
to a sane value. If the com port being probed happens to be the
console, this garbles the console output. Noticed by Michael
Richardson <mcr@sandelman.ottawa.on.ca> (see the bottom of PR #3844)
and myself.
>How-To-Repeat:
	Build a kernel with COM16650 and serial console and watch the
console output turn into garbage when the console gets probed.
>Fix:
--- /usr/src/sys/dev/ic/com.c	Tue Oct 21 03:19:14 1997
+++ com.c	Thu Oct 23 20:29:36 1997
@@ -444,22 +444,23 @@
 				if (bus_space_read_1(iot, ioh, com_efr) == 0) {
 					CLR(sc->sc_hwflags, COM_HW_FIFO);
 					sc->sc_fifolen = 0;
-					printf(": st16650, broken fifo\n");
 				} else {
 					SET(sc->sc_hwflags, COM_HW_FLOW);
-					printf(": st16650a, working fifo\n");
 					sc->sc_fifolen = 32;
 				}
 			} else
 #endif
-			{
-				printf(": ns16550a, working fifo\n");
 				sc->sc_fifolen = 16;
-			}
 
 #ifdef COM16650
 			bus_space_write_1(iot, ioh, com_lcr, LCR_8BITS);
+			if (sc->sc_fifolen == 0)
+				printf(": st16650, broken fifo\n");
+			else if (sc->sc_fifolen == 32)
+				printf(": st16650a, working fifo\n");
+			else
 #endif
+				printf(": ns16550a, working fifo\n");
 		} else
 			printf(": ns16550, broken fifo\n");
 	else

>Audit-Trail:
>Unformatted: