Subject: Re: CF/IDE performance problem...
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Matthew Orgass <darkstar@city-net.com>
List: tech-kern
Date: 11/22/2005 23:55:37
On 2005-11-21 bouyer@antioche.eu.org wrote:
> On Mon, Nov 21, 2005 at 01:25:30AM -0500, Matthew Orgass wrote:

> >   0x848a in word 0 or bit 2 of word 83 apparently identifies the CFA
> > feature set (according to a draft ATA/ATAPI spec).  I guess this could at
> > least be used to print a warning message if capabilites are not reported.
>
> Old drives won't report anything here either, so it's not an error.

  Maybe something like this: in atactl identify, if word 0 is 0x848a and
word 53 is 1 then add "Compact Flash (may have hidden modes and features)"
under, say, device type.  Something to indicate that a significant
performance increase may be possible with flags that should not be turned
on by default.  Hopefully such cards will not be made for long.  OpenBSD
has code to use the oldpiotiming field to identify PIO 1 & 2, which might
help some without additional action (but not on viaide, which sets PIO
modes 2 and 1 to 0 for reasons that are not commented).

  I downloaded the current CF specification and did some more tests, and
Window ME may not be doing anything special.  NetBSD's dos file system
implementation doesn't seem to be doing any kind of write buffering (I had
noticed that drive access stopped when dd stopped, but the implications of
this didn't sink in right away).  Testing with ffs (time sh -c "dd...;
umount /mnt") gives 1.9MB/s with PIO 0 (slightly above what ME got) and
2.5MB/s with PIO 4.

  The current CF specification requires mode reporting, and also requires
the device to not report DMA capability if the DMARQ line is not
connected.

> > The draft also mentions that PIO mode 1 and 2 can be identified in word
> > 51, and this drive seems to indicate PIO mode 2 there.  However, I tried a
> > SET FEATURES with pio mode 2, which failed, and with 0 (default mode),
> > which also failed.
>
> So it's doesn't support SET FEATURES at all. It's really not standard.

  I did a google search for "compact flash" "set feature" and found
several CF datasheets claiming PIO mode 4 support but not listing mode
settings on a list of all supported set features commands.  Some claim to
report PIO mode 4 in word 64, some in word 51, and some not at all.

  Maybe the right thing here would be to ignore a set mode failure in
wdc_ata_bio_start for compact flash cards (word 0 of identify == 0x848a).
This would allow the force mode flags to work (a separate flag to avoid
it would be fine too, but it seems unnecessary to me).

Matthew Orgass
darkstar@city-net.com