summaryrefslogtreecommitdiffstats
path: root/src/arch/riscv/include
diff options
context:
space:
mode:
authorMichael Brown2024-10-28 15:40:35 +0100
committerMichael Brown2024-10-28 20:20:50 +0100
commite0e102ee24bdab68b0318b505402f60cfb88a5f0 (patch)
tree197f71c01a84c567360ce8897795c57d9b339910 /src/arch/riscv/include
parent[build] Allow default platform to vary by architecture (diff)
downloadipxe-e0e102ee24bdab68b0318b505402f60cfb88a5f0.tar.gz
ipxe-e0e102ee24bdab68b0318b505402f60cfb88a5f0.tar.xz
ipxe-e0e102ee24bdab68b0318b505402f60cfb88a5f0.zip
[sbi] Add support for running as a RISC-V SBI payload
Add basic support for running directly on top of SBI, with no UEFI firmware present. Build as e.g.: make CROSS=riscv64-linux-gnu- bin-riscv64/ipxe.sbi The resulting binary can be tested in QEMU using e.g.: qemu-system-riscv64 -M virt -cpu max -serial stdio \ -kernel bin-riscv64/ipxe.sbi No drivers or executable binary formats are supported yet, but the unit test suite may be run successfully. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/riscv/include')
-rw-r--r--src/arch/riscv/include/bits/umalloc.h14
-rw-r--r--src/arch/riscv/include/ipxe/errno/sbi.h19
-rw-r--r--src/arch/riscv/include/ipxe/sbi_umalloc.h18
3 files changed, 51 insertions, 0 deletions
diff --git a/src/arch/riscv/include/bits/umalloc.h b/src/arch/riscv/include/bits/umalloc.h
new file mode 100644
index 000000000..a7171ca2c
--- /dev/null
+++ b/src/arch/riscv/include/bits/umalloc.h
@@ -0,0 +1,14 @@
+#ifndef _BITS_UMALLOC_H
+#define _BITS_UMALLOC_H
+
+/** @file
+ *
+ * RISCV-specific user memory allocation API implementations
+ *
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
+#include <ipxe/sbi_umalloc.h>
+
+#endif /* _BITS_UMALLOC_H */
diff --git a/src/arch/riscv/include/ipxe/errno/sbi.h b/src/arch/riscv/include/ipxe/errno/sbi.h
new file mode 100644
index 000000000..2428183d4
--- /dev/null
+++ b/src/arch/riscv/include/ipxe/errno/sbi.h
@@ -0,0 +1,19 @@
+#ifndef _IPXE_ERRNO_SBI_H
+#define _IPXE_ERRNO_SBI_H
+
+/**
+ * @file
+ *
+ * RISC-V SBI platform error codes
+ *
+ * We never need to return SBI error codes ourselves, so we
+ * arbitrarily choose to use the Linux error codes as platform error
+ * codes.
+ *
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
+#include <ipxe/errno/linux.h>
+
+#endif /* _IPXE_ERRNO_SBI_H */
diff --git a/src/arch/riscv/include/ipxe/sbi_umalloc.h b/src/arch/riscv/include/ipxe/sbi_umalloc.h
new file mode 100644
index 000000000..5763239fb
--- /dev/null
+++ b/src/arch/riscv/include/ipxe/sbi_umalloc.h
@@ -0,0 +1,18 @@
+#ifndef _IPXE_SBI_UMALLOC_H
+#define _IPXE_SBI_UMALLOC_H
+
+/** @file
+ *
+ * External memory allocation
+ *
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
+#ifdef UMALLOC_SBI
+#define UMALLOC_PREFIX_sbi
+#else
+#define UMALLOC_PREFIX_sbi __sbi_
+#endif
+
+#endif /* _IPXE_SBI_UMALLOC_H */