Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Introduce COM_HW_BROKEN_ETXRDY bit in sc_hwflags;...



details:   https://anonhg.NetBSD.org/src/rev/bfba51ed4e79
branches:  trunk
changeset: 981882:bfba51ed4e79
user:      rin <rin%NetBSD.org@localhost>
date:      Thu Mar 25 05:34:49 2021 +0000

description:
Introduce COM_HW_BROKEN_ETXRDY bit in sc_hwflags; push TX queue if
possible in comintr() even if IIR_NOPEND is asserted.

Combined with sc_poll_ticks, this flag works around HW bug, by which
ETXRDY interrupts are (sometimes) lost.

diffstat:

 sys/dev/ic/com.c    |  18 +++++++++++-------
 sys/dev/ic/comvar.h |   4 ++--
 2 files changed, 13 insertions(+), 9 deletions(-)

diffs (76 lines):

diff -r 6048865dbb34 -r bfba51ed4e79 sys/dev/ic/com.c
--- a/sys/dev/ic/com.c  Thu Mar 25 05:33:59 2021 +0000
+++ b/sys/dev/ic/com.c  Thu Mar 25 05:34:49 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.362 2021/03/25 05:33:59 rin Exp $ */
+/* $NetBSD: com.c,v 1.363 2021/03/25 05:34:49 rin Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.362 2021/03/25 05:33:59 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.363 2021/03/25 05:34:49 rin Exp $");
 
 #include "opt_com.h"
 #include "opt_ddb.h"
@@ -2162,15 +2162,17 @@
                }
        }
 
+       end = sc->sc_ebuf;
+       put = sc->sc_rbput;
+       cc = sc->sc_rbavail;
+
        if (ISSET(iir, IIR_NOPEND)) {
+               if (ISSET(sc->sc_hwflags, COM_HW_BROKEN_ETXRDY))
+                       goto do_tx;
                mutex_spin_exit(&sc->sc_lock);
                return (0);
        }
 
-       end = sc->sc_ebuf;
-       put = sc->sc_rbput;
-       cc = sc->sc_rbavail;
-
 again: do {
                u_char  msr, delta;
 
@@ -2306,6 +2308,7 @@
             */
            (iir & IIR_IMASK) != IIR_TXRDY);
 
+do_tx:
        /*
         * Read LSR again, since there may be an interrupt between
         * the last LSR read and IIR read above.
@@ -2358,7 +2361,8 @@
        mutex_spin_exit(&sc->sc_lock);
 
        /* Wake up the poller. */
-       softint_schedule(sc->sc_si);
+       if ((sc->sc_rx_ready | sc->sc_st_check | sc->sc_tx_done) != 0)
+               softint_schedule(sc->sc_si);
 
 #ifdef RND_COM
        rnd_add_uint32(&sc->rnd_source, iir | lsr);
diff -r 6048865dbb34 -r bfba51ed4e79 sys/dev/ic/comvar.h
--- a/sys/dev/ic/comvar.h       Thu Mar 25 05:33:59 2021 +0000
+++ b/sys/dev/ic/comvar.h       Thu Mar 25 05:34:49 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: comvar.h,v 1.93 2021/03/25 05:33:59 rin Exp $  */
+/*     $NetBSD: comvar.h,v 1.94 2021/03/25 05:34:49 rin Exp $  */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -61,7 +61,7 @@
 /* Hardware flag masks */
 #define        COM_HW_NOIEN    0x01
 #define        COM_HW_FIFO     0x02
-               /*      0x04    free for use */
+#define        COM_HW_BROKEN_ETXRDY    0x04
 #define        COM_HW_FLOW     0x08
 #define        COM_HW_DEV_OK   0x20
 #define        COM_HW_CONSOLE  0x40



Home | Main Index | Thread Index | Old Index