From gpalmer@ORION.WEBSPAN.NET  Tue Dec 17 17:20:13 1996
Received: from mail.webspan.net (mail.webspan.net [206.154.70.7])
          by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id RAA06160
          for <freebsd-gnats-submit@freebsd.org>; Tue, 17 Dec 1996 17:20:12 -0800 (PST)
Received: from orion.webspan.net (orion.webspan.net [206.154.70.5]) 
          by mail.webspan.net (8.7.5/8.7.3) with ESMTP id UAA18240
          for <freebsd-gnats-submit@freebsd.org>; Tue, 17 Dec 1996 20:19:27 -0500 (EST)
Received: from orion.webspan.net (localhost [127.0.0.1]) 
          by orion.webspan.net (8.8.3/8.7.3) with ESMTP id UAA29471
          for <freebsd-gnats-submit@freebsd.org>; Tue, 17 Dec 1996 20:19:27 -0500 (EST)
Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.18]) 
          by mail.webspan.net (8.7.5/8.7.3) with ESMTP id FAA24941
          for <gpalmer@webspan.net>; Tue, 17 Dec 1996 05:35:26 -0500 (EST)
Received: from nike.efn.org (resnet.uoregon.edu [128.223.170.28])
          by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id CAA13937
          for <FreeBSD-gnats@freefall.FreeBSD.org>; Tue, 17 Dec 1996 02:35:19 -0800 (PST)
Received: (from jmg@localhost) by nike.efn.org (8.8.3/8.8.3) id CAA10283; Tue, 17 Dec 1996 02:35:18 -0800 (PST)
Message-Id: <199612171035.CAA10283@nike.efn.org>
Date: Tue, 17 Dec 1996 02:35:18 -0800 (PST)
From: John-Mark Gurney <jmg@nike.efn.org>
Reply-To: gurney_j@efn.org
To: FreeBSD-gnats@freefall.freebsd.org
Subject: some interrupts take too long and cause a sio buffer overflow (i.e. the bt946)
X-Send-Pr-Version: 3.2

>Number:         2239
>Category:       i386
>Synopsis:       some interrupts take too long (i.e. BT946) and can cause a sio buffer overflow
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    jmg
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 17 17:30:01 PST 1996
>Closed-Date:    Mon Jun 12 14:34:26 PDT 2000
>Last-Modified:  Mon Jun 12 14:36:14 PDT 2000
>Originator:     John-Mark Gurney
>Release:        FreeBSD 2.2-960801-SNAP i386
>Organization:
Cu Networking
>Environment:

sources checked out as of tonight (i.e. diff'd against current)
my machine is a amd5x86/133 w/ 48megs ram, a BT946 scsi card, and a couple 16550s...
	

>Description:

the bt946 if you hit a bunch of transfers it will hog the bus longer than the time it takes to recieve 2 chars at 115200...  which will than cause an overflow...  easy fix is to increase the buffer from 2 to 8 chars...

this patch adds an option SIOBIGBUFF, which will increase the 16550's buffer from 2 to 8 chars...

I made this a system wide option as I assume that you will be running 115200 on most if not all your 16550 ports...  if you want I could modify this to be a flags option for a per port basis...
	

>How-To-Repeat:

do a big transfer with data coming in at 115200 on a sio port...  
	

>Fix:
	
apply this patch and recompile your kernel with options SIOBIGBUF:
Index: isa/sio.c
===================================================================
RCS file: /usr/cvs/src/sys/i386/isa/sio.c,v
retrieving revision 1.154
diff -c -r1.154 sio.c
*** sio.c	1996/11/30 15:52:56	1.154
--- sio.c	1996/12/17 10:29:10
***************
*** 862,867 ****
--- 862,871 ----
  		} else {
  			com->hasfifo = TRUE;
  			com->tx_fifo_size = 16;
+ #ifdef SIOBIGBUF
+ 			outb(iobase + com_fifo, FIFO_ENABLE | FIFO_RX_MEDH);
+ 			printf(" fifo set to 8 chars");
+ #endif
  #ifdef COM_ESP
  			for (espp = likely_esp_ports; *espp != 0; espp++)
  				if (espattach(isdp, com, *espp)) {
Index: conf/LINT
===================================================================
RCS file: /usr/cvs/src/sys/i386/conf/LINT,v
retrieving revision 1.297
diff -c -r1.297 LINT
*** LINT	1996/11/29 07:08:48	1.297
--- LINT	1996/12/17 10:33:26
***************
*** 673,678 ****
--- 673,679 ----
  options		COM_ESP			#code for Hayes ESP
  options		COM_MULTIPORT		#code for some cards with shared IRQs
  options		DSI_SOFT_MODEM		#code for DSI Softmodems
+ options		SIOBIGBUF		#increase default buf from 2 to 8 chars on 16550s
  options		BREAK_TO_DEBUGGER	#a BREAK on a comconsole goes to 
  					#DDB, if available.
  
Index: conf/options.i386
===================================================================
RCS file: /usr/cvs/src/sys/i386/conf/options.i386,v
retrieving revision 1.31
diff -c -r1.31 options.i386
*** options.i386	1996/11/16 01:09:20	1.31
--- options.i386	1996/12/17 10:18:32
***************
*** 21,26 ****
--- 21,27 ----
  COM_ESP			opt_sio.h
  COM_MULTIPORT		opt_sio.h
  DSI_SOFT_MODEM		opt_sio.h
+ SIOBIGBUF		opt_sio.h
  I586_CTR_GUPROF		opt_i586_guprof.h
  I586_PMC_GUPROF		opt_i586_guprof.h
  FAT_CURSOR		opt_pcvt.h

	

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->jmg 
Responsible-Changed-By: jmg 
Responsible-Changed-When: Sun Apr 12 15:25:48 PDT 1998 
Responsible-Changed-Why:  
now that I'm a committer, I'll take care of this... 
State-Changed-From-To: open->closed 
State-Changed-By: jmg 
State-Changed-When: Mon Jun 12 14:34:26 PDT 2000 
State-Changed-Why:  
I have looked at sio and there needs to be some redesign of the multiport 
support, but I'm not sure when I'm going to get around to fixing the 
various problems... 

http://www.freebsd.org/cgi/query-pr.cgi?pr=2239 
>Unformatted:
John-Mark Gurney
