mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:07:35 +00:00
Kernel: Add RPi Watchdog and use it for system shutdown
The Raspberry Pi hardware doesn't support a proper software-initiated shutdown, so this instead uses the watchdog to reboot to a special partition which the firmware interprets as an immediate halt on shutdown. When running under Qemu, this causes the emulator to exit.
This commit is contained in:
parent
555d301e3b
commit
d9c557d0b4
5 changed files with 80 additions and 0 deletions
|
@ -9,6 +9,8 @@
|
|||
#if ARCH(X86_64)
|
||||
# include <Kernel/Arch/x86_64/I8042Reboot.h>
|
||||
# include <Kernel/Arch/x86_64/Shutdown.h>
|
||||
#elif ARCH(AARCH64)
|
||||
# include <Kernel/Arch/aarch64/RPi/Watchdog.h>
|
||||
#endif
|
||||
#include <Kernel/FileSystem/FileSystem.h>
|
||||
#include <Kernel/FileSystem/SysFS/Subsystems/Kernel/PowerStateSwitch.h>
|
||||
|
@ -101,6 +103,8 @@ void SysFSPowerStateSwitchNode::poweroff()
|
|||
#if ARCH(X86_64)
|
||||
qemu_shutdown();
|
||||
virtualbox_shutdown();
|
||||
#elif ARCH(AARCH64)
|
||||
RPi::Watchdog::the().system_shutdown();
|
||||
#endif
|
||||
dbgln("shutdown attempts failed, applications will stop responding.");
|
||||
dmesgln("Shutdown can't be completed. It's safe to turn off the computer!");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue