Re: pre 2.1: Neat Oops with ncrBsd

Linus Torvalds (torvalds@cs.helsinki.fi)
Wed, 25 Sep 1996 08:01:44 +0300 (EET DST)


On Tue, 24 Sep 1996, Gerard Roudier wrote:
>
> The 1rst memory mapped IO done by the driver is at offset 4 of the IO
> window of the chip. The code uses "readb()" with the vremmaped virtual
> address + 4. Is that ok?
> Probably not ...

Nope. readb() and vremap() don't mix.

Hmm, that's actually hard to handle. In general "vremap()" is only necessary
on x86 (where we share the processor memory and PCI IO space). On a alpha
(or PPC, or..) you can use "readb()" without any remapping at all, while on a
PC you'd do the vremap() and then directly access the remapped area.

> Something has added 0xc0000000 to the offset.

That's the readb().

Hmm, I think I have an idea.

The readb() (and other macros) right now use __va() to change the address
into a virtual one. But on the x86 we'd actually be better off with a new
"__io()" macro, which instead of adding PAGE_OFFSET would do a logical OR
operation.

Could you test this change:

- in include/asm-i386/io.h, add a macro like this:

#define __io(x) ((void *)(PAGE_ADDRESS | (unsigned long)(x)))

- in the same file, change all uses of "__va" to "__io".

That should make things work, and we can easily make it work on the alpha too
(by making "vremap()" a NULL operation on the alpha, as we don't need any
remapping, and we can just return the original address)

Linus