diff options
author | Andreas Färber <afaerber@suse.de> | 2013-08-18 20:48:33 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-11-05 17:47:30 +0100 |
commit | 2c42c3a063c2a8dda74b613bfab021b86ebc7ee5 (patch) | |
tree | f7d6fa2f3fd6d3fe1ed0c23768e5927602792af1 /hw | |
parent | 21ebaf1d812471e3379c85ffb8b0cc2311d5bff0 (diff) | |
download | qemu-2c42c3a063c2a8dda74b613bfab021b86ebc7ee5.zip qemu-2c42c3a063c2a8dda74b613bfab021b86ebc7ee5.tar.gz qemu-2c42c3a063c2a8dda74b613bfab021b86ebc7ee5.tar.bz2 |
arm11mpcore: Create container MemoryRegion in instance_init
This allows to map the region directly after object initialization.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/cpu/arm11mpcore.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/hw/cpu/arm11mpcore.c b/hw/cpu/arm11mpcore.c index 8719634..5f80e7b 100644 --- a/hw/cpu/arm11mpcore.c +++ b/hw/cpu/arm11mpcore.c @@ -90,8 +90,6 @@ static void mpcore_priv_map_setup(ARM11MPCorePriveState *s) SysBusDevice *gicbusdev = SYS_BUS_DEVICE(s->gic); SysBusDevice *timerbusdev = SYS_BUS_DEVICE(s->mptimer); SysBusDevice *wdtbusdev = SYS_BUS_DEVICE(s->wdtimer); - memory_region_init(&s->container, OBJECT(s), - "mpcore-priv-container", 0x2000); memory_region_init_io(&s->iomem, OBJECT(s), &mpcore_scu_ops, s, "mpcore-scu", 0x100); memory_region_add_subregion(&s->container, 0, &s->iomem); @@ -155,10 +153,19 @@ static int mpcore_priv_init(SysBusDevice *sbd) qdev_init_nofail(s->wdtimer); mpcore_priv_map_setup(s); - sysbus_init_mmio(sbd, &s->container); return 0; } +static void mpcore_priv_initfn(Object *obj) +{ + SysBusDevice *sbd = SYS_BUS_DEVICE(obj); + ARM11MPCorePriveState *s = ARM11MPCORE_PRIV(obj); + + memory_region_init(&s->container, OBJECT(s), + "mpcore-priv-container", 0x2000); + sysbus_init_mmio(sbd, &s->container); +} + #define TYPE_REALVIEW_MPCORE_RIRQ "realview_mpcore" #define REALVIEW_MPCORE_RIRQ(obj) \ OBJECT_CHECK(mpcore_rirq_state, (obj), TYPE_REALVIEW_MPCORE_RIRQ) @@ -277,6 +284,7 @@ static const TypeInfo mpcore_priv_info = { .name = TYPE_ARM11MPCORE_PRIV, .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(ARM11MPCorePriveState), + .instance_init = mpcore_priv_initfn, .class_init = mpcore_priv_class_init, }; |