aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-11-24 14:32:34 +0200
committerAvi Kivity <avi@redhat.com>2011-11-28 15:38:41 +0200
commit9832b74c149b2859c3a4e142ba719a0acc4e2733 (patch)
treeaea97be0e6f2ea0fe436ba51350d8582e99d6aad /hw
parentfcb40162bfa1e0eb80bbe6c7782750e0d5a925ec (diff)
omap_gp_timer: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/omap_gptimer.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/hw/omap_gptimer.c b/hw/omap_gptimer.c
index c1cbdf8dcf..414b98aa36 100644
--- a/hw/omap_gptimer.c
+++ b/hw/omap_gptimer.c
@@ -23,6 +23,7 @@
/* GP timers */
struct omap_gp_timer_s {
+ MemoryRegion iomem;
qemu_irq irq;
qemu_irq wkup;
qemu_irq in;
@@ -337,12 +338,6 @@ static uint32_t omap_gp_timer_readh(void *opaque, target_phys_addr_t addr)
}
}
-static CPUReadMemoryFunc * const omap_gp_timer_readfn[] = {
- omap_badwidth_read32,
- omap_gp_timer_readh,
- omap_gp_timer_readw,
-};
-
static void omap_gp_timer_write(void *opaque, target_phys_addr_t addr,
uint32_t value)
{
@@ -454,16 +449,25 @@ static void omap_gp_timer_writeh(void *opaque, target_phys_addr_t addr,
s->writeh = (uint16_t) value;
}
-static CPUWriteMemoryFunc * const omap_gp_timer_writefn[] = {
- omap_badwidth_write32,
- omap_gp_timer_writeh,
- omap_gp_timer_write,
+static const MemoryRegionOps omap_gp_timer_ops = {
+ .old_mmio = {
+ .read = {
+ omap_badwidth_read32,
+ omap_gp_timer_readh,
+ omap_gp_timer_readw,
+ },
+ .write = {
+ omap_badwidth_write32,
+ omap_gp_timer_writeh,
+ omap_gp_timer_write,
+ },
+ },
+ .endianness = DEVICE_NATIVE_ENDIAN,
};
struct omap_gp_timer_s *omap_gp_timer_init(struct omap_target_agent_s *ta,
qemu_irq irq, omap_clk fclk, omap_clk iclk)
{
- int iomemtype;
struct omap_gp_timer_s *s = (struct omap_gp_timer_s *)
g_malloc0(sizeof(struct omap_gp_timer_s));
@@ -476,9 +480,9 @@ struct omap_gp_timer_s *omap_gp_timer_init(struct omap_target_agent_s *ta,
omap_gp_timer_reset(s);
omap_gp_timer_clk_setup(s);
- iomemtype = cpu_register_io_memory(omap_gp_timer_readfn,
- omap_gp_timer_writefn, s, DEVICE_NATIVE_ENDIAN);
- omap_l4_attach(ta, 0, iomemtype);
+ memory_region_init_io(&s->iomem, &omap_gp_timer_ops, s, "omap.gptimer",
+ omap_l4_region_size(ta, 0));
+ omap_l4_attach_region(ta, 0, &s->iomem);
return s;
}