Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Mods to com_common_putc(). When doing kprintf() o...



details:   https://anonhg.NetBSD.org/src/rev/85af81cadcdd
branches:  trunk
changeset: 467791:85af81cadcdd
user:      ross <ross%NetBSD.org@localhost>
date:      Mon Mar 29 10:01:39 1999 +0000

description:
Mods to com_common_putc(). When doing kprintf() or kgdb output:
1. don't clear the irq unless it was clear before transmitting
2. also do various bus_space_barrier() ops
Stops console from freezing when kprintf interrupts tty driver output.

diffstat:

 sys/dev/ic/com.c |  27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

diffs (60 lines):

diff -r 995af662ee23 -r 85af81cadcdd sys/dev/ic/com.c
--- a/sys/dev/ic/com.c  Mon Mar 29 09:27:29 1999 +0000
+++ b/sys/dev/ic/com.c  Mon Mar 29 10:01:39 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: com.c,v 1.155 1999/02/28 17:10:52 explorer Exp $       */
+/*     $NetBSD: com.c,v 1.156 1999/03/29 10:01:39 ross Exp $   */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -223,6 +223,10 @@
 #define        COM_ISALIVE(sc) ((sc)->enabled != 0 && \
                         ISSET((sc)->sc_dev.dv_flags, DVF_ACTIVE))
 
+#define        BR      BUS_SPACE_BARRIER_READ
+#define        BW      BUS_SPACE_BARRIER_WRITE
+#define COM_BARRIER(t, h, f) bus_space_barrier((t), (h), 0, COM_NPORTS, (f))
+
 int
 comspeed(speed, frequency)
        long speed, frequency;
@@ -2170,25 +2174,32 @@
        int c;
 {
        int s = splserial();
+       int clearirq;
        u_char stat;
        int timo;
 
        /* wait for any pending transmission to finish */
-       timo = 50000;
+       timo = 500;
        while (!ISSET(stat = bus_space_read_1(iot, ioh, com_lsr), LSR_TXRDY)
            && --timo)
-               ;
+               delay(100);
 
+       clearirq = ISSET(bus_space_read_1(iot, ioh, com_iir), IIR_NOPEND);
+       COM_BARRIER(iot, ioh, BR | BW);
        bus_space_write_1(iot, ioh, com_data, c);
+       COM_BARRIER(iot, ioh, BR | BW);
        /* wait for this transmission to complete */
-       timo = 1500000;
+       timo = 15000;
        while (!ISSET(stat = bus_space_read_1(iot, ioh, com_lsr), LSR_TXRDY)
            && --timo)
-               ;
+               delay(100);
 
-       /* clear any interrupts generated by this transmission */
-       stat = bus_space_read_1(iot, ioh, com_iir);
-       splx(s);
+       if(clearirq != 0) {
+               /* clear any interrupts generated by this transmission */
+               (void)bus_space_read_1(iot, ioh, com_iir);
+               COM_BARRIER(iot, ioh, BR | BW);
+               splx(s);
+       }
 }
 
 /*



Home | Main Index | Thread Index | Old Index