Subject: port-i386/2976: i386 serial port transmit failure in NetBSD 1.2
To: None <gnats-bugs@gnats.netbsd.org>
From: None <felix@simplex.nl>
List: netbsd-bugs
Date: 11/29/1996 17:56:21
>Number:         2976
>Category:       port-i386
>Synopsis:       comstart() called when TX fifo not empty.  Huh?
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 29 09:05:01 1996
>Last-Modified:
>Originator:     Felix A. Croes
>Organization:
	
>Release:        1.2
>Environment:
	
System: NetBSD dworkin 1.2 NetBSD 1.2 (DWORKIN) #6: Fri Nov 29 17:37:55 MET 1996 felix@dworkin:/usr/src/sys/arch/i386/compile/DWORKIN i386


>Description:
	
	File: /sys/dev/isa/com.c

	comstart() is called in situations where the LSR indicates that the
	transmit fifo is not empty, resulting in data loss.

	As far as I can see this also happens in NetBSD-current.
>How-To-Repeat:
	
	Sending a file through my 28k8 modem with ftp produces the error
	every two or three seconds.
>Fix:
	
	Quick fix: let comstart() check the LSR itself.  It would be better
	to make sure that comstart is only called when it is known that the
	TX fifo is empty, though.

*** com.c.old	Sun Jun  2 11:08:00 1996
--- com.c	Fri Nov 29 17:37:18 1996
***************
*** 1001,1007 ****
  	int s;
  
  	s = spltty();
! 	if (ISSET(tp->t_state, TS_BUSY))
  		goto out;
  	if (ISSET(tp->t_state, TS_TIMEOUT | TS_TTSTOP) ||
  	    sc->sc_halt > 0)
--- 1001,1008 ----
  	int s;
  
  	s = spltty();
! 	if (ISSET(tp->t_state, TS_BUSY) ||
! 	    !ISSET(bus_io_read_1(bc, ioh, com_lsr), LSR_TXRDY))
  		goto out;
  	if (ISSET(tp->t_state, TS_TIMEOUT | TS_TTSTOP) ||
  	    sc->sc_halt > 0)
>Audit-Trail:
>Unformatted: