summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-08-15 17:17:20 +0300
committerAnthony Liguori <aliguori@us.ibm.com>2011-08-22 10:20:40 -0500
commitf69bf9d41c2432f4021afb25830f19b0b813dc42 (patch)
tree04461ea847641c6658a71d85226964afbc6f0cc1 /hw
parente219dea2f37448adb38875ae41391f8ba8601467 (diff)
downloadqemu-f69bf9d41c2432f4021afb25830f19b0b813dc42.tar.gz
qemu-f69bf9d41c2432f4021afb25830f19b0b813dc42.tar.bz2
qemu-f69bf9d41c2432f4021afb25830f19b0b813dc42.zip
armv7m: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/armv7m.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/hw/armv7m.c b/hw/armv7m.c
index 83f3393eab..a932f16a44 100644
--- a/hw/armv7m.c
+++ b/hw/armv7m.c
@@ -106,31 +106,27 @@ static void bitband_writel(void *opaque, target_phys_addr_t offset,
cpu_physical_memory_write(addr, (uint8_t *)&v, 4);
}
-static CPUReadMemoryFunc * const bitband_readfn[] = {
- bitband_readb,
- bitband_readw,
- bitband_readl
-};
-
-static CPUWriteMemoryFunc * const bitband_writefn[] = {
- bitband_writeb,
- bitband_writew,
- bitband_writel
+static const MemoryRegionOps bitband_ops = {
+ .old_mmio = {
+ .read = { bitband_readb, bitband_readw, bitband_readl, },
+ .write = { bitband_writeb, bitband_writew, bitband_writel, },
+ },
+ .endianness = DEVICE_NATIVE_ENDIAN,
};
typedef struct {
SysBusDevice busdev;
+ MemoryRegion iomem;
uint32_t base;
} BitBandState;
static int bitband_init(SysBusDevice *dev)
{
BitBandState *s = FROM_SYSBUS(BitBandState, dev);
- int iomemtype;
- iomemtype = cpu_register_io_memory(bitband_readfn, bitband_writefn,
- &s->base, DEVICE_NATIVE_ENDIAN);
- sysbus_init_mmio(dev, 0x02000000, iomemtype);
+ memory_region_init_io(&s->iomem, &bitband_ops, &s->base, "bitband",
+ 0x02000000);
+ sysbus_init_mmio_region(dev, &s->iomem);
return 0;
}