Subject: Some interrupt loss with a 16450 UART
To: None <port-i386@NetBSD.ORG>
From: Frederic Loyer <loyer@ensta.fr>
List: port-i386
Date: 11/08/1994 19:30:39
I've used PPP with a 486DX2/66, and a 16450 UART: that's work fine for
a while (with a lot of silo overflow), and then NetBSD stop sending
characters from the output queue until I kill pppd.

With a 16550 UART, I have not seen any problem.


The following patch work fine and "restart" the com driver when no
interruption is received and a character has just been sent.



========== BEGINNING OF PATCH ==========
*** src_compile09.10.94/sys/arch/i386/isa/com.c.ORIG    Mon Oct 24 21:36:20 1994
--- src_compile09.10.94/sys/arch/i386/isa/com.c Wed Oct 26 18:22:30 1994
***************
*** 91,96 ****
--- 91,97 ----
  int comintr __P((struct com_softc *));
  int comparam __P((struct tty *, struct termios *));
  void comstart __P((struct tty *));
+ void comtxtimeout __P((void *));
  
  struct cfdriver comcd = {
        NULL, "com", comprobe, comattach, DV_TTY, sizeof(struct com_softc)
***************
*** 658,663 ****
--- 659,667 ----
        if (tp->t_outq.c_cc == 0)
                goto out;
        tp->t_state |= TS_BUSY;
+ 
+       timeout(comtxtimeout, tp, 2);
+ 
        if ((inb(iobase + com_lsr) & LSR_TXRDY) == 0)
                goto out;
        if (sc->sc_hwflags & COM_HW_FIFO) {
***************
*** 672,677 ****
--- 676,702 ----
        splx(s);
  }
  
+ void
+ comtxtimeout(arg)
+       void *arg;
+ {
+       struct tty *tp = arg;
+ 
+ 
+       printf("com: Tx interruption lost\n");
+ 
+ 
+       tp->t_state &= ~TS_BUSY;
*** src_compile09.10.94/sys/arch/i386/isa/com.c.ORIG    Mon Oct 24 21:36:20 1994
--- src_compile09.10.94/sys/arch/i386/isa/com.c Wed Oct 26 18:22:30 1994
***************
*** 91,96 ****
--- 91,97 ----
  int comintr __P((struct com_softc *));
  int comparam __P((struct tty *, struct termios *));
  void comstart __P((struct tty *));
+ void comtxtimeout __P((void *));
  
  struct cfdriver comcd = {
        NULL, "com", comprobe, comattach, DV_TTY, sizeof(struct com_softc)
***************
*** 658,663 ****
--- 659,667 ----
        if (tp->t_outq.c_cc == 0)
                goto out;
        tp->t_state |= TS_BUSY;
+ 
+       timeout(comtxtimeout, tp, 2);
+ 
        if ((inb(iobase + com_lsr) & LSR_TXRDY) == 0)
                goto out;
========== END OF PATCH ==========

 ___  ________ _      |  Frederic Loyer
| __\| _|_   _/ \     |  Ecole Nationale Superieure
| __\____ | |/ _ \    |  de Techniques Avancees
|___\_____|___/ \_\   |  e-mail : loyer@ensta.fr