redox_syscall: add EnterS2Idle/ExitS2Idle AcpiVerb variants (Phase I/J)

Phase I/J: hardware-agnostic s2idle / Modern Standby
support. These AcpiVerb variants are needed on any
platform with Modern Standby firmware (Dell, HP, Lenovo,
LG Gram, etc.), not just LG Gram. They mirror Linux 7.1:

* EnterS2Idle (= 3) — s2idle_enter() in
  kernel/power/suspend.c:91
* ExitS2Idle (= 4) — s2idle_wake() in
  kernel/power/suspend.c:133

The version field stays at upstream 0.8.1. We do NOT
bump the version — this is the durable overlay pattern
(per AGENTS.md 'GOLDEN RULE — Red Bear adapts to
upstream, never the reverse'). Periodic rebase via
'git fetch upstream && git rebase upstream/master' is
the workflow when upstream changes.

The patch file backing this commit is at
local/patches/syscall/P1-acpiverb-enter-exit-s2idle.patch
in the outer RedBear-OS repo.
This commit is contained in:
2026-07-01 07:30:32 +03:00
parent 022ead54fd
commit d9f7a9e808
+17
View File
@@ -310,12 +310,29 @@ pub enum AcpiVerb {
ReadRxsdt = 1,
// no payload, just returns 0 or 1
CheckShutdown = 2,
/// Red Bear OS extension (Phase I): acpid requests the kernel
/// enter s2idle (Modern Standby / S0ix). The kernel sets
/// `S2IDLE_REQUESTED`; the idle path calls `mwait_loop()`. Read
/// payload (1 byte) returns the *previous* value of the flag.
/// Write payload is opaque (ignored by current kernel).
/// Mirrors Linux 7.1 `s2idle_enter()` in
/// `kernel/power/suspend.c:91`. Hardware-agnostic — works on
/// any platform with Modern Standby firmware (Dell, HP, Lenovo,
/// LG Gram, etc.), not just LG Gram.
EnterS2Idle = 3,
/// Red Bear OS extension (Phase I): acpid signals s2idle
/// exit. Kernel clears `S2IDLE_REQUESTED`. Read payload (1
/// byte) always returns 0. Mirrors Linux 7.1 `s2idle_wake()` in
/// `kernel/power/suspend.c:133`. Hardware-agnostic.
ExitS2Idle = 4,
}
impl AcpiVerb {
pub const fn try_from_raw(value: u64) -> Option<Self> {
Some(match value {
1 => Self::ReadRxsdt,
2 => Self::CheckShutdown,
3 => Self::EnterS2Idle,
4 => Self::ExitS2Idle,
_ => return None,
})
}