diff options
author | Avi Kivity <avi@redhat.com> | 2011-10-10 17:18:44 +0200 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-11-24 18:31:55 +0200 |
commit | b8f7a73878cdd7c1f892c5a3360f64d2a2ca040f (patch) | |
tree | 343fe09ccf82bfbc28e59aaed537b6042dac6f2e /hw/pl050.c | |
parent | 9edbe481bf38e0eb91a38a6ba44317a5ad15f6e6 (diff) |
pl050: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw/pl050.c')
-rw-r--r-- | hw/pl050.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/hw/pl050.c b/hw/pl050.c index f7fa2e253c..dedd622cf2 100644 --- a/hw/pl050.c +++ b/hw/pl050.c @@ -12,6 +12,7 @@ typedef struct { SysBusDevice busdev; + MemoryRegion iomem; void *dev; uint32_t cr; uint32_t clk; @@ -57,7 +58,8 @@ static void pl050_update(void *opaque, int level) qemu_set_irq(s->irq, raise); } -static uint32_t pl050_read(void *opaque, target_phys_addr_t offset) +static uint64_t pl050_read(void *opaque, target_phys_addr_t offset, + unsigned size) { pl050_state *s = (pl050_state *)opaque; if (offset >= 0xfe0 && offset < 0x1000) @@ -99,7 +101,7 @@ static uint32_t pl050_read(void *opaque, target_phys_addr_t offset) } static void pl050_write(void *opaque, target_phys_addr_t offset, - uint32_t value) + uint64_t value, unsigned size) { pl050_state *s = (pl050_state *)opaque; switch (offset >> 2) { @@ -124,27 +126,18 @@ static void pl050_write(void *opaque, target_phys_addr_t offset, hw_error("pl050_write: Bad offset %x\n", (int)offset); } } -static CPUReadMemoryFunc * const pl050_readfn[] = { - pl050_read, - pl050_read, - pl050_read -}; - -static CPUWriteMemoryFunc * const pl050_writefn[] = { - pl050_write, - pl050_write, - pl050_write +static const MemoryRegionOps pl050_ops = { + .read = pl050_read, + .write = pl050_write, + .endianness = DEVICE_NATIVE_ENDIAN, }; static int pl050_init(SysBusDevice *dev, int is_mouse) { pl050_state *s = FROM_SYSBUS(pl050_state, dev); - int iomemtype; - iomemtype = cpu_register_io_memory(pl050_readfn, - pl050_writefn, s, - DEVICE_NATIVE_ENDIAN); - sysbus_init_mmio(dev, 0x1000, iomemtype); + memory_region_init_io(&s->iomem, &pl050_ops, s, "pl050", 0x1000); + sysbus_init_mmio_region(dev, &s->iomem); sysbus_init_irq(dev, &s->irq); s->is_mouse = is_mouse; if (s->is_mouse) |