Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/dev/ic Pullup 1.15 [sommerfeld]:



details:   https://anonhg.NetBSD.org/src/rev/2762ad891739
branches:  netbsd-1-5
changeset: 490188:2762ad891739
user:      tv <tv%NetBSD.org@localhost>
date:      Fri Nov 10 16:40:07 2000 +0000

description:
Pullup 1.15 [sommerfeld]:
When receiving an rx interrupt on a closed or unconfigured port, read
the data out of the board anyway so it won't re-interrupt anyway.
Fix tested by C Kane <ckane%best.com@localhost>

diffstat:

 sys/dev/ic/cy.c |  38 +++++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 13 deletions(-)

diffs (83 lines):

diff -r 21a5b0347320 -r 2762ad891739 sys/dev/ic/cy.c
--- a/sys/dev/ic/cy.c   Fri Nov 10 03:35:41 2000 +0000
+++ b/sys/dev/ic/cy.c   Fri Nov 10 16:40:07 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cy.c,v 1.13 2000/05/29 12:05:42 tsubai Exp $   */
+/*     $NetBSD: cy.c,v 1.13.2.1 2000/11/10 16:40:07 tv Exp $   */
 
 /*
  * cy.c
@@ -1108,10 +1108,6 @@
                        cy->cy_rx_int_count++;
 #endif
 
-                       if (cy->cy_tty == NULL ||
-                           !ISSET(cy->cy_tty->t_state, TS_ISOPEN))
-                               goto end_rx_serv;
-
                        buf_p = cy->cy_ibuf_wr_ptr;
 
                        if (ISSET(serv_type, CD1400_RIVR_EXCEPTION)) {
@@ -1120,6 +1116,10 @@
                                recv_data = cd_read_reg(sc, cy->cy_chip,
                                    CD1400_RDSR);
 
+                               if (cy->cy_tty == NULL ||
+                                   !ISSET(cy->cy_tty->t_state, TS_ISOPEN))
+                                       goto end_rx_serv;
+
 #ifdef CY_DEBUG
                                printf("%s port %d recv exception, line_stat 0x%x, char 0x%x\n",
                                sc->sc_dev.dv_xname, cy->cy_port_num, line_stat, recv_data);
@@ -1142,6 +1142,16 @@
                        } else {/* no exception, received data OK */
                                n_chars = cd_read_reg(sc, cy->cy_chip,
                                    CD1400_RDCR);
+
+                               /* If no tty or not open, discard data */
+                               if (cy->cy_tty == NULL ||
+                                   !ISSET(cy->cy_tty->t_state, TS_ISOPEN)) {
+                                       while (n_chars--)
+                                               cd_read_reg(sc, cy->cy_chip, 
+                                                           CD1400_RDSR);
+                                       goto end_rx_serv;
+                               }
+
 #ifdef CY_DEBUG
                                printf("%s port %d receive ok %d chars\n",
                                    sc->sc_dev.dv_xname, cy->cy_port_num, n_chars);
@@ -1168,24 +1178,26 @@
 
                        /* RTS handshaking for incoming data */
                        if (ISSET(cy->cy_tty->t_cflag, CRTSCTS)) {
-                               int bf;
+                               int bf, msvr;
 
                                bf = buf_p - cy->cy_ibuf_rd_ptr;
                                if (bf < 0)
                                        bf += CY_IBUF_SIZE;
 
-                               if (bf > (CY_IBUF_SIZE / 2)) { /* turn RTS off */
-                                 if (cy->cy_clock == CY_CLOCK_60) {
-                                       cd_write_reg(sc, cy->cy_chip, CD1400_MSVR2, 0);
-                                 } else {
-                                       cd_write_reg(sc, cy->cy_chip, CD1400_MSVR1, 0);
-                                 }
+                               if (bf > (CY_IBUF_SIZE / 2)) { 
+                                       /* turn RTS off */
+                                       if (cy->cy_clock == CY_CLOCK_60) 
+                                               msvr = CD1400_MSVR2;
+                                       else
+                                               msvr = CD1400_MSVR1; 
+                                       cd_write_reg(sc, cy->cy_chip, msvr, 0);
                                }
                        }
 
        end_rx_serv:
                        /* terminate service context */
-                       cd_write_reg(sc, cy->cy_chip, CD1400_RIR, save_rir & 0x3f);
+                       cd_write_reg(sc, cy->cy_chip, CD1400_RIR, 
+                                    save_rir & 0x3f);
                        cd_write_reg(sc, cy->cy_chip, CD1400_CAR, save_car);
                        int_serviced = 1;
                } /* if (rx_service...) */



Home | Main Index | Thread Index | Old Index