aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2017-10-27 13:09:03 +0100
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2017-10-31 17:25:37 +0000
commitc413e9a426e263816dd2c11c62589e0532bcf7e9 (patch)
tree26d5579465a550623bec82a6a7592f409d6ba459
parent8413846631113f42f0cd18165f465a6193af7f30 (diff)
sparc32_dma: switch over to using IOMMU memory region and DMA API
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
-rw-r--r--hw/dma/sparc32_dma.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/hw/dma/sparc32_dma.c b/hw/dma/sparc32_dma.c
index 7d00f1a68f..01afb758b6 100644
--- a/hw/dma/sparc32_dma.c
+++ b/hw/dma/sparc32_dma.c
@@ -30,6 +30,7 @@
#include "hw/sparc/sparc32_dma.h"
#include "hw/sparc/sun4m.h"
#include "hw/sysbus.h"
+#include "sysemu/dma.h"
#include "qapi/error.h"
#include "trace.h"
@@ -71,16 +72,17 @@ void ledma_memory_read(void *opaque, hwaddr addr,
uint8_t *buf, int len, int do_bswap)
{
DMADeviceState *s = opaque;
+ IOMMUState *is = (IOMMUState *)s->iommu;
int i;
addr |= s->dmaregs[3];
trace_ledma_memory_read(addr, len);
if (do_bswap) {
- sparc_iommu_memory_read(s->iommu, addr, buf, len);
+ dma_memory_read(&is->iommu_as, addr, buf, len);
} else {
addr &= ~1;
len &= ~1;
- sparc_iommu_memory_read(s->iommu, addr, buf, len);
+ dma_memory_read(&is->iommu_as, addr, buf, len);
for(i = 0; i < len; i += 2) {
bswap16s((uint16_t *)(buf + i));
}
@@ -91,13 +93,14 @@ void ledma_memory_write(void *opaque, hwaddr addr,
uint8_t *buf, int len, int do_bswap)
{
DMADeviceState *s = opaque;
+ IOMMUState *is = (IOMMUState *)s->iommu;
int l, i;
uint16_t tmp_buf[32];
addr |= s->dmaregs[3];
trace_ledma_memory_write(addr, len);
if (do_bswap) {
- sparc_iommu_memory_write(s->iommu, addr, buf, len);
+ dma_memory_write(&is->iommu_as, addr, buf, len);
} else {
addr &= ~1;
len &= ~1;
@@ -108,7 +111,7 @@ void ledma_memory_write(void *opaque, hwaddr addr,
for(i = 0; i < l; i += 2) {
tmp_buf[i >> 1] = bswap16(*(uint16_t *)(buf + i));
}
- sparc_iommu_memory_write(s->iommu, addr, (uint8_t *)tmp_buf, l);
+ dma_memory_write(&is->iommu_as, addr, tmp_buf, l);
len -= l;
buf += l;
addr += l;
@@ -139,18 +142,20 @@ static void dma_set_irq(void *opaque, int irq, int level)
void espdma_memory_read(void *opaque, uint8_t *buf, int len)
{
DMADeviceState *s = opaque;
+ IOMMUState *is = (IOMMUState *)s->iommu;
trace_espdma_memory_read(s->dmaregs[1], len);
- sparc_iommu_memory_read(s->iommu, s->dmaregs[1], buf, len);
+ dma_memory_read(&is->iommu_as, s->dmaregs[1], buf, len);
s->dmaregs[1] += len;
}
void espdma_memory_write(void *opaque, uint8_t *buf, int len)
{
DMADeviceState *s = opaque;
+ IOMMUState *is = (IOMMUState *)s->iommu;
trace_espdma_memory_write(s->dmaregs[1], len);
- sparc_iommu_memory_write(s->iommu, s->dmaregs[1], buf, len);
+ dma_memory_write(&is->iommu_as, s->dmaregs[1], buf, len);
s->dmaregs[1] += len;
}