Subject: piomode error (0x4) & ATAPI ZIP
To: None <port-i386@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: port-i386
Date: 07/29/2000 19:29:14
--y0ulUmNC+osPPQO6
Content-Type: text/plain; charset=us-ascii
Hi,
those of you experiencing "piomode error (0x4)" messages with ATAPI ZIP drives,
could you test the attached patch (against -current; should work with
1.5 with some fuzz too) ?
It should solve the problem but I can't test it myself, all my ZIP drives
seems sane :)
--
Manuel Bouyer <bouyer@antioche.eu.org>
--
--y0ulUmNC+osPPQO6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff
--- atapi_wdc.c.orig Sat Jul 29 19:21:02 2000
+++ atapi_wdc.c Sat Jul 29 19:20:50 2000
@@ -835,13 +835,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;
@@ -853,12 +852,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 */
--y0ulUmNC+osPPQO6--