On Sat, Feb 12, 2011 at 12:35 AM, Michael Walle <mich...@walle.cc> wrote: > Am Freitag 11 Februar 2011, 22:03:40 schrieb Blue Swirl: >> > +static int lm32_sys_init(SysBusDevice *dev) >> > +{ >> > + LM32SysState *s = FROM_SYSBUS(typeof(*s), dev); >> > + int sys_regs; >> > + >> > + sys_regs = cpu_register_io_memory(sys_read_fn, sys_write_fn, s, >> > + DEVICE_NATIVE_ENDIAN); >> > + sysbus_init_mmio(dev, R_MAX * 4, sys_regs); >> > + sysbus_mmio_map(dev, 0, s->base); >> >> Devices should not map themselves or care what is their address. >> Please remove base field and qdev property and move the mapping to >> board level. > > I added this because the device isn't created in the board initialization. > Instead it can be added with -device, if needed. Who does the mapping in this > case?
Since SysBus does not map the devices like PCI, there would be nothing to map the device. Maybe self-mapping isn't so incorrect in this case.