From e4244f7469acec30114aba0e6feb3ee6e9365bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Holz?= Date: Thu, 4 Jan 2024 18:23:15 +0100 Subject: [PATCH] Kernel/riscv64: Implement support for "panic=shutdown" cmdline option --- Kernel/Library/Panic.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Kernel/Library/Panic.cpp b/Kernel/Library/Panic.cpp index b77de7883e..3f3dec925c 100644 --- a/Kernel/Library/Panic.cpp +++ b/Kernel/Library/Panic.cpp @@ -10,6 +10,8 @@ # include #elif ARCH(AARCH64) # include +#elif ARCH(RISCV64) +# include #endif #include #include @@ -25,6 +27,11 @@ namespace Kernel { virtualbox_shutdown(); #elif ARCH(AARCH64) RPi::Watchdog::the().system_shutdown(); +#elif ARCH(RISCV64) + auto ret = SBI::SystemReset::system_reset(SBI::SystemReset::ResetType::Shutdown, SBI::SystemReset::ResetReason::SystemFailure); + dbgln("SBI: Failed to shut down: {}", ret); + dbgln("SBI: Attempting to shut down using the legacy extension..."); + SBI::Legacy::shutdown(); #endif // Note: If we failed to invoke platform shutdown, we need to halt afterwards // to ensure no further execution on any CPU still happens.