Subject: Re: non-swapping bus_space_read/write()
To: None <tech-kern@NetBSD.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 03/18/2004 23:54:51
On Thu, Mar 18, 2004 at 11:38:45PM +0100, Manuel Bouyer wrote:
> Hi,
> I finally fixed the if_ti driver to work on big-endian systems.
> The problem was quite simple: bus_space_read/write4() convert data
> to little-endian (which is expected as it's a PCI bus), but the tigon
> can run in big-endian mode. The only fix needed was to add extra
> htole32() to the bus_space_read/write_4() calls in the driver, so that
> data are really read or written as big-endian from/to the chip.
>
> Of course this is a ugly hack. I can see 2 solutions:
> 1) very few chips can operate in big-endian mode, so we ignore the issue
> at the bus_space level and implement specific hacks in the drivers that
> needs this
> 2) we extent the bus_space API to add non-byteswapping versions of
> bus_space_{read,write}_{1,2,4,8}()
>
> or maybe something else I didn't think at.
There was. Martin Husemann informed me that we already have
bus_space_write_stream_4() and bus_space_read_stream_4() for this.
I though the stream versions were only implemented for the multi and region
methods.
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--