Subject: Re: diff betw. bus_space_{read,write} and
To: None <bouyer@antioche.lip6.fr>
From: Ken Nakata <kenn@synap.ne.jp>
List: tech-kern
Date: 08/25/1998 07:34:59
On Tue, 28 Jul 1998 06:03:06 +0200, Manuel Bouyer wrote:
> On Aug 24, Ken Nakata wrote
> > No, its behavior is consistent.  And, you're right, in this context,
> > the hardware bridge does NOT byte-swap.  See my argument about the
> > notion of byte-swapper above.
> 
> I didn't understand it: if IDE bit 0-7 are wired to host's bit 24-31 and IDE
> 8-15 to host 16-23, then when I read "Ne" from the IDE device the
> bridge will give me "eN": it does byte swap.

Ahh...  This is what we differ from each other.

IDE bus is a little-endian 16-bit wide bus, so the string "Ne"
(assuming 16-bit aligned) is represented by a bit pattern 0x654e (byte
0 "N" is in the lower 8 bits, and byte 1 "e" in the upper 8 bits).
Now, the same string "Ne" on the big-endian host bus is represented by
a different bit pattern 0x4e65 (byte 0 "N" is in the upper 8 bits and
byte 1 "e" in the lower 8 bits).  Therefore, string's byte order _is_
preserved when bytes are swapped.

Make sense to you?

> > > It's a standart IDE drive (i.e a quantun, IBM or something else you've
> > > purchased in a PC hardware reseller) or an APPLE one ?
> > 
> > Doesn't matter.  They behave the same in this respect (If they did
> > not, the IDE Mac owners would not be able to purchase a third-party
> > IDE drive and swap the original drive with it!)
> 
> There have been precedents (the last one which did it me was AAUI: close
> to AUI, but not enouth to work with standart transeivers).

Well, yeah, but if you change the spec, it'll defeat the whole purpose
of switching to the cheaper technology from SCSI.

> > My proposal to "fix" wdc.c for mac68k:
> > 
> > Since mac68k bus_space_{read,write}{,_multi}_2() do not byte-swap, and
> > making them conditionally do so depending on the tag would give all
> > other bus_space_{read,write}*() a performance hit,
> 
> Why ? Just do it like for ATARI: redefine them for the tag passed to
> the independant wdc part.

Ok, I admit I'm not familiar enough with bus_space implementation in
general.  I'll take a look at atari's.

Ken