Notify dispatch and GPE handlers (M21.2)

The AML interpreter now handles the Notify opcode (0x86, previously
unhandled): it resolves the target device, evaluates the code, and
records the pair in a bounded per-evaluate queue the caller drains with
takeNotifications. A host unit test with hand-encoded AML — a method that
issues Notify(DEV_, 0x80) — proves the device and code come back; aml.zig
joins the zig build test loop so the interpreter is covered on the host.

The acpi service's SCI handler now services general-purpose events too:
for each set-and-enabled GPE bit it evaluates the \_GPE._Lxx (level) or
_Exx (edge) handler method, drains the Notify queue that produced, and
publishes a domain event per notified device — PNP0C0A battery, ACPI0003
AC, PNP0C0D lid, else generic notify — then clears the status bit and
acks. The embedded controller's _Qxx queries are out of scope (hardware
track). QEMU raises no GPEs on this config, so the QEMU suite is the
regression net (the power button still works with GPE servicing in the
path); correctness is the unit test. Suite 59/59.
This commit is contained in:
Daniel Samson
2026-07-13 05:44:58 +01:00
parent 1f2c60b3ec
commit 767a2a9a7c
8 changed files with 197 additions and 59 deletions
+8 -6
View File
@@ -84,12 +84,14 @@ auto-merge to main when the branch is green; keep the branch; push everything.
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
(PNP0C0A→battery, ACPI0003→ac, PNP0C0D→lid, else generic), clears
GPE_STS, acks. EC `_Qxx` explicitly out (hardware track). Host unit
tests for Notify in aml.zig; aml.zig joins the `zig build test` loop.
- [x] **M21.2** — Notify + GPE dispatch (interpreter handles `notify_opcode`
into a bounded queue, cleared per-evaluate, drained via
`takeNotifications`; the service walks GPE status/enable bytes, evaluates
`\_GPE._Lxx`/`_Exx` per active bit, maps notified nodes to events
(battery/ac/lid/generic), clears GPE_STS write-1, acks. EC `_Qxx` out.
Host unit test with hand-encoded AML proves the queue; aml.zig joined the
`zig build test` loop. QEMU raises no GPEs — suite is regression net,
59/59).
- [ ] **M21.3** — orderly shutdown: init keeps child ids (spawnSupervised +
exit endpoint), binds signals, subscribes to `.power`; on `power_button`
logs `init: shutting down`, runs `stop(child, 2000, endpoint)` in