NetBSD Problem Report #8248

Received: (qmail 4131 invoked from network); 21 Aug 1999 11:52:32 -0000
Message-Id: <199908211152.NAA23482@i41am1.ira.uka.de>
Date: Sat, 21 Aug 1999 13:52:03 +0200 (MEST)
From: frueauf@netbsd.org
Reply-To: frueauf@netbsd.org
To: gnats-bugs@gnats.netbsd.org
Subject: reset from a Sun Ultra 10 at a console via com0 resets the NetBSD 
         machine too
X-Send-Pr-Version: 3.95

>Number:         8248
>Category:       port-i386
>Synopsis:       reset from a Sun Ultra 10 at a console via com0 resets the NetBSD
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    mycroft
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 21 05:05:00 +0000 1999
>Closed-Date:    Mon Jun 12 18:23:02 +0000 2006
>Last-Modified:  Mon Jun 12 18:23:02 +0000 2006
>Originator:     Thorsten Frueauf
>Release:        19990814
>Organization:
private

>Environment:


Toshiba Tecra 500CDT

System: NetBSD cyberlap 1.4J NetBSD 1.4J (CYBERLAP) #2: Sun Aug 15 20:35:20 MEST 1999 frueauf@cyberlap:/usr/src/sys/arch/i386/compile/CYBERLAP i386

kernel entry:
com0    at isa? port 0x3f8 irq 4        # Standard PC serial ports

message at boot time:
com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo

/etc/remote:
hardwire:dv=/dev/tty00:br#9600:dc:pa=none


>Description:

I connected the serial port from my laptop running NetBSD-current build
from 14.08.1999 sources to the serial port of an "headless" Sun Ultra 10
to act as console. Via the command `tip hardwire` I got the console
from the machine as expected. Some time later I had to reboot the
Sun Ultra 10, but when it came to "resetting" in the boot prom, suddenly
the laptop running NetBSD froze and did a reset too :-(

>How-To-Repeat:

Try to run as console for a Sun Ultra 10 with a Toshiba Tecra 500CDT
running NetBSD-current and reboot the Sun Ultra 10.

>Fix:

I have no idea, sorry.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: port-i386-maintainer->mycroft 
Responsible-Changed-By: mycroft 
Responsible-Changed-When: Sun Jul 4 06:30:36 UTC 2004 
Responsible-Changed-Why:  
. 

From: "Charles M. Hannum" <mycroft@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:  
Subject: pr/8248 CVS commit: src/sys/dev/ic
Date: Sun,  4 Jul 2004 08:09:03 +0000 (UTC)

 Module Name:	src
 Committed By:	mycroft
 Date:		Sun Jul  4 08:09:03 UTC 2004

 Modified Files:
 	src/sys/dev/ic: com.c

 Log Message:
 Incorporate 4 changes that have been suggested:
 * At high speed, set the FIFO trigger to the maximum value to reduce interrupt
   load.  PR 15448.
 * Handler the case of IIR=RXRDY and LSR=!LSR_RCV_MASK differently, to avoid a
   hang with some chips.  PR 21184, and possibly PR 10974 and PR 8248.
 * Remove the extra wait at the end of com_common_putc(), after writing a
   character out, so that we get another TXRDY interrupt.  This prevents stalls
   when normal output and kernel output are mixed.  PR 4263.
 * Do not "preload" the TX FIFO; wait for a TXRDY interrupt to come in after
   enabling it.


 To generate a diff of this commit:
 cvs rdiff -r1.227 -r1.228 src/sys/dev/ic/com.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback 
State-Changed-By: mycroft 
State-Changed-When: Sun Jul 4 08:59:00 UTC 2004 
State-Changed-Why:  
This is believe to be fixed by com.c 1.228. 

From: Thorsten Frueauf <milano@zhadum.de>
To: gnats-bugs@gnats.netbsd.org
Cc: frueauf@netbsd.org, mycroft@netbsd.org
Subject: Re: port-i386/8248
Date: Mon, 5 Jul 2004 11:28:32 +0200

 Hello,

 > This is believe to be fixed by com.c 1.228.

 Is it possible to get the fix isolated, so I can test it under
 NetBSD 1.5.4_ALPHA (sys/dev/ic/com.c is 1.172), or is it to
 complicated?
 Unfortunatly I have no other system to test this currently, and I won't be
 able to update the system to -current or 2.0 any time soon.

 Greets
       Thorsten

From: "Charles M. Hannum" <mycroft@netbsd.org>
To: Thorsten Frueauf <milano@zhadum.de>
Cc: gnats-bugs@gnats.netbsd.org, frueauf@netbsd.org
Subject: Re: port-i386/8248
Date: Mon, 5 Jul 2004 15:48:37 +0000

 On Monday 05 July 2004 09:28, Thorsten Frueauf wrote:
 > Hello,
 >
 > > This is believe to be fixed by com.c 1.228.
 >
 > Is it possible to get the fix isolated, so I can test it under
 > NetBSD 1.5.4_ALPHA (sys/dev/ic/com.c is 1.172), or is it to
 > complicated?
 > Unfortunatly I have no other system to test this currently, and I won't be
 > able to update the system to -current or 2.0 any time soon.


 Well, the driver hasn't changed much, so applying the diffs between 1.227 and 
 1.228 manually should be easy.

From: Havard Eidnes <he@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:  
Subject: pr/8248 CVS commit: [netbsd-2-0] src/sys/dev/ic
Date: Mon,  5 Jul 2004 21:57:46 +0000 (UTC)

 Module Name:	src
 Committed By:	he
 Date:		Mon Jul  5 21:57:45 UTC 2004

 Modified Files:
 	src/sys/dev/ic [netbsd-2-0]: com.c

 Log Message:
 Pull up revisions 1.228-1.230 (requested by mycroft in ticket #603):
   Incorporate 4 changes:
    o At high speed, set the FIFO trigger to a higher
      value to reduce interrupt load.  Fixes PR#15448.
    o Handle the case of IIR=RXRDY and LSR=!LSR_RCV_MASK
      differently, to avoid a hang with some chips.  Fixes
      PR#21184, and possibly PR#10974 and PR#8248.
    o Remove the extra wait at the end of com_common_putc(),
      after writing a character out, so that we get another
      TXRDY interrupt.  This prevents stalls when normal
      output and kernel output are mixed.  Fixes PR#4263.
    o Do not ``preload'' the TX FIFO; wait for a TXRDY
      interrupt to come in after enabling it.


 To generate a diff of this commit:
 cvs rdiff -r1.224.2.1 -r1.224.2.2 src/sys/dev/ic/com.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.


From: Thorsten Frueauf <milano@zhadum.de>
To: "Charles M. Hannum" <mycroft@netbsd.org>
Cc: gnats-bugs@gnats.netbsd.org, frueauf@netbsd.org
Subject: Re: port-i386/8248
Date: Wed, 7 Jul 2004 14:50:16 +0200

 Hello,

 > Well, the driver hasn't changed much, so applying the diffs between 1.227 and 
 > 1.228 manually should be easy.

 Hm, I did a "cvs diff -u -r 1.227 -r 1.228 com.c" and tried to apply it
 to version 1.172. The closest I was able to come up with is the diff
 at the bottom. Is this enough to fix the problem? Since I can't apply
 all changes I want to make sure I don't test nonsense.

 Greets
       Thorsten

 --- snip ---
 --- com.c-1.172	Thu May  4 12:56:47 2000
 +++ com.c	Wed Jul  7 14:41:32 2004
 @@ -1266,7 +1266,7 @@
  	if (ISSET(combits, MSR_RI | MSR_TERI))
  		SET(ttybits, TIOCM_RI);

 -	if (sc->sc_ier != 0)
 +	if (ISSET(sc->sc_ier, IER_ERXRDY | IER_ETXRDY | IER_ERLS | IER_EMSC))
  		SET(ttybits, TIOCM_LE);

  	return (ttybits);
 @@ -1414,7 +1414,7 @@
  	else if (ISSET(sc->sc_hwflags, COM_HW_FIFO))
  		sc->sc_fifo = FIFO_ENABLE |
  		    (t->c_ospeed <= 1200 ? FIFO_TRIGGER_1 :
 -		     t->c_ospeed <= 38400 ? FIFO_TRIGGER_8 : FIFO_TRIGGER_4);
 +		     t->c_ospeed <= 38400 ? FIFO_TRIGGER_8 : FIFO_TRIGGER_14);
  	else
  		sc->sc_fifo = 0;

 @@ -2006,11 +2006,8 @@
  				bus_space_write_1(iot, ioh, com_ier, sc->sc_ier);
  			}
  		} else {
 -			if ((iir & IIR_IMASK) == IIR_RXRDY) {
 -				bus_space_write_1(iot, ioh, com_ier, 0);
 -				delay(10);
 -				bus_space_write_1(iot, ioh, com_ier,sc->sc_ier);
 -				iir = IIR_NOPEND;
 +			if ((iir & (IIR_RXRDY|IIR_TXRDY)) == IIR_RXRDY) {
 +				(void) bus_space_read_1(iot, ioh, com_data);
  				continue;
  			}
  		}
 @@ -2185,11 +2182,6 @@

  	bus_space_write_1(iot, ioh, com_data, c);
  	COM_BARRIER(iot, ioh, BR | BW);
 -
 -	/* wait for this transmission to complete */
 -	timo = 1500000;
 -	while (!ISSET(bus_space_read_1(iot, ioh, com_lsr), LSR_TXRDY) && --timo)
 -		continue;

  	splx(s);
  }
 --- snip ---

From: "Charles M. Hannum" <mycroft@netbsd.org>
To: Thorsten Frueauf <milano@zhadum.de>
Cc: gnats-bugs@gnats.netbsd.org, frueauf@netbsd.org
Subject: Re: port-i386/8248
Date: Wed, 7 Jul 2004 14:51:36 +0000

 On Wednesday 07 July 2004 12:50, Thorsten Frueauf wrote:
 > Hello,
 >
 > > Well, the driver hasn't changed much, so applying the diffs between 1.227
 > > and 1.228 manually should be easy.
 >
 > Hm, I did a "cvs diff -u -r 1.227 -r 1.228 com.c" and tried to apply it
 > to version 1.172. The closest I was able to come up with is the diff
 > at the bottom. Is this enough to fix the problem? Since I can't apply
 > all changes I want to make sure I don't test nonsense.

 Ah, that's probably because an #ifdef was added to the preloading code since 
 1.6.  I think you can just comment out this whole block:

         /* Output the first chunk of the contiguous buffer. */
         if (!ISSET(sc->sc_hwflags, COM_HW_NO_TXPRELOAD)) {
                 int n;

                 n = sc->sc_tbc;
                 if (n > sc->sc_fifolen)
                         n = sc->sc_fifolen;
                 bus_space_write_multi_1(iot, ioh, com_data, sc->sc_tba, n);
                 sc->sc_tbc -= n;
                 sc->sc_tba += n;
         }

 That, and the diff you sent, should be all you need.
State-Changed-From-To: feedback->closed
State-Changed-By: frueauf@netbsd.org
State-Changed-When: Mon, 12 Jun 2006 18:23:02 +0000
State-Changed-Why:
Finally, after quite a long time, I was able to get the hardware combination
together and test the fix from Charles. It does indeed fix the problem
for this pr, so I go ahead and close it.

Greets
      Thorsten


>Unformatted:
          machine too
 reset from a Sun Ultra 10 at a console via com0 resets the NetBSD machine too

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.