aboutsummaryrefslogtreecommitdiff
path: root/hw/armv7m.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2009-06-03 15:16:49 +0100
committerPaul Brook <paul@codesourcery.com>2009-06-03 15:16:49 +0100
commit40905a6a31f6dd1904f54ea48763c5fbe745bafa (patch)
tree45e2aca707827db2ec761c99fa5e2644858feee1 /hw/armv7m.c
parent2c6554bc6bc4fc3e0d821fbfc76f09c39048fa82 (diff)
Stellaris qdev conversion
Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'hw/armv7m.c')
-rw-r--r--hw/armv7m.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/hw/armv7m.c b/hw/armv7m.c
index e3d00ffd7b..9657ed1f16 100644
--- a/hw/armv7m.c
+++ b/hw/armv7m.c
@@ -117,18 +117,35 @@ static CPUWriteMemoryFunc *bitband_writefn[] = {
bitband_writel
};
-static void armv7m_bitband_init(void)
+typedef struct {
+ SysBusDevice busdev;
+ uint32_t base;
+} BitBandState;
+
+static void bitband_init(SysBusDevice *dev)
{
+ BitBandState *s = FROM_SYSBUS(BitBandState, dev);
int iomemtype;
- static uint32_t bitband1_offset = 0x20000000;
- static uint32_t bitband2_offset = 0x40000000;
+ s->base = qdev_get_prop_int(&dev->qdev, "base", 0);
iomemtype = cpu_register_io_memory(0, bitband_readfn, bitband_writefn,
- &bitband1_offset);
- cpu_register_physical_memory(0x22000000, 0x02000000, iomemtype);
- iomemtype = cpu_register_io_memory(0, bitband_readfn, bitband_writefn,
- &bitband2_offset);
- cpu_register_physical_memory(0x42000000, 0x02000000, iomemtype);
+ &s->base);
+ sysbus_init_mmio(dev, 0x02000000, iomemtype);
+}
+
+static void armv7m_bitband_init(void)
+{
+ DeviceState *dev;
+
+ dev = qdev_create(NULL, "ARM,bitband-memory");
+ qdev_set_prop_int(dev, "base", 0x20000000);
+ qdev_init(dev);
+ sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0x22000000);
+
+ dev = qdev_create(NULL, "ARM,bitband-memory");
+ qdev_set_prop_int(dev, "base", 0x40000000);
+ qdev_init(dev);
+ sysbus_mmio_map(sysbus_from_qdev(dev), 0, 0x42000000);
}
/* Board init. */
@@ -220,3 +237,11 @@ qemu_irq *armv7m_init(int flash_size, int sram_size,
return pic;
}
+
+static void armv7m_register_devices(void)
+{
+ sysbus_register_dev("ARM,bitband-memory", sizeof(BitBandState),
+ bitband_init);
+}
+
+device_init(armv7m_register_devices)