*BSD News Article 5600


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!manuel!munnari.oz.au!spool.mu.edu!uunet!iWarp.intel.com|ichips!intelhf!agora!rgrimes
From: rgrimes@agora.rain.com (Rodney Grimes)
Subject: SILO overflow fix for 16550 UARTS
Message-ID: <Bv4FrD.4ED@agora.rain.com>
Keywords: 386BSD SILO FIFO UARTS 16550
Organization: Open Communications Forum
Date: Fri, 25 Sep 1992 06:37:59 GMT
Lines: 84


Well after having all the SILO over flow problems when running things
faster than 9600 baud I decided to go buy some 16550 UARTS.  I installed
them and much to my horror I still had SILO overflows, all be it not as
often, but still more than I expected.

I went locking at the com.c driver and found that the FIFO trigger level
was set to 14, this only gives you 2 character times before the fifo
fills up.  So then I went and looked at some other 16550 drivers clarkson
packet drivers, and some other MessDOS stuff.  They all used the fifo
trigger at 4.

I made the changes to com.c a wham - I not get 57,600 without overflows!!

This fixes it!!  But I am not totally happy with the way that the FIFO 
trigger level is a static value at compile time.  It should be dependent
on the speed of the machine and the baud rate the line is at.  I am working
on a fix for this.

I tried triggers of 8 and it works okay upto 19200, but still get a few
overflows at 38400.  I tried 0 at 110k and my machine reboots, it appears
to be another bug in com.c.  I well have a looksee.

Below is a patch to the com.c as it appears on the distribution.  If you
have CGD's com driver you well have to apply this by hand, but it also
works for his code (Search for FIFO_TRIGGER_14 and replace it with 
FIFO_TRIGGER_4).

*** /usr/src/sys.386bsd/i386/isa/com.c-dist01	Sun Jul  5 13:55:12 1992
--- /usr/src/sys.386bsd/i386/isa/com.c	Thu Sep 24 23:35:06 1992
***************
*** 139,145 ****
  	comsoftCAR |= 1 << unit;	/* XXX */
  
  	/* look for a NS 16550AF UART with FIFOs */
! 	outb(port+com_fifo, FIFO_ENABLE|FIFO_RCV_RST|FIFO_XMT_RST|FIFO_TRIGGER_14);
  	DELAY(100);
  	if ((inb(port+com_iir) & IIR_FIFO_MASK) == IIR_FIFO_MASK) {
  		com_hasfifo |= 1 << unit;
--- 139,145 ----
  	comsoftCAR |= 1 << unit;	/* XXX */
  
  	/* look for a NS 16550AF UART with FIFOs */
! 	outb(port+com_fifo, FIFO_ENABLE|FIFO_RCV_RST|FIFO_XMT_RST|FIFO_TRIGGER_4);
  	DELAY(100);
  	if ((inb(port+com_iir) & IIR_FIFO_MASK) == IIR_FIFO_MASK) {
  		com_hasfifo |= 1 << unit;
***************
*** 503,509 ****
  	outb(com+com_cfcr, cfcr);
  
  	if (com_hasfifo & (1 << unit))
! 		outb(com+com_fifo, FIFO_ENABLE | FIFO_TRIGGER_14);
  
  	return(0);
  }
--- 503,509 ----
  	outb(com+com_cfcr, cfcr);
  
  	if (com_hasfifo & (1 << unit))
! 		outb(com+com_fifo, FIFO_ENABLE | FIFO_TRIGGER_4);
  
  	return(0);
  }
***************
*** 653,659 ****
  	outb(com+com_ier, rate >> 8);
  	outb(com+com_cfcr, CFCR_8BITS);
  	outb(com+com_ier, IER_ERXRDY | IER_ETXRDY);
! 	outb(com+com_fifo, FIFO_ENABLE|FIFO_RCV_RST|FIFO_XMT_RST|FIFO_TRIGGER_14);
  	stat = inb(com+com_iir);
  	splx(s);
  }
--- 653,659 ----
  	outb(com+com_ier, rate >> 8);
  	outb(com+com_cfcr, CFCR_8BITS);
  	outb(com+com_ier, IER_ERXRDY | IER_ETXRDY);
! 	outb(com+com_fifo, FIFO_ENABLE|FIFO_RCV_RST|FIFO_XMT_RST|FIFO_TRIGGER_4);
  	stat = inb(com+com_iir);
  	splx(s);
  }
-- 
Rod Grimes						rgrimes@agora.rain.com