diff options
author | BenoƮt Canet <benoit.canet@gmail.com> | 2011-10-24 22:38:27 +0200 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-11-24 18:31:57 +0200 |
commit | 7d5ebaf00245d41cefda7e5ab5b5a7e3c3df14bb (patch) | |
tree | d342941cae4c7a1eb9203463ddc5801267bc7d24 /hw/syborg_timer.c | |
parent | a8a008223cd8e194cd98c049dfaeaaec2ca9f68c (diff) | |
download | qemu-7d5ebaf00245d41cefda7e5ab5b5a7e3c3df14bb.zip qemu-7d5ebaf00245d41cefda7e5ab5b5a7e3c3df14bb.tar.gz qemu-7d5ebaf00245d41cefda7e5ab5b5a7e3c3df14bb.tar.bz2 |
syborg_timer: convert to memory API
Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw/syborg_timer.c')
-rw-r--r-- | hw/syborg_timer.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/hw/syborg_timer.c b/hw/syborg_timer.c index 50c813e..dfee457 100644 --- a/hw/syborg_timer.c +++ b/hw/syborg_timer.c @@ -53,6 +53,7 @@ enum { typedef struct { SysBusDevice busdev; + MemoryRegion iomem; ptimer_state *timer; int running; int oneshot; @@ -83,7 +84,8 @@ static void syborg_timer_tick(void *opaque) syborg_timer_update(s); } -static uint32_t syborg_timer_read(void *opaque, target_phys_addr_t offset) +static uint64_t syborg_timer_read(void *opaque, target_phys_addr_t offset, + unsigned size) { SyborgTimerState *s = (SyborgTimerState *)opaque; @@ -114,7 +116,7 @@ static uint32_t syborg_timer_read(void *opaque, target_phys_addr_t offset) } static void syborg_timer_write(void *opaque, target_phys_addr_t offset, - uint32_t value) + uint64_t value, unsigned size) { SyborgTimerState *s = (SyborgTimerState *)opaque; @@ -162,16 +164,10 @@ static void syborg_timer_write(void *opaque, target_phys_addr_t offset, } } -static CPUReadMemoryFunc * const syborg_timer_readfn[] = { - syborg_timer_read, - syborg_timer_read, - syborg_timer_read -}; - -static CPUWriteMemoryFunc * const syborg_timer_writefn[] = { - syborg_timer_write, - syborg_timer_write, - syborg_timer_write +static const MemoryRegionOps syborg_timer_ops = { + .read = syborg_timer_read, + .write = syborg_timer_write, + .endianness = DEVICE_NATIVE_ENDIAN, }; static const VMStateDescription vmstate_syborg_timer = { @@ -194,17 +190,14 @@ static int syborg_timer_init(SysBusDevice *dev) { SyborgTimerState *s = FROM_SYSBUS(SyborgTimerState, dev); QEMUBH *bh; - int iomemtype; if (s->freq == 0) { fprintf(stderr, "syborg_timer: Zero/unset frequency\n"); exit(1); } sysbus_init_irq(dev, &s->irq); - iomemtype = cpu_register_io_memory(syborg_timer_readfn, - syborg_timer_writefn, s, - DEVICE_NATIVE_ENDIAN); - sysbus_init_mmio(dev, 0x1000, iomemtype); + memory_region_init_io(&s->iomem, &syborg_timer_ops, s, "timer", 0x1000); + sysbus_init_mmio_region(dev, &s->iomem); bh = qemu_bh_new(syborg_timer_tick, s); s->timer = ptimer_init(bh); |