kernel: Phase J EnterS2Idle/ExitS2Idle AcPiVerb dispatch in kstop handle
Phase J: extend the kernel AcpiScheme's kcall to dispatch
on the new EnterS2Idle and ExitS2Idle AcPiVerb variants
from the local syscall fork. The kernel's scheme/acpi.rs
kcall handler now has a match arm for each new verb.
* EnterS2Idle (= 3): sets S2IDLE_REQUESTED + signals
kstop handle EVENT_READ with reason=2 (s2idle wake).
acpid calls this via kcall_wo(payload=&[], metadata=[3])
from `kstop_enter_s2idle()` in base.
* ExitS2Idle (= 4): s2idle wake path. Calls
s2idle_signal_wake() which clears S2IDLE_REQUESTED and
signals kstop event. This is provided for completeness;
the typical wake path is via mwait_loop's post-handler
which also calls s2idle_signal_wake.
Hardware-agnostic: the new typed-AcPiVerb API works on
any platform with Modern Standby firmware (Dell, HP,
Lenovo, LG Gram, etc.). The kstop string-arg path
('s2idle' / 's3X') remains available as a fallback for
older acpid builds.
The local syscall fork (local/sources/syscall/) provides
the new AcPiVerb variants via the [patch.crates-io]
overrides in base/Cargo.toml and kernel/Cargo.toml. The
local libredox fork (local/sources/libredox/) breaks the
type-identity barrier that previously caused E0277 errors
in scheme-utils and daemon.
This commit is contained in:
@@ -256,6 +256,34 @@ impl KernelScheme for AcpiScheme {
|
||||
// reason value.
|
||||
Ok(*KSTOP_FLAG.lock(token.token()) as usize)
|
||||
}
|
||||
AcpiVerb::EnterS2Idle => {
|
||||
// Phase J: typed-AcpiVerb path. acpid calls
|
||||
// this (via kcall_wo) instead of writing the
|
||||
// "s2idle" string to the kstop handle. The
|
||||
// payload is empty; the verb code is the
|
||||
// signal. Hardware-agnostic — works on any
|
||||
// platform with Modern Standby firmware
|
||||
// (Dell, HP, Lenovo, LG Gram, etc.).
|
||||
if handle != HandleBits::KSTOP_HANDLE {
|
||||
return Err(Error::new(EINVAL));
|
||||
}
|
||||
s2idle_request_set();
|
||||
kstop_set_reason(2); // s2idle wake reason
|
||||
Ok(0)
|
||||
}
|
||||
AcpiVerb::ExitS2Idle => {
|
||||
// Phase J: s2idle wake. The kernel's mwait_loop
|
||||
// post-handler already clears S2IDLE_REQUESTED
|
||||
// and signals the kstop event with reason=2;
|
||||
// this verb is provided for completeness (e.g.
|
||||
// when acpid wants to force the wake path
|
||||
// without going through MWAIT).
|
||||
if handle != HandleBits::KSTOP_HANDLE {
|
||||
return Err(Error::new(EINVAL));
|
||||
}
|
||||
s2idle_signal_wake();
|
||||
Ok(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user