mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:34:59 +00:00
Kernel/riscv64: Implement arch_specific_{reboot,shutdown} using the SBI
We first try to use the newer "SRST" extension for rebooting and shutting down and if that fails, we try to shutdown using the legacy "System Shutdown" extension (which can't reboot, so we always shutdown). The kernel will halt, if we return from here due to all attempts at rebooting / shutting down failing.
This commit is contained in:
parent
21b2d1de65
commit
8547813b6d
1 changed files with 9 additions and 2 deletions
|
@ -5,17 +5,24 @@
|
|||
*/
|
||||
|
||||
#include <Kernel/Arch/PowerState.h>
|
||||
#include <Kernel/Arch/riscv64/SBI.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
void arch_specific_reboot()
|
||||
{
|
||||
TODO_RISCV64();
|
||||
auto ret = SBI::SystemReset::system_reset(SBI::SystemReset::ResetType::ColdReboot, SBI::SystemReset::ResetReason::NoReason);
|
||||
dbgln("SBI: Failed to reboot: {}", ret);
|
||||
dbgln("SBI: Attempting to shut down using the legacy extension...");
|
||||
SBI::Legacy::shutdown();
|
||||
}
|
||||
|
||||
void arch_specific_poweroff()
|
||||
{
|
||||
TODO_RISCV64();
|
||||
auto ret = SBI::SystemReset::system_reset(SBI::SystemReset::ResetType::Shutdown, SBI::SystemReset::ResetReason::NoReason);
|
||||
dbgln("SBI: Failed to shut down: {}", ret);
|
||||
dbgln("SBI: Attempting to shut down using the legacy extension...");
|
||||
SBI::Legacy::shutdown();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue