Subject: Re: WDM_PIOMULTI fails on my drive (atari + MI wdc)
To: Leo Weppelman <leo@wau.mis.ah.nl>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 04/24/1998 10:48:09
On Apr 24, Leo Weppelman wrote
> 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.

And I'm pretty sure it works in this mode on PCs. I have a
wdc0 at isa0 port 0x1f0-0x1f7 irq 14
wd0 at wdc0 drive 0: <QUANTUM FIREBALL_TM2550A>
wd0: 2445MB, 4969 cyl, 16 head, 63 sec, 512 bytes/sec
wd0: using 16-sector 16-bit pio transfers, lba addressing

Here which works fine.  Maybe the problem comes from the CHS vs LBA mode ?

> 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.

Perhaps you could print the error code too (wdc->sc_error). This would
help understand why the mode was rejected. Maybe you could also print the
d_link->sc_params.wdp_maxmulti parameter in wdattach().
You patch make sense. Maybe it is possible to try some other multi
mode before falling back to single. The modes accepted by the drive are
in the capabilitie struct, I think, but I don't have my ATA spec here so
I can't develop this point now. I don't think it is worth doing a lot
of work on this now, as I am rewriting this driver. One of the motivation
for this work is better errors handling :)

--
Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
--