1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 06:17:34 +00:00

Kernel/riscv64: Add support for SRST "System Reset" SBI extension

This extension will be used for rebooting and shutting down.
This commit is contained in:
Sönke Holz 2024-01-04 18:18:34 +01:00 committed by Andrew Kaster
parent cac7dc8d71
commit 27087318bc
2 changed files with 58 additions and 0 deletions

View file

@ -46,6 +46,8 @@ enum class EID : i32 {
Base = 0x10,
// Debug Console Extension ("DBCN")
DebugConsole = 0x4442434E,
// System Reset Extension ("SRST")
SystemReset = 0x53525354,
// Timer Extension ("TIME")
Timer = 0x54494D45,
};
@ -155,6 +157,32 @@ SBIErrorOr<void> set_timer(u64 stime_value);
}
// Chapter 10. System Reset Extension (EID #0x53525354 "SRST")
// Since SBI v0.2
namespace SystemReset {
enum class FID : i32 {
SystemReset = 0,
};
enum class ResetType : u32 {
Shutdown = 0x0,
ColdReboot = 0x1,
WarmReboot = 0x2,
};
enum class ResetReason : u32 {
NoReason = 0x0,
SystemFailure = 0x1,
};
// System reset (FID #0)
// Reset the system based on provided reset_type and reset_reason. This is a synchronous call and
// does not return if it succeeds.
SBIError system_reset(ResetType reset_type, ResetReason reset_reason);
}
// Chapter 12. Debug Console Extension (EID #0x4442434E "DBCN")
// Since SBI v2.0
namespace DBCN {