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 Pull up revision 1.38 (requested by bouy...



details:   https://anonhg.NetBSD.org/src/rev/ecf08769f60f
branches:  netbsd-1-4
changeset: 470850:ecf08769f60f
user:      he <he%NetBSD.org@localhost>
date:      Mon Aug 14 14:11:36 2000 +0000

description:
Pull up revision 1.38 (requested by bouyer):
  If SET_FEATURE for piomode is rejected, fall back to mode 0
  instead of giving up.  Works around "piomode error (0x4)" problem
  with some ATAPI ZIP drives.

diffstat:

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

diffs (53 lines):

diff -r b4a658709ea7 -r ecf08769f60f sys/dev/scsipi/atapi_wdc.c
--- a/sys/dev/scsipi/atapi_wdc.c        Mon Aug 14 14:07:56 2000 +0000
+++ b/sys/dev/scsipi/atapi_wdc.c        Mon Aug 14 14:11:36 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atapi_wdc.c,v 1.20.2.6 2000/07/07 17:33:51 he Exp $    */
+/*     $NetBSD: atapi_wdc.c,v 1.20.2.7 2000/08/14 14:11:36 he Exp $    */
 
 /*
  * Copyright (c) 1998 Manuel Bouyer.
@@ -724,13 +724,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;
@@ -742,12 +741,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