diff options
author | BenoƮt Canet <benoit.canet@gmail.com> | 2011-11-15 12:13:53 +0100 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-11-24 18:32:02 +0200 |
commit | 96891e593e5fa75385d3494adfec7492f2f919fc (patch) | |
tree | 3674d3350650350e2aa6bce2d512a56e87d0ceab /hw/slavio_misc.c | |
parent | dd703aae47479075a01acde3980d45f2fb2edf74 (diff) |
slavio_misc: convert diagnostic to memory API
Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw/slavio_misc.c')
-rw-r--r-- | hw/slavio_misc.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/hw/slavio_misc.c b/hw/slavio_misc.c index 7b98f119f6..60a115dee5 100644 --- a/hw/slavio_misc.c +++ b/hw/slavio_misc.c @@ -37,6 +37,7 @@ typedef struct MiscState { SysBusDevice busdev; MemoryRegion cfg_iomem; + MemoryRegion diag_iomem; qemu_irq irq; qemu_irq fdc_tc; uint32_t dummy; @@ -133,7 +134,7 @@ static const MemoryRegionOps slavio_cfg_mem_ops = { }; static void slavio_diag_mem_writeb(void *opaque, target_phys_addr_t addr, - uint32_t val) + uint64_t val, unsigned size) { MiscState *s = opaque; @@ -141,7 +142,8 @@ static void slavio_diag_mem_writeb(void *opaque, target_phys_addr_t addr, s->diag = val & 0xff; } -static uint32_t slavio_diag_mem_readb(void *opaque, target_phys_addr_t addr) +static uint64_t slavio_diag_mem_readb(void *opaque, target_phys_addr_t addr, + unsigned size) { MiscState *s = opaque; uint32_t ret = 0; @@ -151,16 +153,14 @@ static uint32_t slavio_diag_mem_readb(void *opaque, target_phys_addr_t addr) return ret; } -static CPUReadMemoryFunc * const slavio_diag_mem_read[3] = { - slavio_diag_mem_readb, - NULL, - NULL, -}; - -static CPUWriteMemoryFunc * const slavio_diag_mem_write[3] = { - slavio_diag_mem_writeb, - NULL, - NULL, +static const MemoryRegionOps slavio_diag_mem_ops = { + .read = slavio_diag_mem_readb, + .write = slavio_diag_mem_writeb, + .endianness = DEVICE_NATIVE_ENDIAN, + .valid = { + .min_access_size = 1, + .max_access_size = 1, + }, }; static void slavio_mdm_mem_writeb(void *opaque, target_phys_addr_t addr, @@ -433,10 +433,9 @@ static int slavio_misc_init1(SysBusDevice *dev) sysbus_init_mmio_region(dev, &s->cfg_iomem); /* Diagnostics */ - io = cpu_register_io_memory(slavio_diag_mem_read, - slavio_diag_mem_write, s, - DEVICE_NATIVE_ENDIAN); - sysbus_init_mmio(dev, MISC_SIZE, io); + memory_region_init_io(&s->diag_iomem, &slavio_diag_mem_ops, s, + "diagnostic", MISC_SIZE); + sysbus_init_mmio_region(dev, &s->diag_iomem); /* Modem control */ io = cpu_register_io_memory(slavio_mdm_mem_read, |