Source-Changes-HG archive

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

[src/netbsd-1-4]: src/sys/dev/scsipi Apply patch, pulling up 1.23->1.24 + "re...



details:   https://anonhg.NetBSD.org/src/rev/04b453c7bab8
branches:  netbsd-1-4
changeset: 469289:04b453c7bab8
user:      he <he%NetBSD.org@localhost>
date:      Wed Aug 25 11:20:01 1999 +0000

description:
Apply patch, pulling up 1.23->1.24 + "return" part of 1.24->1.25:
  Add some debug printfs, change timeout handling to be more efficient
  and less error-prone, and fix the "lockup after lost interrupt"
  problem some users have been reporting.  (bouyer)

diffstat:

 sys/dev/scsipi/atapi_wdc.c |  23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diffs (99 lines):

diff -r c78c40aa754f -r 04b453c7bab8 sys/dev/scsipi/atapi_wdc.c
--- a/sys/dev/scsipi/atapi_wdc.c        Wed Aug 25 11:18:38 1999 +0000
+++ b/sys/dev/scsipi/atapi_wdc.c        Wed Aug 25 11:20:01 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atapi_wdc.c,v 1.20.2.2 1999/05/05 22:39:04 perry Exp $ */
+/*     $NetBSD: atapi_wdc.c,v 1.20.2.3 1999/08/25 11:20:01 he Exp $    */
 
 /*
  * Copyright (c) 1998 Manuel Bouyer.
@@ -238,6 +238,9 @@
                xfer->c_flags |= C_DMA;
        else
                xfer->c_flags &= ~C_DMA;
+       /* start timeout machinery */
+       if ((sc_xfer->flags & SCSI_POLL) == 0)
+               timeout(wdctimeout, chp, sc_xfer->timeout * hz / 1000);
        /* Do control operations specially. */
        if (drvp->state < READY) {
                if (drvp->state != PIOMODE) {
@@ -285,7 +288,6 @@
                wdc_atapi_intr(chp, xfer, 0);
        } else {
                chp->ch_flags |= WDCF_IRQ_WAIT;
-               timeout(wdctimeout, chp, hz);
        }
        if (sc_xfer->flags & SCSI_POLL) {
                while ((sc_xfer->flags & ITSDONE) == 0) {
@@ -322,6 +324,16 @@
                    drvp->state);
                panic("wdc_atapi_intr: bad state\n");
        }
+       /*
+        * If we missed an interrupt in a PIO transfer, reset and restart.
+        * Don't try to continue transfer, we may have missed cycles.
+        */
+       if ((xfer->c_flags & (C_TIMEOU | C_DMA)) == C_TIMEOU) {
+               sc_xfer->error = XS_TIMEOUT;
+               wdc_atapi_reset(chp, xfer);
+               return 1;
+       } 
+
        /* Ack interrupt done in wait_for_unbusy */
        bus_space_write_1(chp->cmd_iot, chp->cmd_ioh, wd_sdh,
            WDSD_IBM | (xfer->drive << 4));
@@ -425,7 +437,6 @@
 
                if ((sc_xfer->flags & SCSI_POLL) == 0) {
                        chp->ch_flags |= WDCF_IRQ_WAIT;
-                       timeout(wdctimeout, chp, sc_xfer->timeout * hz / 1000);
                }
                return 1;
 
@@ -503,7 +514,6 @@
                }
                if ((sc_xfer->flags & SCSI_POLL) == 0) {
                        chp->ch_flags |= WDCF_IRQ_WAIT;
-                       timeout(wdctimeout, chp, sc_xfer->timeout * hz / 1000);
                }
                return 1;
 
@@ -580,7 +590,6 @@
                }
                if ((sc_xfer->flags & SCSI_POLL) == 0) {
                        chp->ch_flags |= WDCF_IRQ_WAIT;
-                       timeout(wdctimeout, chp, sc_xfer->timeout * hz / 1000);
                }
                return 1;
 
@@ -636,6 +645,7 @@
                                            sizeof(sc_xfer->sense.scsi_sense);
                                        xfer->c_skip = 0;
                                        xfer->c_flags |= C_SENSE;
+                                       untimeout(wdctimeout, chp);
                                        wdc_atapi_start(chp, xfer);
                                        return 1;
                                }
@@ -746,13 +756,13 @@
        ready:
                drvp->state = READY;
                xfer->c_intr = wdc_atapi_intr;
+               untimeout(wdctimeout, chp);
                wdc_atapi_start(chp, xfer);
                return 1;
        }
        if ((sc_xfer->flags & SCSI_POLL) == 0) {
                chp->ch_flags |= WDCF_IRQ_WAIT;
                xfer->c_intr = wdc_atapi_ctrl;
-               timeout(wdctimeout, chp, sc_xfer->timeout * hz / 1000);
        } else {
                goto again;
        }
@@ -790,6 +800,7 @@
        WDCDEBUG_PRINT(("wdc_atapi_done %s:%d:%d: flags 0x%x\n",
            chp->wdc->sc_dev.dv_xname, chp->channel, xfer->drive,
            (u_int)xfer->c_flags), DEBUG_XFERS);
+       untimeout(wdctimeout, chp);
        /* remove this command from xfer queue */
        wdc_free_xfer(chp, xfer);
        sc_xfer->flags |= ITSDONE;



Home | Main Index | Thread Index | Old Index