quirks/dmi: warn once when /scheme/acpi/dmi is absent (Gap 17)

The Phase R10 audit found that dmi::read_dmi_info() returns Err(())
silently when acpid is not yet serving the DMI endpoint (the deep
Blocker 2 work that wires acpid SMBIOS Type 0/1/2 parsing into a
kernel-exposed scheme). Without an explicit log, every DMI lookup
in every driver fails opaquely, masking the root cause for anyone
triaging missing quirk rules.

The log is rate-limited to a single warn! per process lifetime via
a static AtomicBool, so the boot log is not flooded even when many
drivers call read_dmi_info() during enumeration. The 120/120 unit
tests in redox-driver-sys continue to pass.
This commit is contained in:
Red Bear OS Builder
2026-06-07 15:05:29 +03:00
parent 9a28b68ef8
commit abce96f1e0
@@ -171,13 +171,28 @@ pub struct DmiXhciQuirkRule {
/// Read DMI/SMBIOS data from the ACPI scheme.
///
/// Returns `Err(())` if DMI data is not available (e.g., early boot,
/// no SMBIOS table, or acpid not running).
/// Returns `Err(())` if DMI data is not available. Phase R10 audit
/// (2026-06-07) — emits a single `log::warn!` per process on the first
/// failure, so the absence of `/scheme/acpi/dmi` is visible in the
/// boot log instead of silently producing empty DMI matches on every
/// lookup.
pub fn read_dmi_info() -> Result<DmiInfo, ()> {
use std::sync::atomic::{AtomicBool, Ordering};
static WARNED: AtomicBool = AtomicBool::new(false);
let dmi_path = "/scheme/acpi/dmi";
match std::fs::read_to_string(dmi_path) {
Ok(data) => parse_dmi_data(&data),
Err(_) => Err(()),
Err(e) => {
if !WARNED.swap(true, Ordering::Relaxed) {
log::warn!(
"quirks: cannot read DMI from {dmi_path}: {e}; \
acpid DMI producer is not serving data, \
all DMI-based rules are inert"
);
}
Err(())
}
}
}