Subject: Re: bus.h style question
To: Matt Thomas <matt@3am-software.com>
From: Curt Sampson <cjs@portal.ca>
List: tech-kern
Date: 08/14/1997 13:04:44
On Thu, 14 Aug 1997, Matt Thomas wrote:

> >Could I use bus_space_read_4 savely to get value? Are there alignement 
> >constraints in the bus.h interface?
> 
> I've wondered that as well.  My guess would have to be yes.

Not in the interface itself, although individual machines do have
alignment constraints (the Alpha, for example). Chris Demetriou
has suggested that it would be a good idea to have a `debugging'
version of the bus.h routines that enforced alignment constraints
on all architectures, so that folks developing, say, PCI drivers
on the i386 would also be developing ones that would work on the
alpha.

> I would hope the bus_space_ calls would byteswap >1 byte units as 
> appropriate for the bus.  (especially since they're are no 
> big endian byteswap routines).

But it may not be appropriate to swap! If I'm reading an ethernet
packet out of shared memory on a PCI network card, for example, I
want to do 32-bit reads, because why use four bus cycles when I
only need one? But if the bus routines swapped the bytes, I'd have
to swap them right back again.

cjs

Curt Sampson    cjs@portal.ca	   Info at http://www.portal.ca/
Internet Portal Services, Inc.	   Through infinite myst, software reverberates
Vancouver, BC  (604) 257-9400	   In code possess'd of invisible folly.