Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/scsipi If the SET_FEATURE for piomode is rejected, f...



details:   https://anonhg.NetBSD.org/src/rev/714aa578a7f3
branches:  trunk
changeset: 495742:714aa578a7f3
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Thu Aug 03 23:14:31 2000 +0000

description:
If the SET_FEATURE for piomode is rejected, fallback to mode 0 instead of
reporting an error.
This fixes the "piomode error (0x4)" problem with some ATAPI ZIP drives
reported on port-i386.

diffstat:

 sys/dev/scsipi/atapi_wdc.c |  26 ++++++++++++++++++--------
 1 files changed, 18 insertions(+), 8 deletions(-)

diffs (53 lines):

diff -r 4947c2a27edc -r 714aa578a7f3 sys/dev/scsipi/atapi_wdc.c
--- a/sys/dev/scsipi/atapi_wdc.c        Thu Aug 03 22:58:37 2000 +0000
+++ b/sys/dev/scsipi/atapi_wdc.c        Thu Aug 03 23:14:31 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atapi_wdc.c,v 1.37 2000/06/28 16:39:28 mrg Exp $       */
+/*     $NetBSD: atapi_wdc.c,v 1.38 2000/08/03 23:14:31 bouyer Exp $    */
 
 /*
  * Copyright (c) 1998 Manuel Bouyer.
@@ -833,13 +833,12 @@
            WDSD_IBM | (xfer->drive << 4));
        switch (drvp->state) {
        case PIOMODE:
-piomode:
                /* Don't try to set mode if controller can't be adjusted */
                if ((chp->wdc->cap & WDC_CAPABILITY_MODE) == 0)
                        goto ready;
                /* Also don't try if the drive didn't report its mode */
                if ((drvp->drive_flags & DRIVE_MODE) == 0)
-                       goto ready;;
+                       goto ready;
                wdccommand(chp, drvp->drive, SET_FEATURES, 0, 0, 0,
                    0x08 | drvp->PIO_mode, WDSF_SET_MODE);
                drvp->state = PIOMODE_WAIT;
@@ -851,12 +850,23 @@
                if (chp->wdc->cap & WDC_CAPABILITY_IRQACK)
                        chp->wdc->irqack(chp);
                if (chp->ch_status & WDCS_ERR) {
-                       if (drvp->PIO_mode < 3) {
-                               drvp->PIO_mode = 3;
-                               goto piomode;
-                       } else {
-                               goto error;
+                       if (chp->ch_error == WDCE_ABRT) {
+                               /*
+                                * some ATAPI drives rejects pio settings.
+                                * all we can do here is fall back to PIO 0
+                                */
+                               drvp->drive_flags &= ~DRIVE_MODE;
+                               drvp->drive_flags &= ~(DRIVE_DMA|DRIVE_UDMA);
+                               drvp->PIO_mode = 0;
+                               drvp->DMA_mode = 0;
+                               printf("%s:%d:%d: pio setting rejected, "
+                                   "falling back to PIO mode 0\n",
+                                   chp->wdc->sc_dev.dv_xname,
+                                   chp->channel, xfer->drive);
+                               chp->wdc->set_modes(chp);
+                               goto ready;
                        }
+                       goto error;
                }
        /* fall through */
 



Home | Main Index | Thread Index | Old Index