[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Partitioning Atari Falcon in order to run linux/m68k



On Sun, Dec 15, 2013 at 2:15 AM, Michael Schmitz
<schmitz@biophys.uni-duesseldorf.de> wrote:
>>> IDE disks on Falcon are quirky in that the IDE bus interface is little
>>> endian
>>> by definition, but has been implemented in big endian bus byte order on
>>> Falcon.
>>> Data written to disk will end up byte swapped. Reading these disks on any
>>> other
>>> architecture requires that data be swapped back.
>>
>> Is this true? I had the swapped data on a CF card first (since ARAnyM
>> likes to swap them by default) but had to unswap them. I don’t remember
>> if that was a Falcon or TT, though… Ragnar would know I think.
>
> 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.

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

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

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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


Reply to: