Subject: Re: bus.h style question
To: None <tech-kern@NetBSD.ORG>
From: Alan Barrett <apb@iafrica.com>
List: tech-kern
Date: 08/20/1997 11:58:14
On Tue, 19 Aug 1997, Jonathan Stone wrote:
> Let's assume there wil be cases where PIO drivers accessing
> bytestreams via multibyte methods, and the bus/chipset/CPU combination
> does requires that software bytewapping be done.
>
> I'm claiming that drivers will be better off if the bus-space methods
> can do the bytewapping internally, [...]
I thought consensus several days ago was that it would make sense to add
several new public interfaces to the bus.h stuff, to differentiate between
the existing bus_space_{read,write}_{multi,region}_{1,2,4,8} (which means
"read or write several N-byte values, using N-byte-at-a-time I/O, and
byte-swap each N-byte value if necessary"), and some new methods that mean
things like "read or write several P-byte values, using Q-byte-at-a-time
I/O, and byte swap each P-byte value if necessary". (Byte swap "if
necessary" means something like "if the machine byte order differs from
the bus byte order".)
Then, if you have a stream of bytes that you want to write using
4-byte-at-a-time I/O (without byte swapping, because a 1-byte quantity
never needs swapping), you say use bus_space_write_region_1_by_4 (or
whatever it ends up getting called), and if you have a stream of 4-byte
integers that you want to write through a single 1-byte-wide I/O port
(byte swapping each 4-byte-quantity if necessary), you use
bus_space_write_multi_4_by_1.
--apb (Alan Barrett)