Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Make the driver negotiate sync again and remove s...



details:   https://anonhg.NetBSD.org/src/rev/1a8db89373cb
branches:  trunk
changeset: 500893:1a8db89373cb
user:      eeh <eeh%NetBSD.org@localhost>
date:      Wed Dec 20 03:19:34 2000 +0000

description:
Make the driver negotiate sync again and remove some (hopefully) superfluous
DELAY()s.

diffstat:

 sys/dev/ic/ncr53c9x.c    |  30 +++++++++++++++++++++++-------
 sys/dev/ic/ncr53c9xvar.h |  10 +++++-----
 2 files changed, 28 insertions(+), 12 deletions(-)

diffs (96 lines):

diff -r 079951746846 -r 1a8db89373cb sys/dev/ic/ncr53c9x.c
--- a/sys/dev/ic/ncr53c9x.c     Wed Dec 20 02:16:33 2000 +0000
+++ b/sys/dev/ic/ncr53c9x.c     Wed Dec 20 03:19:34 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ncr53c9x.c,v 1.67 2000/12/19 14:08:17 pk Exp $ */
+/*     $NetBSD: ncr53c9x.c,v 1.68 2000/12/20 03:19:34 eeh Exp $        */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -1685,6 +1685,9 @@
                break;
        }
 
+       /* if we have more messages to send set ATN */
+       if (sc->sc_msgpriq) NCRCMD(sc, NCRCMD_SETATN);
+
        /* Ack last message byte */
        NCRCMD(sc, NCRCMD_MSGOK);
 
@@ -1719,7 +1722,7 @@
                if (sc->sc_prevphase != MESSAGE_OUT_PHASE) {
                new:
                        NCRCMD(sc, NCRCMD_FLUSH);
-                       DELAY(1);
+/*                     DELAY(1); */
                        sc->sc_msgoutq = 0;
                        sc->sc_omlen = 0;
                }
@@ -2047,7 +2050,7 @@
                        sc->sc_espintr,sc->sc_espstat,sc->sc_espstep));
                if (NCR_READ_REG(sc, NCR_FFLAG) & NCRFIFO_FF) {
                        NCRCMD(sc, NCRCMD_FLUSH);
-                       DELAY(1);
+/*                     DELAY(1); */
                }
                /*
                 * This command must (apparently) be issued within
@@ -2496,7 +2499,7 @@
                        ecb->cmd.cmd.opcode, ecb->clen));
                if (NCR_READ_REG(sc, NCR_FFLAG) & NCRFIFO_FF) {
                        NCRCMD(sc, NCRCMD_FLUSH);
-                       DELAY(1);
+/*                     DELAY(1);*/
                }
                if (ncr53c9x_dmaselect) {
                        size_t size;
@@ -2615,9 +2618,22 @@
         * The delay is a heuristic. It is 2 when at 20Mhz, 2 at 25Mhz and 1
         * at 40Mhz. This needs testing.
         */
-       DELAY(50/sc->sc_freq);
-       if (NCRDMA_ISINTR(sc))
-               goto again;
+       { 
+               struct timeval wait, cur;
+
+               microtime(&wait);
+               wait.tv_usec += 50/sc->sc_freq;
+               if (wait.tv_usec > 1000000) {
+                       wait.tv_sec++;
+                       wait.tv_usec -= 1000000;
+               }
+               do {
+                       if (NCRDMA_ISINTR(sc))
+                               goto again;
+                       microtime(&cur);
+               } while (cur.tv_sec <= wait.tv_sec && 
+                        cur.tv_usec <= wait.tv_usec);
+       }
        goto out;
 }
 
diff -r 079951746846 -r 1a8db89373cb sys/dev/ic/ncr53c9xvar.h
--- a/sys/dev/ic/ncr53c9xvar.h  Wed Dec 20 02:16:33 2000 +0000
+++ b/sys/dev/ic/ncr53c9xvar.h  Wed Dec 20 03:19:34 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ncr53c9xvar.h,v 1.28 2000/12/17 06:18:21 eeh Exp $     */
+/*     $NetBSD: ncr53c9xvar.h,v 1.29 2000/12/20 03:19:34 eeh Exp $     */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -363,10 +363,10 @@
 #define SEND_INIT_DET_ERR      0x0004
 #define SEND_REJECT            0x0008
 #define SEND_IDENTIFY                  0x0010
-#define SEND_TAG               0x0020
-#define SEND_ABORT             0x0040
-#define SEND_SDTR              0x0080
-#define SEND_WDTR              0x0100
+#define SEND_ABORT             0x0020
+#define SEND_SDTR              0x0040
+#define SEND_WDTR              0x0080
+#define SEND_TAG               0x0100
 
 /* SCSI Status codes */
 #define ST_MASK                        0x3e /* bit 0,6,7 is reserved */



Home | Main Index | Thread Index | Old Index