I/O Mem access - getting confused.

Daniel Kobras (daniel.kobras@student.uni-tuebingen.de)
Tue, 14 Sep 1999 00:35:25 +0200 (CEST)


Hi!

So I have read the docs, peeked through the source and finally I'm
completely confused: What I want to do is access shared memory on the ISA
and/or PCI bus. Fine, readb() and friends are what I want. But what should
I feed them to be portable? A bus address or a virtual address? On i386
and most other architectures, both seem to work. From looking at
asm-mips/io.h, it looks like it _must_ be readb(bus_address). But then
most drivers happily use readb() et al. on ioremap()ed, i.e. virtual
addresses and even Linus himself does so, quoting him from
Documentation/IO-mapping.txt:

--[snip]--

char * baseptr = ioremap(0xFC000000, 1024*1024);

/* write a 'A' to the offset 10 of the area */
writeb('A',baseptr+10);

--[snap]--

Now I wonder what to do to get my driver as portable as possible. My best
guess at the moment is:

1. readb() and friends should get fed bus addresses only.
2. As ioremap() returns a virtual address, those addresses should get
dereferenced directly and Linus' example in IO-mapping.txt should get
fixed to "baseptr[10]='A';"

Is this correct?

Thanks for any insight,

Daniel.

-
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/