Geert,
I've always taken the comment "Atari has a byte-swapped IDE
interface" in
drivers/ide/falconide.c to mean that the bus interface bas been
implemented
swapped. What it _does_ appear to signify is that filesystem data to
and
from disk need to be handled differently from CD, floppy or tape
data. The
latter are explicitly swapped to/from LE to CPU byte order. The
former seems
to be written to disk without swapping. See
falconide_[in|out]put_data().
The only way this can be explained is by the LE IDE interface
connected to
the BE data bus 1:1 so data from the IDE interface appears in LE byte
order.
That's the correct way to implement LE devices on BE bus machines.
The convention for storing data on the IDE disks then seems to have
done
away with the need for conversion from 16 bit LE order, so everything
on
disk (partition table, filesystem metadata, file data) ends up in
opposite
byte order.
Actually the Atari one is byte-swapped, i.e. wired incorrectly.
The proper way to wire up LE to BE is to make sure raw data is
transfered
correctly, and that you have to use the le*_to_cpu() accessors to
access
multi-byte quantities. That way e.g. strings in files on the disk are
accessed
fine, and raw CD data doesn't need byte-swapping.
Due to the wrong wiring, CD data needs to be swapped, as the CD data
comes from a foreign system.
Hard drive data typically doesn't need swapping, as it is read AND
written
by an Atari system.
Except if you want to share data with other endianess architectures.
(Probably) the reason why Atari wired it up differently is for the IDE
drive
identification: this is transfered as one 512-byte block, containing
various
multi-byte variables, but also strings.
Thanks for setting me straight - I had forgotten about strings and raw
data.
Background read/watch: "Big and Little Endian inside/out", by Ben
Herrenschmid. Raw presentation and recordings available on the net:
http://lmgtfy.com/?q=Big+and+Little+Endian+inside%2Fout+-
+Ben+Herrenschmidt
That's the one I remembered seeing a while ago (while working on the
USB host adapter) but could not find a link for anymore. Thanks agan.
Cheers,
Michael
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 --
[email protected]
In personal conversations with technical people, I call myself a
hacker. But
when I'm talking to journalists I just say "programmer" or something
like that.
-- Linus Torvalds
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive:
http://lists.debian.org/[email protected]