[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-mips
Subject:    Re: read[bwl] and write[bwl] broken?
From:       Ralf Baechle <ralf () uni-koblenz ! de>
Date:       1999-12-03 13:06:46
[Download RAW message or body]

On Wed, Dec 01, 1999 at 05:21:06PM -0500, Mike Klar wrote:

> One of the LinuxCE development team members (Steve Longerbeam) uncovered the
> following Linux-MIPS kernel problem while trying to get the PCMCIA support
> to work for MIPS-based CE devices:
> 
> The MIPS implementations of read[bwl] and write[bwl] add 0xa0000000 to the
> address and should not, at least not in general.
> 
> readb, for example, is defined as (in include/asm-mips/io.h):
> #define readb(addr) (*(volatile unsigned char *) (0xa0000000 + (unsigned
> long)(addr)))
> 
> whereas it should be just:
> #define readb(addr) (*(volatile unsigned char *) (unsigned long)(addr))
> 
> It looks like it adds in KSEG1 base to translate a physical address to a
> virtual one, but my understanding of readb and friends is that they take a
> virtual address as argument as returned by ioremap (which also adds in
> KSEG1...).  The comments in io.h about "SNI hacks" lead me to believe that
> maybe there's more to this than just a bug, but still, if these are being
> defined wrong for SNI's sake, shouldn't that be #ifdef'ed?

Not #ifdef'ed but fixed for real.  The SNI machine so far was the only
supported machine where we need these macros at all, so a hack was somewhat
acceptable.

  Ralf

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic