diff options
author | BenoƮt Canet <benoit.canet@gmail.com> | 2011-10-24 22:38:20 +0200 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-11-24 18:31:57 +0200 |
commit | b9441ebbfffc1b37519043fe67ee011d2f60cc67 (patch) | |
tree | 924eea62cca4451b0401e9d31fac535f9619787c | |
parent | e2ba99e9cd34a22e6d21ceb9783d0395b0a1d606 (diff) |
mst_fpga: convert to memory API
Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r-- | hw/mst_fpga.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/hw/mst_fpga.c b/hw/mst_fpga.c index 7bcd5d75e8..cf9957b9f9 100644 --- a/hw/mst_fpga.c +++ b/hw/mst_fpga.c @@ -34,6 +34,7 @@ typedef struct mst_irq_state{ SysBusDevice busdev; + MemoryRegion iomem; qemu_irq parent; @@ -86,8 +87,8 @@ mst_fpga_set_irq(void *opaque, int irq, int level) } -static uint32_t -mst_fpga_readb(void *opaque, target_phys_addr_t addr) +static uint64_t +mst_fpga_readb(void *opaque, target_phys_addr_t addr, unsigned size) { mst_irq_state *s = (mst_irq_state *) opaque; @@ -124,7 +125,8 @@ mst_fpga_readb(void *opaque, target_phys_addr_t addr) } static void -mst_fpga_writeb(void *opaque, target_phys_addr_t addr, uint32_t value) +mst_fpga_writeb(void *opaque, target_phys_addr_t addr, uint64_t value, + unsigned size) { mst_irq_state *s = (mst_irq_state *) opaque; value &= 0xffffffff; @@ -175,17 +177,11 @@ mst_fpga_writeb(void *opaque, target_phys_addr_t addr, uint32_t value) } } -static CPUReadMemoryFunc * const mst_fpga_readfn[] = { - mst_fpga_readb, - mst_fpga_readb, - mst_fpga_readb, +static const MemoryRegionOps mst_fpga_ops = { + .read = mst_fpga_readb, + .write = mst_fpga_writeb, + .endianness = DEVICE_NATIVE_ENDIAN, }; -static CPUWriteMemoryFunc * const mst_fpga_writefn[] = { - mst_fpga_writeb, - mst_fpga_writeb, - mst_fpga_writeb, -}; - static int mst_fpga_post_load(void *opaque, int version_id) { @@ -198,7 +194,6 @@ static int mst_fpga_post_load(void *opaque, int version_id) static int mst_fpga_init(SysBusDevice *dev) { mst_irq_state *s; - int iomemtype; s = FROM_SYSBUS(mst_irq_state, dev); @@ -210,9 +205,9 @@ static int mst_fpga_init(SysBusDevice *dev) /* alloc the external 16 irqs */ qdev_init_gpio_in(&dev->qdev, mst_fpga_set_irq, MST_NUM_IRQS); - iomemtype = cpu_register_io_memory(mst_fpga_readfn, - mst_fpga_writefn, s, DEVICE_NATIVE_ENDIAN); - sysbus_init_mmio(dev, 0x00100000, iomemtype); + memory_region_init_io(&s->iomem, &mst_fpga_ops, s, + "fpga", 0x00100000); + sysbus_init_mmio_region(dev, &s->iomem); return 0; } |