Subject: WDM_PIOMULTI fails on my drive (atari + MI wdc)
To: None <tech-kern@NetBSD.ORG>
From: Leo Weppelman <leo@wau.mis.ah.nl>
List: tech-kern
Date: 04/24/1998 09:53:35
On the atari, I use the MI wdc driver. In combination with my Quantum
Fireball, I get a failure in multi-sector mode.

>From my dmesg:

  wd0 at wdc0 drive 0: <QUANTUM FIREBALL1080A>
  wd0: 1039MB, 2112 cyl, 16 head, 63 sec, 512 bytes/sec
  wd0: using 16-sector 16-bit pio transfers, chs addressing
  wd0: wdccontrol: setmulti failed (2) - fallback to single sector mode
  root on wd0a dumps on wd0b

As can be seen, the Fireball announces that it supports multi-sector mode.
This fails on the first read attemp though. To handle this error (this happens
to be my boot disk), I use the following patch:

diff -ru /usr/src/sys.org/dev/ic/wdc.c /usr/src/sys.leo/dev/ic/wdc.c
--- /usr/src/sys.org/dev/ic/wdc.c       Thu Apr 16 08:14:51 1998
+++ /usr/src/sys.leo/dev/ic/wdc.c     Thu Apr 16 13:10:22 1998
@@ -957,7 +957,10 @@
        case MULTIMODE_WAIT:
                if (wdc->sc_status & WDCS_ERR) {
                        wderror(d_link, NULL,
-                           "wdccontrol: setmulti failed (2)");
+                           "wdccontrol: setmulti failed (2)"
+                           " - fallback to single sector mode");
+                       d_link->sc_mode = WDM_PIOSINGLE;
+                       d_link->sc_multiple = 1;
                        goto bad;
                }
                /* fall through */

The question is: Does this patch make sense, or are there better ways of
handling this.

Leo.