diff --git a/build.zig b/build.zig index b2b65dc..bd6cec8 100644 --- a/build.zig +++ b/build.zig @@ -278,7 +278,7 @@ pub fn build(b: *std.Build) void { }); // The devices sub-project's public interface (the flat wire types), exposed as // its own module like vfs-protocol — importable by user space, unlike the - // kernel-internal device model it also feeds (system/devices/device-model.zig). + // kernel-internal device model it also feeds (system/kernel/devices/device-model.zig). const device_abi_module = b.addModule("device-abi", .{ .root_source_file = b.path("library/device/model/device-abi.zig"), }); @@ -351,9 +351,9 @@ pub fn build(b: *std.Build) void { // "platform" and asks it to enumerate hardware into a backend-neutral device // tree, never naming ACPI (or, later, device-tree) — the same discipline the // architecture module applies to CPU code. The backend is selected at runtime from - // the boot handoff (see system/devices/platform.zig). + // the boot handoff (see system/kernel/devices/platform.zig). const platform_module = b.addModule("platform", .{ - .root_source_file = b.path("system/devices/platform.zig"), + .root_source_file = b.path("system/kernel/devices/platform.zig"), .imports = &.{ .{ .name = "boot-handoff", .module = boot_handoff_module }, // BootInformation (carries the ACPI RSDP), physicalToVirtual .{ .name = "abi", .module = abi_module }, // acpi.zig works in page_size units diff --git a/docs/README.md b/docs/README.md index 5581d5e..dfa9a00 100644 --- a/docs/README.md +++ b/docs/README.md @@ -238,8 +238,9 @@ system/ → /system danos's own internals (the self-representation) parameters.zig initial-ramdisk.zig shared contracts kernel/ IPC, memory, scheduling, the VFS root, the private syscall dispatch architecture/x86_64/ the `architecture` module (never named by generic code) - devices/ the kernel-internal device model (device-model, platform, - acpi, device-tree, power) that /system/devices reflects + devices/ the kernel-internal device model + firmware discovery + (device-model, platform, acpi, device-tree, power) — the + implementation of the device tree /system/devices reflects drivers/ pci-bus/ ps2-bus/ usb-xhci-bus/ one sub-project per driver → /system/drivers services/ init/ fat/ device-manager/ system servers → /system/services (fat/ holds fat.zig, engine.zig, on-disk.zig) @@ -299,7 +300,7 @@ exception in [coding-standards.md](coding-standards.md) applies to that seam. | VFS root: mount table + kernel-served nodes (`fs_resolve`/`fs_node`); wire protocol in `library/protocol/vfs/vfs-protocol.zig` | `system/kernel/vfs.zig` | | Device tree + claim capability + `device_register` containment | `system/kernel/devices-broker.zig` | | IRQ-as-IPC: routing a device interrupt to a driver's endpoint | `system/kernel/irq.zig` | -| Hardware discovery (ACPI/device tree) behind one neutral device model | `system/devices/` | +| Hardware discovery (ACPI/device tree) behind one neutral device model | `system/kernel/devices/` | | Framebuffer text console (mirrors to serial) | `system/kernel/console.zig` | | In-kernel test cases | `system/kernel/tests.zig` | | Arch-specific kernel code (`halt`, GDT/IDT/TSS, exception + interrupt stubs, page tables, APIC/IO-APIC/timer, serial, linker script) | `system/kernel/architecture/x86_64/` | diff --git a/docs/acpi.md b/docs/acpi.md index 588937b..e73024e 100644 --- a/docs/acpi.md +++ b/docs/acpi.md @@ -19,10 +19,10 @@ UEFI configuration table BootInformation.acpi_rsdp (u64, in the loader↔kernel handoff) system/boot-handoff.zig │ the kernel forwards the whole BootInformation ▼ -platform.discover(boot_information, …) system/devices/platform.zig +platform.discover(boot_information, …) system/kernel/devices/platform.zig │ reads boot_information.acpi_rsdp, hands it to the ACPI backend ▼ -acpi.discover(rsdp_phys, …) system/devices/acpi.zig +acpi.discover(rsdp_phys, …) system/kernel/devices/acpi.zig │ dereferences the RSDP, reads the pointer it contains ▼ RSDP ──(a field in the struct)──► RSDT / XSDT ──► SDTs (MADT, MCFG, FADT, HPET, DSDT…) diff --git a/docs/power.md b/docs/power.md index 70cb2fe..1d790f0 100644 --- a/docs/power.md +++ b/docs/power.md @@ -92,7 +92,7 @@ fails rather than hangs. `acpi-tables` node ([discovery.md](discovery.md)) already put the PM1 control ports in the acpi service's hands, so writing S5 from ring 3 is something it could physically already do; formalizing it as a protocol operation added a -contract, not authority. The kernel's `system/devices/power.zig` keeps only +contract, not authority. The kernel's `system/kernel/devices/power.zig` keeps only **reboot** (the FADT reset register plus the legacy fallbacks, which need no AML); it has no poweroff path at all — S5 is not a kernel operation. diff --git a/docs/system-requirements.md b/docs/system-requirements.md index e9efb16..558313a 100644 --- a/docs/system-requirements.md +++ b/docs/system-requirements.md @@ -115,7 +115,7 @@ hypervisor configured for UEFI firmware and an xHCI USB controller. (`efi.zig:790`, `boot-handoff.zig:149`) - **Required ACPI tables:** MADT (interrupt topology), MCFG (PCIe ECAM base), FADT (power / PM timer). Optionally consumed: HPET, DMAR, SPCR. - (`system/devices/acpi.zig:3`) + (`system/kernel/devices/acpi.zig:3`) - The loader reads `/system/kernel` off the FAT boot volume, then loads user space: a prebuilt `boot\system.img` capsule ([system-image.md](system-image.md)) when present, otherwise it walks @@ -221,7 +221,7 @@ named for reporting only; internal SATA / NVMe / IDE disks have no driver. first VT-d DRHD unit and its capabilities are exposed via `PlatformInformation` (`iommu_present`, `iommu_base`, `iommu_version`). No DMA-remapping tables are programmed and no translation is enforced. An IOMMU is therefore **not required** -and does not currently constrain devices. (`system/devices/acpi.zig:96`) +and does not currently constrain devices. (`system/kernel/devices/acpi.zig:96`) ## What is explicitly NOT supported diff --git a/library/device/model/device-abi.zig b/library/device/model/device-abi.zig index 26cd6de..9d002d8 100644 --- a/library/device/model/device-abi.zig +++ b/library/device/model/device-abi.zig @@ -6,7 +6,7 @@ //! by name, and neither reaches into the other's files. //! //! It is also the **single source of truth** for `DeviceClass` and `ResourceKind`: -//! the kernel's rich, pointer-based device tree (system/devices/device-model.zig, +//! the kernel's rich, pointer-based device tree (system/kernel/devices/device-model.zig, //! which user space must never import) re-exports these, so the enum that a driver //! matches on and the enum the kernel classifies with are the *same* type — no //! hand-kept "mirror in order" to drift. The core kernel↔user ABI is [[abi]]; the diff --git a/system/abi.zig b/system/abi.zig index 18adda2..47f53b6 100644 --- a/system/abi.zig +++ b/system/abi.zig @@ -13,7 +13,7 @@ //! //! This is the *core* contract; the device half — `DeviceDescriptor` and friends, which //! also cross this boundary — lives with the device sub-project as [[device-abi]] -//! (system/devices/device-abi.zig). The loader↔kernel handoff is [[boot-handoff]]. +//! (library/device/model/device-abi.zig). The loader↔kernel handoff is [[boot-handoff]]. /// Page size every `mmap`/`munmap` grant and the boot memory map are measured in. /// 4 KiB on every architecture danos targets so far. Part of the ABI because the diff --git a/system/boot-handoff.zig b/system/boot-handoff.zig index 5480b79..b48db84 100644 --- a/system/boot-handoff.zig +++ b/system/boot-handoff.zig @@ -5,7 +5,7 @@ //! //! Both binaries import this as the `boot-handoff` module, so the layout is defined //! in exactly one place. **User space never sees this** — the kernel↔user contract is -//! [[abi]] (system/abi.zig); device types are [[device-abi]] (system/devices/device-abi.zig). +//! [[abi]] (system/abi.zig); device types are [[device-abi]] (library/device/model/device-abi.zig). const std = @import("std"); diff --git a/system/devices/acpi.zig b/system/kernel/devices/acpi.zig similarity index 100% rename from system/devices/acpi.zig rename to system/kernel/devices/acpi.zig diff --git a/system/devices/device-model.zig b/system/kernel/devices/device-model.zig similarity index 100% rename from system/devices/device-model.zig rename to system/kernel/devices/device-model.zig diff --git a/system/devices/device-tree.zig b/system/kernel/devices/device-tree.zig similarity index 100% rename from system/devices/device-tree.zig rename to system/kernel/devices/device-tree.zig diff --git a/system/devices/platform.zig b/system/kernel/devices/platform.zig similarity index 100% rename from system/devices/platform.zig rename to system/kernel/devices/platform.zig diff --git a/system/devices/power.zig b/system/kernel/devices/power.zig similarity index 100% rename from system/devices/power.zig rename to system/kernel/devices/power.zig