summaryrefslogtreecommitdiffstats
path: root/src/arch/riscv/include
diff options
context:
space:
mode:
authorMichael Brown2024-10-28 12:44:41 +0100
committerMichael Brown2024-10-28 14:55:00 +0100
commitb0a8eabbf4d32d789686c32809750f95986dc7cb (patch)
treeb5fb7387630c65e5ea62545f86a8716dee36e512 /src/arch/riscv/include
parent[fdt] Add ability to parse unsigned integer properties (diff)
downloadipxe-b0a8eabbf4d32d789686c32809750f95986dc7cb.tar.gz
ipxe-b0a8eabbf4d32d789686c32809750f95986dc7cb.tar.xz
ipxe-b0a8eabbf4d32d789686c32809750f95986dc7cb.zip
[riscv] Add support for checking CPU extensions reported via device tree
RISC-V seems to allow for direct discovery of CPU features only from M-mode (e.g. by setting up a trap handler and then attempting to access a CSR), with S-mode code expected to read the resulting constructed ISA description from the device tree. Add the ability to check for the presence of named extensions listed in the "riscv,isa" property of the device tree node corresponding to the boot hart. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/riscv/include')
-rw-r--r--src/arch/riscv/include/bits/errfile.h1
-rw-r--r--src/arch/riscv/include/ipxe/hart.h16
2 files changed, 17 insertions, 0 deletions
diff --git a/src/arch/riscv/include/bits/errfile.h b/src/arch/riscv/include/bits/errfile.h
index e97c71a37..03f98c206 100644
--- a/src/arch/riscv/include/bits/errfile.h
+++ b/src/arch/riscv/include/bits/errfile.h
@@ -15,6 +15,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
*/
#define ERRFILE_sbi_reboot ( ERRFILE_ARCH | ERRFILE_CORE | 0x00000000 )
+#define ERRFILE_hart ( ERRFILE_ARCH | ERRFILE_CORE | 0x00010000 )
/** @} */
diff --git a/src/arch/riscv/include/ipxe/hart.h b/src/arch/riscv/include/ipxe/hart.h
new file mode 100644
index 000000000..c201b6c77
--- /dev/null
+++ b/src/arch/riscv/include/ipxe/hart.h
@@ -0,0 +1,16 @@
+#ifndef _IPXE_HART_H
+#define _IPXE_HART_H
+
+/** @file
+ *
+ * Hardware threads (harts)
+ *
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
+
+extern unsigned long boot_hart;
+
+extern int hart_supported ( const char *ext );
+
+#endif /* _IPXE_HART_H */