Re: Worrisome IDE PIO transfers...

From: Bartlomiej Zolnierkiewicz
Date: Sun Feb 29 2004 - 09:50:07 EST


On Sunday 29 of February 2004 09:50, Geert Uytterhoeven wrote:
> On Sun, 29 Feb 2004, Bartlomiej Zolnierkiewicz wrote:
> > [ Geert added to cc: ]
> >
> > On Sunday 29 of February 2004 00:24, Jeff Garzik wrote:
> > > Looking at the function that is used to transfer data when in PIO
> > > mode...
> > >
> > > void taskfile_output_data (ide_drive_t *drive, void *buffer, u32
> > > wcount) {
> > > if (drive->bswap) {
> > > ata_bswap_data(buffer, wcount);
> > > HWIF(drive)->ata_output_data(drive, buffer, wcount);
> > > ata_bswap_data(buffer, wcount);
> > > } else {
> > > HWIF(drive)->ata_output_data(drive, buffer, wcount);
> > > }
> > > }
> > >
> > > Swapping the data in-place is very, very wrong... you don't want to
> > > be touching the data that userspace might have mmap'd ...
> > > Additionally, byteswapping back and forth for each PIO sector chews
> > > unnecessary CPU.
> >
> > This is used for accessing "normal" disks on beasts with byte-swapped IDE
> > bus (Atari/Q40/TiVo) and "byteswapped" disks on normal machines.
> >
> > [ Hm. actually I don't see how it can be used for accessing "normal"
> > disks, as data is byteswapped by IDE bus and then swapped back by IDE
> > driver. ]
>
> Why not? The only difference between `normal' and `byteswapped' disks is
> that the bytes in a 16-bit word are swapped (sic :-), so you can convert in
> both directions by swapping the bytes. Normal disks have been used on Atari
> before, so it should (still) work.

Oh yes, IDE driver fixes byteorder on Atari/Q40 only when "bswap" is used.

> BTW, the generic tree misses this patch, which was deemed inappropriate
> before, but is needed to make sure the drive identification block is
> correct on those machines:

Thanks. I can't see a smarter way to fix this now. :/

Bartlomiej

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/