syscall: add AcpiVerb::SetS3WakingVector and AcpiVerb::EnterS3 (Phase II.X.W)

Phase II.X.W: extend the AcpiVerb enum with two new variants
for the S3 round-trip:

* AcpiVerb::SetS3WakingVector (= 5): acpid writes the
  kernel's S3 resume trampoline address to FACS.
  Mirrors Linux 7.1's acpi_set_firmware_waking_vector.
  The 8-byte write payload is the address in
  little-endian. A zero payload is a sentinel for 'use the
  kernel's default trampoline address' (s3_trampoline
  symbol).
* AcpiVerb::EnterS3 (= 6): acpid requests the kernel to
  enter S3. The kernel's stop::enter_s3() reads the
  SLP_TYP value from S3_SLP_TYP and does the PM1 register
  write. The actual S3 entry happens via acpid writing
  to /scheme/sys/kstop.

Hardware-agnostic: works on any x86_64 system with
standard ACPI S3 support (Dell, HP, Lenovo, LG Gram 14).
On Modern Standby-only systems (LG Gram 16 (2025)), the
kernel never enters S3 so these verbs are no-ops.
This commit is contained in:
2026-07-01 16:32:03 +03:00
parent d9f7a9e808
commit b0f4fee4c4
+24
View File
@@ -325,6 +325,28 @@ pub enum AcpiVerb {
/// byte) always returns 0. Mirrors Linux 7.1 `s2idle_wake()` in
/// `kernel/power/suspend.c:133`. Hardware-agnostic.
ExitS2Idle = 4,
/// Red Bear OS extension (Phase II.X.W): acpid writes the
/// 64-bit kernel S3 resume trampoline address to
/// FACS.xfirmware_waking_vector. The kernel's
/// `arch/x86_shared/s3_resume.rs` trampoline is at this
/// address; the platform firmware jumps to it on S3 wake.
/// Write payload: 8-byte little-endian u64 (the trampoline
/// address). Read payload: 0 (no error condition; this verb
/// is one-way). Mirrors Linux 7.1's
/// `acpi_set_firmware_waking_vector` in ACPICA.
/// Hardware-agnostic: works on any x86_64 system with
/// standard ACPI S3 support (Dell, HP, Lenovo, LG Gram 14).
SetS3WakingVector = 5,
/// Red Bear OS extension (Phase II.X.W): acpid requests
/// the kernel to enter S3. The kernel's kstop handler
/// dispatches on the "s3" string arg, dispatches on the
/// SLP_TYP byte, and does the PM1 register write. The
/// acpid has already done the AML prep (`_TTS(3)`, `_PTS(3)`,
/// `_SST(3)`) and written the trampoline address to FACS
/// via `SetS3WakingVector`. No payload needed.
/// Mirrors Linux 7.1's `enter_sleep_state` /
/// `acpi_hw_legacy_sleep` for S3.
EnterS3 = 6,
}
impl AcpiVerb {
pub const fn try_from_raw(value: u64) -> Option<Self> {
@@ -333,6 +355,8 @@ impl AcpiVerb {
2 => Self::CheckShutdown,
3 => Self::EnterS2Idle,
4 => Self::ExitS2Idle,
5 => Self::SetS3WakingVector,
6 => Self::EnterS3,
_ => return None,
})
}