[riscv] Support mapping I/O devices outside of the identity map

With the 64-bit paging schemes (Sv39, Sv48, and Sv57), we identity-map
as much of the physical address space as is possible.  Experimentation
shows that this is not sufficient to provide access to all I/O
devices.  For example: the Sipeed Lichee Pi 4A includes a CPU that
supports only Sv39, but places I/O devices at the top of a 40-bit
address space.

Add support for creating I/O page table entries on demand to map I/O
devices, based on the existing design used for x86_64 BIOS.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-05-26 15:45:27 +01:00
parent 6af4a022b2
commit eae9a27542
4 changed files with 273 additions and 1 deletions

View File

@@ -10,12 +10,17 @@
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#define IOAPI_RISCV
#define IOMAP_VIRT
#define DMAAPI_FLAT
#define UACCESS_OFFSET
#define TIMER_ZICNTR
#define ENTROPY_ZKR
#if __riscv_xlen == 64
#define IOMAP_SVPAGE
#else
#define IOMAP_VIRT
#endif
#define CONSOLE_SBI
#define REBOOT_SBI
#define UMALLOC_UHEAP