aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2020-11-25 15:52:00 +0000
committerMichael Brown <mcb30@ipxe.org>2020-11-25 16:15:55 +0000
commitcf12a41703a8b2292e5d2d7528c2733c37869681 (patch)
tree72e60b6240cdd10816b7dce5fcc98822ae94e957 /src/core
parent24ef743778fb47958441d8891e5104135ac4c168 (diff)
downloadipxe-cf12a41703a8b2292e5d2d7528c2733c37869681.zip
ipxe-cf12a41703a8b2292e5d2d7528c2733c37869681.tar.gz
ipxe-cf12a41703a8b2292e5d2d7528c2733c37869681.tar.bz2
[dma] Modify DMA API to simplify calculation of medial addresses
Redefine the value stored within a DMA mapping to be the offset between physical addresses and DMA addresses within the mapped region. Provide a dma() wrapper function to calculate the DMA address for any pointer within a mapped region, thereby simplifying the use cases when a device needs to be given addresses other than the region start address. On a platform using the "flat" DMA implementation the DMA offset for any mapped region is always zero, with the result that dma_map() can be optimised away completely and dma() reduces to a straightforward call to virt_to_phys(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/core')
-rw-r--r--src/core/dma.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/dma.c b/src/core/dma.c
index 9fc0c54..3bf6957 100644
--- a/src/core/dma.c
+++ b/src/core/dma.c
@@ -46,6 +46,7 @@ PROVIDE_DMAAPI_INLINE ( flat, dma_unmap );
PROVIDE_DMAAPI_INLINE ( flat, dma_alloc );
PROVIDE_DMAAPI_INLINE ( flat, dma_free );
PROVIDE_DMAAPI_INLINE ( flat, dma_set_mask );
+PROVIDE_DMAAPI_INLINE ( flat, dma_phys );
/******************************************************************************
*
@@ -138,6 +139,7 @@ PROVIDE_DMAAPI ( op, dma_unmap, dma_op_unmap );
PROVIDE_DMAAPI ( op, dma_alloc, dma_op_alloc );
PROVIDE_DMAAPI ( op, dma_free, dma_op_free );
PROVIDE_DMAAPI ( op, dma_set_mask, dma_op_set_mask );
+PROVIDE_DMAAPI_INLINE ( op, dma_phys );
/******************************************************************************
*