aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2011-11-13 12:16:07 +0200
committerAvi Kivity <avi@redhat.com>2011-11-24 18:31:59 +0200
commit5a31cd68bad16103beb6d3d4e65d5c401d8e5ff9 (patch)
tree9d24ca59d69c676e0fc216f8da1a98b7f4d8b779 /hw
parent871321acb35d671afc3eb36c2d88519c2c03d017 (diff)
downloadqemu-5a31cd68bad16103beb6d3d4e65d5c401d8e5ff9.zip
qemu-5a31cd68bad16103beb6d3d4e65d5c401d8e5ff9.tar.gz
qemu-5a31cd68bad16103beb6d3d4e65d5c401d8e5ff9.tar.bz2
m48t59: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/m48t59.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/hw/m48t59.c b/hw/m48t59.c
index a77937e..06a3974 100644
--- a/hw/m48t59.c
+++ b/hw/m48t59.c
@@ -52,6 +52,7 @@
struct M48t59State {
/* Hardware parameters */
qemu_irq IRQ;
+ MemoryRegion iomem;
uint32_t io_base;
uint32_t size;
/* RTC management */
@@ -573,16 +574,12 @@ static uint32_t nvram_readl (void *opaque, target_phys_addr_t addr)
return retval;
}
-static CPUWriteMemoryFunc * const nvram_write[] = {
- &nvram_writeb,
- &nvram_writew,
- &nvram_writel,
-};
-
-static CPUReadMemoryFunc * const nvram_read[] = {
- &nvram_readb,
- &nvram_readw,
- &nvram_readl,
+static const MemoryRegionOps nvram_ops = {
+ .old_mmio = {
+ .read = { nvram_readb, nvram_readw, nvram_readl, },
+ .write = { nvram_writeb, nvram_writew, nvram_writel, },
+ },
+ .endianness = DEVICE_NATIVE_ENDIAN,
};
static const VMStateDescription vmstate_m48t59 = {
@@ -712,13 +709,11 @@ static int m48t59_init1(SysBusDevice *dev)
{
M48t59SysBusState *d = FROM_SYSBUS(M48t59SysBusState, dev);
M48t59State *s = &d->state;
- int mem_index;
sysbus_init_irq(dev, &s->IRQ);
- mem_index = cpu_register_io_memory(nvram_read, nvram_write, s,
- DEVICE_NATIVE_ENDIAN);
- sysbus_init_mmio(dev, s->size, mem_index);
+ memory_region_init_io(&s->iomem, &nvram_ops, s, "m48t59.nvram", s->size);
+ sysbus_init_mmio_region(dev, &s->iomem);
m48t59_init_common(s);
return 0;