[riscv] Provide a DMA API implementation for RISC-V bare-metal systems

Provide an implementation of dma_map() that performs cache clean or
invalidation as required, and an implementation of dma_alloc() that
returns virtual addresses within the coherent mapping of the 32-bit
physical address space.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-07-08 14:56:47 +01:00
parent 22de0c4edf
commit 101ef74a6e
9 changed files with 241 additions and 13 deletions

15
src/include/bits/dma.h Normal file
View File

@@ -0,0 +1,15 @@
#ifndef _BITS_DMA_H
#define _BITS_DMA_H
/** @file
*
* Dummy architecture-specific DMA API implementations
*
* This file is included only if the architecture does not provide its
* own version of this file.
*
*/
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#endif /* _BITS_DMA_H */

View File

@@ -345,6 +345,9 @@ DMAAPI_INLINE ( op, dma ) ( struct dma_mapping *map, void *addr ) {
return ( virt_to_phys ( addr ) + map->offset );
}
/* Include all architecture-dependent DMA API headers */
#include <bits/dma.h>
/**
* Map buffer for DMA
*