diff options
author | BenoƮt Canet <benoit.canet@gmail.com> | 2011-11-15 12:13:58 +0100 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-11-24 18:32:02 +0200 |
commit | 40ce02fcd12ddcd1d6c152be3ddebe77713e5f1f (patch) | |
tree | e996f67dc1b66af8fc3bcd78658067799843cbab /hw | |
parent | cccd43c544c300b207f8b049dbed768cf19285b7 (diff) | |
download | qemu-40ce02fcd12ddcd1d6c152be3ddebe77713e5f1f.zip qemu-40ce02fcd12ddcd1d6c152be3ddebe77713e5f1f.tar.gz qemu-40ce02fcd12ddcd1d6c152be3ddebe77713e5f1f.tar.bz2 |
slavio_misc: convert aux2 to memory API
Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/slavio_misc.c | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/hw/slavio_misc.c b/hw/slavio_misc.c index 7a51e1b..ccc1c53 100644 --- a/hw/slavio_misc.c +++ b/hw/slavio_misc.c @@ -42,6 +42,7 @@ typedef struct MiscState { MemoryRegion led_iomem; MemoryRegion sysctrl_iomem; MemoryRegion aux1_iomem; + MemoryRegion aux2_iomem; qemu_irq irq; qemu_irq fdc_tc; uint32_t dummy; @@ -236,7 +237,7 @@ static const MemoryRegionOps slavio_aux1_mem_ops = { }; static void slavio_aux2_mem_writeb(void *opaque, target_phys_addr_t addr, - uint32_t val) + uint64_t val, unsigned size) { MiscState *s = opaque; @@ -251,7 +252,8 @@ static void slavio_aux2_mem_writeb(void *opaque, target_phys_addr_t addr, slavio_misc_update_irq(s); } -static uint32_t slavio_aux2_mem_readb(void *opaque, target_phys_addr_t addr) +static uint64_t slavio_aux2_mem_readb(void *opaque, target_phys_addr_t addr, + unsigned size) { MiscState *s = opaque; uint32_t ret = 0; @@ -261,16 +263,14 @@ static uint32_t slavio_aux2_mem_readb(void *opaque, target_phys_addr_t addr) return ret; } -static CPUReadMemoryFunc * const slavio_aux2_mem_read[3] = { - slavio_aux2_mem_readb, - NULL, - NULL, -}; - -static CPUWriteMemoryFunc * const slavio_aux2_mem_write[3] = { - slavio_aux2_mem_writeb, - NULL, - NULL, +static const MemoryRegionOps slavio_aux2_mem_ops = { + .read = slavio_aux2_mem_readb, + .write = slavio_aux2_mem_writeb, + .endianness = DEVICE_NATIVE_ENDIAN, + .valid = { + .min_access_size = 1, + .max_access_size = 1, + }, }; static void apc_mem_writeb(void *opaque, target_phys_addr_t addr, @@ -421,7 +421,6 @@ static int apc_init1(SysBusDevice *dev) static int slavio_misc_init1(SysBusDevice *dev) { MiscState *s = FROM_SYSBUS(MiscState, dev); - int io; sysbus_init_irq(dev, &s->irq); sysbus_init_irq(dev, &s->fdc_tc); @@ -460,10 +459,9 @@ static int slavio_misc_init1(SysBusDevice *dev) sysbus_init_mmio_region(dev, &s->aux1_iomem); /* AUX 2 (Software Powerdown Control) */ - io = cpu_register_io_memory(slavio_aux2_mem_read, - slavio_aux2_mem_write, s, - DEVICE_NATIVE_ENDIAN); - sysbus_init_mmio(dev, MISC_SIZE, io); + memory_region_init_io(&s->aux2_iomem, &slavio_aux2_mem_ops, s, + "software-powerdown-control", MISC_SIZE); + sysbus_init_mmio_region(dev, &s->aux2_iomem); qdev_init_gpio_in(&dev->qdev, slavio_set_power_fail, 1); |