Subject: Re: endianness and PCI
To: Garrett D'Amore <>
From: Martin Husemann <>
List: tech-kern
Date: 11/21/2005 20:55:34
On Mon, Nov 21, 2005 at 10:16:50AM -0800, Garrett D'Amore wrote:
> >>just not support the linear mapping (which causes these devices to fail
> >>cleanly in attach, but may exclude some things like machfb/igsfb that
> >>can cope with this.

Minor nit: machfb has a split aperture, one half with swapped endianess,
so the driver could handle your case just fine by using the other half
(I can't remember if it currently does this).

> This one is the problem.  The problem is that I can handle the bus_space
> implementation so that it does the right thing, but that linear mapping
> is screwed up.  I guess I can just punt on this and let devices that
> expect to be able to linear map and get little endian registers break
> when the processor is used in big-endian mode.  (This is a dual mode
> processor.)

This will mostly be framebuffers, I guess. If there realy is no way on your
board to stop the magic swapping, you'll probably have to do this. I find
this hard to believe, but not impossible. 

A similar issue happens on the sparc port with microsparcIIep (JavaStation
Krups): the root pci bridge can be configured to swap or not, but only
globally. So we ran the pci bus in auto-swapping mode all of the time until
we got X support. To get X working, the whole swapping had to be turned off
and replaced with software swaps in most of the bus access functions.

There is, however, no new special flag needed - anything that does a
bus_space_map with BUS_SPACE_MAP_LINEAR realy does expect little endian
access on a pci bus.