summaryrefslogtreecommitdiffhomepage
path: root/src/coreboot-cpu-api.c
diff options
context:
space:
mode:
authorAmlal <amlal.elmahrouss@icloud.com>2025-01-21 20:32:19 +0100
committerAmlal <amlal.elmahrouss@icloud.com>2025-01-21 20:32:19 +0100
commit046d884b50c32cacd3523071541e7e38241083f3 (patch)
tree92ce6fd53e0c031c569270b04aefa8fc0aa1e074 /src/coreboot-cpu-api.c
ADD: CoreBoot, also comes with my reimplementation of libfdt, which is just a dumb rewrite.
Signed-off-by: Amlal <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'src/coreboot-cpu-api.c')
-rw-r--r--src/coreboot-cpu-api.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/coreboot-cpu-api.c b/src/coreboot-cpu-api.c
new file mode 100644
index 0000000..2f104c4
--- /dev/null
+++ b/src/coreboot-cpu-api.c
@@ -0,0 +1,22 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024, Amlal EL Mahrouss, all rights reserved.
+
+------------------------------------------- */
+
+#include <lib/boot.h>
+
+/// @brief Restarts the computer.
+/// @param none.
+void mp_restart_machine(void)
+{
+#ifdef __COMPILE_RISCV__
+ volatile uint32_t* brd_pwr = (volatile uint32_t*)0x100000;
+ *brd_pwr = 0x7777; // send reboot signal from DMA.
+
+ while (1)
+ {
+ asm volatile("wfi");
+ }
+#endif
+}