diff mbox

(master, stable-0.13) zaurus: workaround for io base address rounded down

Message ID 20101013191250.GA59919@triton8.kn-bremen.de
State New
Headers show

Commit Message

Juergen Lock Oct. 13, 2010, 7:12 p.m. UTC
The 2nd scoop's base address (0x08800040) now gets rounded down to
start of page which causes its io read/write callbacks to be passed
addresses 0x40 higher than the code expects:  (as witnessed by
"Bad register offset" messages and failure to attach the internal
CF disk aka microdrive at least.)

[There may be more bugs of this kind hiding in other targets, this
 was just the one I tested...]

Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>

Comments

Blue Swirl Oct. 13, 2010, 7:45 p.m. UTC | #1
On Wed, Oct 13, 2010 at 7:12 PM, Juergen Lock <qemu-l@jelal.kn-bremen.de> wrote:
> The 2nd scoop's base address (0x08800040) now gets rounded down to
> start of page which causes its io read/write callbacks to be passed
> addresses 0x40 higher than the code expects:  (as witnessed by
> "Bad register offset" messages and failure to attach the internal
> CF disk aka microdrive at least.)
>
> [There may be more bugs of this kind hiding in other targets, this
>  was just the one I tested...]

The devices are passed an offset to base address. Perhaps the real
problem is that scoop_init registers too much MMIO: 0x1000, when the
real range should be only 0x28. Also the registers are in 4 byte
intervals and any access to address between the registers also
triggers a warning.

What were the messages exactly?
diff mbox

Patch

--- a/hw/zaurus.c
+++ b/hw/zaurus.c
@@ -70,6 +70,10 @@  static uint32_t scoop_readb(void *opaque
 {
     ScoopInfo *s = (ScoopInfo *) opaque;
 
+    // XXX Workaround for base address (0x08800040 in this case)
+    //     rounded down to start of page
+    addr &= 0x3f;
+
     switch (addr) {
     case SCOOP_MCR:
         return s->mcr;
@@ -104,6 +108,10 @@  static void scoop_writeb(void *opaque, t
     ScoopInfo *s = (ScoopInfo *) opaque;
     value &= 0xffff;
 
+    // XXX Workaround for base address (0x08800040 in this case)
+    //     rounded down to start of page
+    addr &= 0x3f;
+
     switch (addr) {
     case SCOOP_MCR:
         s->mcr = value;