On Wed, Oct 13, 2010 at 07:45:19PM +0000, Blue Swirl wrote: > On Wed, Oct 13, 2010 at 7:12 PM, Juergen Lock <qem...@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. > Well I just tried registering only 0x28 bytes and still got the messages:
--- a/hw/zaurus.c +++ b/hw/zaurus.c @@ -237,7 +241,7 @@ ScoopInfo *scoop_init(PXA2xxState *cpu, s->in = qemu_allocate_irqs(scoop_gpio_set, s, 16); iomemtype = cpu_register_io_memory(scoop_readfn, scoop_writefn, s); - cpu_register_physical_memory(target_base, 0x1000, iomemtype); + cpu_register_physical_memory(target_base, 0x28, iomemtype); register_savevm(NULL, "scoop", instance, 1, scoop_save, scoop_load, s); return s; > What were the messages exactly? Excerpt: [...] scoop_readb: Bad register offset 0x4c scoop_writeb: Bad register offset 0x54 scoop_writeb: Bad register offset 0x5c scoop_writeb: Bad register offset 0x54 scoop_readb: Bad register offset 0x48 scoop_writeb: Bad register offset 0x44 scoop_readb: Bad register offset 0x4c scoop_readb: Bad register offset 0x48 scoop_readb: Bad register offset 0x4c scoop_readb: Bad register offset 0x48 scoop_readb: Bad register offset 0x4c scoop_readb: Bad register offset 0x48 spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. scoop_readb: Bad register offset 0x4c scoop_writeb: Bad register offset 0x54 scoop_writeb: Bad register offset 0x5c scoop_writeb: Bad register offset 0x54 scoop_readb: Bad register offset 0x48 scoop_writeb: Bad register offset 0x44 spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. scoop_readb: Bad register offset 0x4c scoop_writeb: Bad register offset 0x54 scoop_writeb: Bad register offset 0x5c scoop_writeb: Bad register offset 0x54 scoop_readb: Bad register offset 0x48 scoop_writeb: Bad register offset 0x44 spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. scoop_readb: Bad register offset 0x4c scoop_writeb: Bad register offset 0x54 scoop_writeb: Bad register offset 0x5c scoop_writeb: Bad register offset 0x54 scoop_readb: Bad register offset 0x48 scoop_writeb: Bad register offset 0x44 spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. scoop_readb: Bad register offset 0x4c scoop_writeb: Bad register offset 0x54 scoop_writeb: Bad register offset 0x5c scoop_writeb: Bad register offset 0x54 scoop_readb: Bad register offset 0x48 scoop_writeb: Bad register offset 0x44 spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. spitz_out_switch: Green LED off. spitz_out_switch: Green LED on. scoop_readb: Bad register offset 0x4c scoop_writeb: Bad register offset 0x54 scoop_writeb: Bad register offset 0x5c scoop_writeb: Bad register offset 0x54 scoop_readb: Bad register offset 0x48 scoop_writeb: Bad register offset 0x44 spitz_out_switch: Green LED off. (The above patch together with the addr &= 0x3f changes works tho.) Thanx, :) Juergen