mirror of
https://github.com/RGBCube/serenity
synced 2025-07-29 02:27: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
24
Kernel/Arch/aarch64/RPi/Watchdog.h
Normal file
24
Kernel/Arch/aarch64/RPi/Watchdog.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Daniel Bertalan <dani@danielbertalan.dev>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace Kernel::RPi {
|
||||
|
||||
struct WatchdogRegisters;
|
||||
|
||||
class Watchdog {
|
||||
public:
|
||||
static Watchdog& the();
|
||||
|
||||
void system_shutdown();
|
||||
|
||||
private:
|
||||
Watchdog();
|
||||
|
||||
WatchdogRegisters volatile* m_registers;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue