kernel: flatten the device/discovery code, merge power into acpi, rename fdt

Follow-up cleanup of the just-moved kernel device code:

- power.zig -> acpi.zig. Its reboot() is built entirely on the FADT reset
  register (acpi.power_information) plus the legacy 0xCF9/8042 fallbacks — it is
  ACPI reboot, so it becomes acpi.reboot (the "P" in ACPI). platform.reboot
  still delegates; soft-off/S5 stays the ring-3 acpi service's job as before.

- device-tree.zig -> fdt.zig. It is a discovery *backend* (the ARM/FDT parser,
  a sibling of acpi.zig), not part of the model — renaming it to its actual
  subject kills the confusing device-tree / device-model DeviceTree name clash
  and makes acpi.zig + fdt.zig read as the two parallel backends.

- Flatten: device-model.zig, acpi.zig, fdt.zig, platform.zig move out of the
  system/kernel/devices/ subdir up into system/kernel/, joining devices-broker.zig
  (already flat). The kernel dir is a flat pile by convention (only architecture/
  is a subdir), so the subdir — and its poor "devices" name — is gone.

Pure restructure; "platform" module name unchanged, all cross-file deps are
relative siblings that moved together. zig build + test green; smoke, discovery,
acpi-parse, acpi-ps2, acpi-report, power-button, orderly-shutdown, reboot pass.
This commit is contained in:
Daniel Samson
2026-07-22 21:49:20 +01:00
parent 3a155cdc7d
commit 11f567ee20
12 changed files with 67 additions and 72 deletions
+16
View File
@@ -0,0 +1,16 @@
//! Device-tree (Flattened Device Tree / FDT) discovery backend — stub.
//!
//! This is the second backend the platform facade dispatches to, for machines
//! that describe hardware with a device-tree blob instead of ACPI (typically
//! ARM). It is intentionally unimplemented: the bootloader has no DTB handoff
//! field yet, so this path is currently unreachable. It exists so the facade
//! already routes to a backend rather than hard-coding ACPI — wiring the FDT
//! parser in later is a local change here, not an architectural one.
const device_model = @import("device-model.zig");
/// Populate `device_tree` from a device-tree blob. Not implemented yet.
pub fn discover(device_tree: *device_model.DeviceTree) !void {
_ = device_tree;
return error.Unsupported;
}