diff options
author | Avi Kivity <avi@redhat.com> | 2011-11-15 12:26:54 +0200 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-11-24 18:32:01 +0200 |
commit | f810bc4ab6847e7ad997fb6045329a30bcf2d0fa (patch) | |
tree | 9ab5b7a32600695aefd529603c81d4fc3ac29b5d /hw/xilinx_axidma.c | |
parent | 1ce2c9cdfe6e4a687d824f0f3649b843c9942b62 (diff) |
xilinx_axidma: convert to memory API
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'hw/xilinx_axidma.c')
-rw-r--r-- | hw/xilinx_axidma.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/hw/xilinx_axidma.c b/hw/xilinx_axidma.c index 571a5b0661..2fd360e635 100644 --- a/hw/xilinx_axidma.c +++ b/hw/xilinx_axidma.c @@ -91,6 +91,7 @@ struct AXIStream { struct XilinxAXIDMA { SysBusDevice busdev; + MemoryRegion iomem; uint32_t freqhz; void *dmach; @@ -362,7 +363,8 @@ void axidma_push(void *opaque, unsigned char *buf, size_t len, uint32_t *app) stream_update_irq(s); } -static uint32_t axidma_readl(void *opaque, target_phys_addr_t addr) +static uint64_t axidma_read(void *opaque, target_phys_addr_t addr, + unsigned size) { struct XilinxAXIDMA *d = opaque; struct AXIStream *s; @@ -396,8 +398,8 @@ static uint32_t axidma_readl(void *opaque, target_phys_addr_t addr) } -static void -axidma_writel(void *opaque, target_phys_addr_t addr, uint32_t value) +static void axidma_write(void *opaque, target_phys_addr_t addr, + uint64_t value, unsigned size) { struct XilinxAXIDMA *d = opaque; struct AXIStream *s; @@ -449,22 +451,15 @@ axidma_writel(void *opaque, target_phys_addr_t addr, uint32_t value) stream_update_irq(s); } -static CPUReadMemoryFunc * const axidma_read[] = { - &axidma_readl, - &axidma_readl, - &axidma_readl, -}; - -static CPUWriteMemoryFunc * const axidma_write[] = { - &axidma_writel, - &axidma_writel, - &axidma_writel, +static const MemoryRegionOps axidma_ops = { + .read = axidma_read, + .write = axidma_write, + .endianness = DEVICE_NATIVE_ENDIAN, }; static int xilinx_axidma_init(SysBusDevice *dev) { struct XilinxAXIDMA *s = FROM_SYSBUS(typeof(*s), dev); - int axidma_regs; int i; sysbus_init_irq(dev, &s->streams[1].irq); @@ -476,9 +471,9 @@ static int xilinx_axidma_init(SysBusDevice *dev) xlx_dma_connect_dma(s->dmach, s, axidma_push); - axidma_regs = cpu_register_io_memory(axidma_read, axidma_write, s, - DEVICE_NATIVE_ENDIAN); - sysbus_init_mmio(dev, R_MAX * 4 * 2, axidma_regs); + memory_region_init_io(&s->iomem, &axidma_ops, s, + "axidma", R_MAX * 4 * 2); + sysbus_init_mmio_region(dev, &s->iomem); for (i = 0; i < 2; i++) { stream_reset(&s->streams[i]); |