Subject: Re: diff betw. bus_space_{read,write} and
To: None <bouyer@antioche.lip6.fr>
From: Ken Nakata <kenn@synap.ne.jp>
List: current-users
Date: 08/22/1998 08:53:29
On Fri, 21 Aug 1998 19:25:29 +0200, Manuel Bouyer wrote:
> [ moved to tech-kern. please don't include surrent-users in replies ]
> 
> On Aug 22, Ken Nakata wrote
> > Why not?  In host byte order (BE) "NetBSD is cool" becomes in IDE bus
> > byte order "eNBtDSi soclo" if the bridge's byte-swapping is cancelled
> > out.  This is not cool.
> 
> No. Without byte swapping, strings are still the same. You get this with
> the byte-swapping.

I think I'm getting why I'm confused.  I perceive the Mac host-IDE
data bus wiring (bits 16-23 <-> bits 8-15, bits 24-31 <-> bits 0-7) as
a byte-swapper.  Byte order is preserved even though the stream is
read/written as a short word stream because of this byte-swapper,
since host and IDE bus byte orders are different.

Suppose IDE bus' upper and lower bytes were wired to Mac's upper and
lower bytes (e.g. bits 0-7 to bits 16-23, bits 8-15 to bits 24-31).
In Mac's byte order, byte 0 of the short word data being passed is the
upper byte, whereas byte 0 in IDE's byte order is the lower byte.
Therefore, WITHOUT a byte-swapper, byte order will not be preserved.

And you say wrong byte-order will occur WITH a byte-swapper.  Why?  I
suspect we speak two different languages; i.e. I don't call something
what you call a byte-swapper a byte-swapper.

> > "16-bit byte-swapping access"?  On mac68k and Mac IDE i/f, the bus
> > bridge does byte-swapping but not the bus_space_read_multi_2()
> > functions.  Does this count as "16-bit byte-swapping access"?
> 
> Yes

And I get every short word in the wrong order with that!

> By 'word' I think you mean 16-bit quantities, not "strings".

Yup.

> Would it be possible that the bridge snoops the command register, and
> does selective byte-swapping, based on the command you issued ?

No.  The stupid bridge always does its only job to preserve the byte
order, and that's why I'm getting every short in the wrong order (in
little endian, that is).

> > Am I misunderstanding the meaning of the term "byte-swapping"?  I
> > thought it was said to be byte-swapping when the I/O bus' upper and
> > lower bytes were wired to the host bus' lower and upper bytes
> > respectively.
> 
> It's what I understand too.

Then I don't understand why we say different things about "eNBtDS".  I
say we'll get it WITHOUT byte-swapping, and you say we'll get it WITH
byte-swapping.

Ken