The power button, in ring 3: SCI bound, fixed event published (M21.1)

The kernel publishes the FADT as one more acpi-tables memory resource
(tagged by its intact FACP header — the AML blobs are header-stripped);
the acpi service reads the PM1 event/control and GPE register ports from
that copy, so the kernel's own FADT parse is untouched. A power-protocol
module (ServiceId.power = 5, domain-named so an ARM PSCI service can serve
the same id) carries subscribe / shutdown / events.

The acpi service converts to runtime.service.run — device discovery, the
.power protocol, and the SCI notification all fold into one loop. At
startup it enables ACPI mode if SCI_EN is clear (the SMI dance), binds the
SCI (found as the node's len-1 irq resource, distinct from the broad
window), and sets PWRBTN_EN. On the SCI it reads PM1_STS, clears
PWRBTN_STS write-1, logs the press, publishes power_button to
subscribers, and always acks. The power-button scenario proves it with a
real QMP system_powerdown injected mid-run through the M21.0 channel.
This commit is contained in:
Daniel Samson
2026-07-13 05:38:03 +01:00
parent dfc7d6a609
commit 1f2c60b3ec
9 changed files with 354 additions and 40 deletions
+9 -8
View File
@@ -75,14 +75,15 @@ auto-merge to main when the branch is green; keep the branch; push everything.
always-on unix socket, client with the capabilities handshake, per-case
`qmp_after` hook, and a hook-must-deliver pass gate that the smoke case
now proves with a harmless query-status; suite 58/58).
- [ ] **M21.1** — SCI + the power button: kernel appends the FADT as an
acpi-tables memory resource; new `power-protocol` module +
`ServiceId.power`; the acpi service converts to the harness, registers
`.power`, parses the event/GPE blocks from its FADT copy, enables ACPI
mode if needed (SMI dance, spin on SCI_EN), binds the SCI, sets
PWRBTN_EN; on SCI reads/clears PM1_STS and publishes `power_button`
(log: `power: button pressed`), always irqAck. Scenario `power-button`:
`qmp_after system_powerdown` → expect the log line.
- [x] **M21.1** — SCI + the power button (kernel appends the FADT as an
acpi-tables memory resource, tagged by its "FACP" header; `power-protocol`
module + `ServiceId.power = 5`; the acpi service converted to
`runtime.service.run`, registers `.power`, reads PM1 event/control + GPE
ports from its FADT copy, enables ACPI mode if SCI_EN is clear, binds the
SCI (the len-1 irq), sets PWRBTN_EN; the SCI handler clears PM1_STS,
logs `power: button pressed`, publishes `power_button`, acks. Scenario
`power-button` injects a real `system_powerdown` via QMP; initial-ramdisk
timeout 30→60s for the service's added boot work; suite 59/59).
- [ ] **M21.2** — Notify + GPE dispatch: interpreter handles `notify_opcode`
into a bounded queue drained after evaluate(); on GPE status bits the
service evaluates `\_GPE._Lxx`/`_Exx`, maps notified nodes to events