acpid+ps2d: wire SystemQuirkFlags consumers (LG Gram Round 1)

acpid: load SystemQuirkFlags from in-memory DMI at init via
redox-driver-sys::quirks::toml_loader::load_dmi_system_quirks.
Store as a field on AcpiContext and expose via system_quirks().
Wire two consumers:

  - FORCE_S2IDLE in set_global_s_state(3): routes S3 entry to
    s2idle preparation instead. LG Gram 16Z90TP, Framework 16,
    late Dell XPS advertise \_S3 in DSDT but the firmware refuses
    the SLP_TYP write and hangs / silently no-ops.

  - NO_LEGACY_PM1B in set_global_s_state(*): skips the PM1b write
    even when FADT reports a non-zero pm1b_control_block. LG
    firmware reports a PM1b block that does not exist on the
    platform; writes wedge the controller.

ps2d: load SystemQuirkFlags from /scheme/acpi/dmi at init via
redox_driver_sys::quirks::system_quirks(). Wire one consumer:

  - KBD_DEACTIVATE_FIXUP in Ps2::init(): skips SetDefaultsDisable
    (0xF5) during keyboard init. LG Gram + some Dell/HP/Lenovo
    keyboards wedge or drop keys when 0xF5 is sent (Linux
    atkbd.c keyboard_broken[] / atkbd_deactivate_input tables).

acpid/src/dmi.rs: reframe misleading 'stub' docstring on
try_load_existing() — the function is a real round-trip reader
for /scheme/acpi/dmi, not a stub.

Cargo.lock regenerated to include the new redox-driver-sys path
dependency in acpid and ps2d.

This is the consumer-wiring deliverable for LG Gram Round 1
(local/docs/evidence/lg-gram/ASSESSMENT-2026-07-26.md). The
matching redox-driver-sys stub-replacement work
(load_dmi_acpi_quirks real loader, PANEL_ORIENTATION_TABLE
populated with Linux DRM entries, ACPI_FLAG_NAMES + TOML parser)
lands in the parent repo in the same Round 1 push.

acpi_irq1_skip_override remains documented as needing kernel IRQ
setup work (out of scope for Round 1).
This commit is contained in:
Red Bear OS
2026-07-26 16:30:50 +09:00
parent 9e5f915d42
commit 45452c5a8e
8 changed files with 143 additions and 13 deletions
+17 -2
View File
@@ -385,7 +385,7 @@ impl Ps2 {
Ok(())
}
pub fn init(&mut self) -> Result<(), Error> {
pub fn init(&mut self, kbd_deactivate_fixup: bool) -> Result<(), Error> {
// Linux i8042_controller_check(): verify controller is present by
// flushing any stale data. A stuck output buffer means no controller.
self.flush();
@@ -468,8 +468,23 @@ impl Ps2 {
self.flush();
// Linux i8042_controller_init() step 2: set keyboard defaults
// (disable scanning so keyboard doesn't send scancodes during init)
// (disable scanning so keyboard doesn't send scancodes during init).
//
// Skip on platforms with the `kbd_deactivate_fixup` DMI quirk
// (LG Gram + a handful of Dell/HP/Lenovo laptops per Linux
// `drivers/input/keyboard/atkbd.c` `keyboard_broken[]` and
// `atkbd_deactivate_input` tables). On those platforms the
// ATKBD_CMD_RESET_DIS (0xF5) command wedges the controller or
// causes silent key drops until the next reset. The keyboard
// still works without the explicit disable — it just may emit
// a few stale scancodes that we drain via flush() above.
self.retry(format_args!("keyboard defaults"), 4, |x| {
if kbd_deactivate_fixup {
log::info!(
"ps2d: skipping SetDefaultsDisable (0xF5) due to kbd_deactivate_fixup quirk"
);
return Ok(0xFA);
}
let b = x.keyboard_command(KeyboardCommand::SetDefaultsDisable)?;
if b != 0xFA {
error!("keyboard failed to set defaults: {:02X}", b);