summaryrefslogtreecommitdiff
path: root/hw/milkymist-vgafb.c
diff options
context:
space:
mode:
authorMichael Walle <michael@walle.cc>2011-08-31 16:48:46 +0200
committerAvi Kivity <avi@redhat.com>2011-10-02 16:14:03 +0200
commit883abf8d2c8728b62e6345aee882d79c829de34c (patch)
tree4de98a5e3f1eaca43131ae5d43bd50434afd846a /hw/milkymist-vgafb.c
parent5adb30d38babd733923004c57c57fef84533a039 (diff)
milkymist-vgafb: convert to memory API
Signed-off-by: Michael Walle <michael@walle.cc> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw/milkymist-vgafb.c')
-rw-r--r--hw/milkymist-vgafb.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/hw/milkymist-vgafb.c b/hw/milkymist-vgafb.c
index 2e55e42e34..be81abdb08 100644
--- a/hw/milkymist-vgafb.c
+++ b/hw/milkymist-vgafb.c
@@ -64,6 +64,7 @@ enum {
struct MilkymistVgafbState {
SysBusDevice busdev;
+ MemoryRegion regs_region;
DisplayState *ds;
int invalidate;
@@ -153,7 +154,8 @@ static void vgafb_resize(MilkymistVgafbState *s)
s->invalidate = 1;
}
-static uint32_t vgafb_read(void *opaque, target_phys_addr_t addr)
+static uint64_t vgafb_read(void *opaque, target_phys_addr_t addr,
+ unsigned size)
{
MilkymistVgafbState *s = opaque;
uint32_t r = 0;
@@ -189,8 +191,8 @@ static uint32_t vgafb_read(void *opaque, target_phys_addr_t addr)
return r;
}
-static void
-vgafb_write(void *opaque, target_phys_addr_t addr, uint32_t value)
+static void vgafb_write(void *opaque, target_phys_addr_t addr, uint64_t value,
+ unsigned size)
{
MilkymistVgafbState *s = opaque;
@@ -238,16 +240,14 @@ vgafb_write(void *opaque, target_phys_addr_t addr, uint32_t value)
}
}
-static CPUReadMemoryFunc * const vgafb_read_fn[] = {
- NULL,
- NULL,
- &vgafb_read
-};
-
-static CPUWriteMemoryFunc * const vgafb_write_fn[] = {
- NULL,
- NULL,
- &vgafb_write
+static const MemoryRegionOps vgafb_mmio_ops = {
+ .read = vgafb_read,
+ .write = vgafb_write,
+ .valid = {
+ .min_access_size = 4,
+ .max_access_size = 4,
+ },
+ .endianness = DEVICE_NATIVE_ENDIAN,
};
static void milkymist_vgafb_reset(DeviceState *d)
@@ -269,11 +269,10 @@ static void milkymist_vgafb_reset(DeviceState *d)
static int milkymist_vgafb_init(SysBusDevice *dev)
{
MilkymistVgafbState *s = FROM_SYSBUS(typeof(*s), dev);
- int vgafb_regs;
- vgafb_regs = cpu_register_io_memory(vgafb_read_fn, vgafb_write_fn, s,
- DEVICE_NATIVE_ENDIAN);
- sysbus_init_mmio(dev, R_MAX * 4, vgafb_regs);
+ memory_region_init_io(&s->regs_region, &vgafb_mmio_ops, s,
+ "milkymist-vgafb", R_MAX * 4);
+ sysbus_init_mmio_region(dev, &s->regs_region);
s->ds = graphic_console_init(vgafb_update_display,
vgafb_invalidate_display,