Re: Specifying properly the PCI driver model on all linux archite ctur es, (ioremap(), bus_to_virt()

Jes Sorensen (Jes.Sorensen@cern.ch)
02 Nov 1999 17:42:37 +0100


>>>>> "Patrick" == Patrick Lerda <LERDA@microprocess.com> writes:

Patrick> Linux is great operating system, but a small part of it, the
Patrick> PCI initalisation are not properly documented. This lack of
Patrick> documentation is not a real problem for the classic Linux
Patrick> that works on Intel processor. But some linux architecture
Patrick> like PowerPC use a more complex PCI translation. In this case
Patrick> the lack of information is a problem. Because some PCI
Patrick> drivers used some #ifdef to work on different linux
Patrick> architecture...

I am sorry, but I have to claim you are wrong there.

Most of what I have seen so far has been cases where non x86
architectures did the wrong thing to obtain the virtual address to
access (ie. not using ioremap()) and when x86 drivers dereference PCI
space directly which they shouldn't.

There were some things which were not quite clear until recently,
concerning whether readl/writel guarantees write ordering or not (they
didn't on the Alpha, they did on the PPC/Sparc64). This has been
clarified and it is so that readl/writel are meant to guarantee write
ordering and we now have the __raw_{read,write}l() interface which can
be used to get non ordered access (for performance issues). The raw
interface doesn't perform byte swapping on big endian architectures
either, thus it can also be used when one wants access to device
memory in native byte order, ie. this is sometimes wanted for frame
buffer memory.

So to sum it up, the two common errors are: a) code not using
ioremap() b) code not using readl/writel()

Jes

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/