reorg: move power-protocol to library/protocol; finish the protocol tree
power-protocol -> library/protocol/power/power-protocol.zig. Its two consumers (init and the acpi discovery service) import it directly; the runtime.power_protocol re-export and the runtime module import are dropped (no runtime client speaks it). The now-empty system/services/power/ is removed. This completes library/protocol/: every driver<->service wire contract lives there and is imported by module name, no protocol is re-exported through runtime, and the alias chaos (dp/sp, mixed protocol/<x>_protocol) is resolved. virtio-gpu-protocol stays a driver-private relative import (a hardware command set, not a driver<->service seam — like virtio-pci.zig beside it). zig build + test green; power-button, orderly-shutdown pass.
This commit is contained in:
@@ -420,11 +420,11 @@ pub fn build(b: *std.Build) void {
|
||||
.root_source_file = b.path("library/protocol/scanout/scanout-protocol.zig"),
|
||||
});
|
||||
|
||||
// The power protocol: system power's domain-named surface (docs/power.md).
|
||||
// The power protocol: system power's domain-named surface (docs/power.md). No runtime
|
||||
// client speaks it — imported directly by init and the acpi discovery service.
|
||||
const power_protocol_module = b.addModule("power-protocol", .{
|
||||
.root_source_file = b.path("system/services/power/protocol.zig"),
|
||||
.root_source_file = b.path("library/protocol/power/power-protocol.zig"),
|
||||
});
|
||||
runtime_module.addImport("power-protocol", power_protocol_module);
|
||||
|
||||
// Typed volatile MMIO register access + memory-ordering barriers, for drivers on
|
||||
// top of an mmio_map grant. Depends only on `builtin` (arch-conditional barriers);
|
||||
@@ -530,6 +530,7 @@ pub fn build(b: *std.Build) void {
|
||||
// linked into the kernel's user region against the `runtime` runtime library, and
|
||||
// started in ring 3 by the kernel's user-ELF loader.
|
||||
const init_exe = addUserBinary(b, kernel_target, runtime_module, mmio_module, xkeyboard_config_module, acpi_ids_module, "init", "system/services/init/init.zig");
|
||||
programModule(init_exe).addImport("power-protocol", power_protocol_module);
|
||||
// init reads the same `serial` flag the kernel does: its liveness heartbeat is a
|
||||
// serial/test-build diagnostic (the QEMU harness's init tests assert on it, and
|
||||
// -Dserial images emit it), so a flashable image runs a purely event-driven PID 1
|
||||
@@ -618,6 +619,7 @@ pub fn build(b: *std.Build) void {
|
||||
const discovery_exe = addUserBinary(b, kernel_target, runtime_module, mmio_module, xkeyboard_config_module, acpi_ids_module, "discovery", discovery_source);
|
||||
if (discovery == .acpi) programModule(discovery_exe).addImport("aml", aml_module);
|
||||
if (discovery == .acpi) programModule(discovery_exe).addImport("device-manager-protocol", device_manager_protocol_module);
|
||||
if (discovery == .acpi) programModule(discovery_exe).addImport("power-protocol", power_protocol_module);
|
||||
const device_manager_exe = addUserBinary(b, kernel_target, runtime_module, mmio_module, xkeyboard_config_module, acpi_ids_module, "device-manager", "system/services/device-manager/device-manager.zig");
|
||||
// Names the xHCI PCI class triple from the shared taxonomy instead of a bare 0x0C0330.
|
||||
programModule(device_manager_exe).addImport("pci-class", pci_class_module);
|
||||
|
||||
@@ -24,9 +24,6 @@ pub const start = @import("start.zig");
|
||||
/// protocol itself is the library/protocol/device-manager module, imported
|
||||
/// directly by drivers and services that speak it.
|
||||
pub const device_manager = @import("device-manager.zig");
|
||||
|
||||
/// The power protocol: events (button, lid, battery) + shutdown (docs/power.md).
|
||||
pub const power_protocol = @import("power-protocol");
|
||||
/// Keyboard-event listening (subscribe/next) and broadcasting (publish), over the input
|
||||
/// service. See library/runtime/input.zig and system/services/input/.
|
||||
pub const input = @import("input.zig");
|
||||
|
||||
@@ -16,7 +16,7 @@ const aml = @import("aml");
|
||||
const acpi_ids = @import("acpi-ids");
|
||||
const device = runtime.device;
|
||||
const protocol = @import("device-manager-protocol");
|
||||
const power = runtime.power_protocol;
|
||||
const power = @import("power-protocol");
|
||||
/// AML opcode/prefix bytes by name (`zero_opcode`, `byte_prefix`, …) — so the `_HID`
|
||||
/// integer decode names the opcodes instead of bare 0x0A/0x0B/… (docs/coding-standards.md).
|
||||
const opcodes = aml.opcodes;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
const std = @import("std");
|
||||
const runtime = @import("runtime");
|
||||
const power = runtime.power_protocol;
|
||||
const power = @import("power-protocol");
|
||||
const build_options = @import("build_options");
|
||||
|
||||
/// The system services init brings up at boot, in order, by binary path. This is
|
||||
|
||||
Reference in New Issue
Block a user