diff options
author | Philippe Mathieu-Daudé <philmd@redhat.com> | 2021-12-31 11:33:29 +0100 |
---|---|---|
committer | Philippe Mathieu-Daudé <f4bug@amsat.org> | 2022-01-18 12:56:29 +0100 |
commit | bfa30f3903e0542611196b21f5832a4be5775a21 (patch) | |
tree | 6b2e7195df4f014b0fcb330e2112b6478c6127ed /softmmu | |
parent | 026644cf5f9fd8c27ea7f4f2fd4fea8102b30001 (diff) |
hw/dma: Use dma_addr_t type definition when relevant
Update the obvious places where dma_addr_t should be used
(instead of uint64_t, hwaddr, size_t, int32_t types).
This allows to have &dma_addr_t type portable on 32/64-bit
hosts.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20220111184309.28637-11-f4bug@amsat.org>
Diffstat (limited to 'softmmu')
-rw-r--r-- | softmmu/dma-helpers.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/softmmu/dma-helpers.c b/softmmu/dma-helpers.c index 4563a775aa..916cf12ed4 100644 --- a/softmmu/dma-helpers.c +++ b/softmmu/dma-helpers.c @@ -294,12 +294,12 @@ BlockAIOCB *dma_blk_write(BlockBackend *blk, } -static MemTxResult dma_buf_rw(void *buf, int32_t len, uint64_t *residual, +static MemTxResult dma_buf_rw(void *buf, dma_addr_t len, dma_addr_t *residual, QEMUSGList *sg, DMADirection dir, MemTxAttrs attrs) { uint8_t *ptr = buf; - uint64_t xresidual; + dma_addr_t xresidual; int sg_cur_index; MemTxResult res = MEMTX_OK; @@ -308,7 +308,7 @@ static MemTxResult dma_buf_rw(void *buf, int32_t len, uint64_t *residual, len = MIN(len, xresidual); while (len > 0) { ScatterGatherEntry entry = sg->sg[sg_cur_index++]; - int32_t xfer = MIN(len, entry.len); + dma_addr_t xfer = MIN(len, entry.len); res |= dma_memory_rw(sg->as, entry.base, ptr, xfer, dir, attrs); ptr += xfer; len -= xfer; @@ -321,18 +321,20 @@ static MemTxResult dma_buf_rw(void *buf, int32_t len, uint64_t *residual, return res; } -uint64_t dma_buf_read(void *ptr, int32_t len, QEMUSGList *sg, MemTxAttrs attrs) +dma_addr_t dma_buf_read(void *ptr, dma_addr_t len, + QEMUSGList *sg, MemTxAttrs attrs) { - uint64_t residual; + dma_addr_t residual; dma_buf_rw(ptr, len, &residual, sg, DMA_DIRECTION_FROM_DEVICE, attrs); return residual; } -uint64_t dma_buf_write(void *ptr, int32_t len, QEMUSGList *sg, MemTxAttrs attrs) +dma_addr_t dma_buf_write(void *ptr, dma_addr_t len, + QEMUSGList *sg, MemTxAttrs attrs) { - uint64_t residual; + dma_addr_t residual; dma_buf_rw(ptr, len, &residual, sg, DMA_DIRECTION_TO_DEVICE, attrs); |