Files
RedBear-OS/local
vasilito 5d06b0fa03 quirks: ACPI DMI infrastructure (R11 part 1)
Phase R11 (2026-06-07) — ACPI DMI rules first commit. Lands
the infrastructure pieces (flag type, rule struct,
TOML parser, lookup function) needed for runtime ACPI
quirk matching against system DMI data. The data side
arrives in the follow-up commit (four quirks.d/*.toml
files).

Changes:

  1. AcpiQuirkFlags bitflags (mod.rs:225) with 13 bits
     sourced from Linux 7.1:
       OSI_DISABLE_{LINUX,VISTA,WIN7,WIN8}  — drivers/acpi/osi.c
       SLEEP_{OLD_ORDERING,NVS_NOSAVE,DEFAULT_S3} — drivers/acpi/sleep.c
       LID_INIT_{DISABLED,OPEN}              — drivers/acpi/button.c
       BATTERY_{BIX_BROKEN_PACKAGE,
                 NOTIFICATION_DELAY,
                 AC_IS_BROKEN}                — drivers/acpi/battery.c
       REV_OVERRIDE                          — drivers/acpi/x86/blacklist.c

  2. DmiAcpiQuirkRule (dmi.rs:476) — DMI match + flag word,
     mirrors the existing DmiXhciQuirkRule shape.

  3. DMI_ACPI_QUIRK_RULES — empty compiled-in table for now;
     runtime TOML is the data surface (R11 part 2). The
     constant exists so the three-layer lookup shape is
     stable from day one.

  4. load_dmi_acpi_quirks() — reads live SMBIOS, applies
     compiled-in + TOML rules, returns AcpiQuirkFlags.
     Pattern mirrors load_dmi_xhci_quirks (R7-B).

  5. apply_dmi_acpi_quirk_rules() — pure function, OR-
     accumulates matching rules. Mirrors
     apply_dmi_xhci_quirk_rules.

  6. ACPI_FLAG_NAMES + parse_dmi_acpi_toml + load_dmi_acpi_quirks
     in toml_loader.rs. New TOML table type
     [[dmi_acpi_quirk]] with  sub-table +
     array of strings.

  7. Two unit tests in dmi.rs: empty result for no match,
     OR-accumulation for partial match (one rule fires
     one flag, the other fires another — both must land).

cargo test: 122/122 (was 120, +2 for the new tests).
cargo check: clean.
cargo clippy: no new warnings in this code.

The data side (46-acpi-sleep.toml, 47-acpi-button.toml,
48-acpi-battery.toml) lands in the follow-up commit.
2026-06-07 21:25:01 +03:00
..