From f90dc6c1212ce9c6884c7cb2214ea7bde1ab18e7 Mon Sep 17 00:00:00 2001 From: Daniel Samson <12231216+daniel-samson@users.noreply.github.com> Date: Wed, 22 Jul 2026 20:49:07 +0100 Subject: [PATCH] =?UTF-8?q?reorg:=20begin=20library/protocol/=20=E2=80=94?= =?UTF-8?q?=20move=20block=20+=20usb-transfer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Start the protocol tree: wire protocols move to library/protocol//, entry file -protocol.zig, module name unchanged. block and usb-transfer are pure moves — every consumer already imports them by module name, so only the b.addModule paths change and the empty system/services/block/ is removed. block-protocol -> library/protocol/block/block-protocol.zig usb-transfer-protocol -> library/protocol/usb-transfer/usb-transfer-protocol.zig zig build + test green. --- build.zig | 4 ++-- .../protocol/block/block-protocol.zig | 0 .../protocol/usb-transfer}/usb-transfer-protocol.zig | 0 system/services/device-manager/device-manager.zig | 8 ++++++++ 4 files changed, 10 insertions(+), 2 deletions(-) rename system/services/block/protocol.zig => library/protocol/block/block-protocol.zig (100%) rename {system/drivers/usb-xhci-bus => library/protocol/usb-transfer}/usb-transfer-protocol.zig (100%) diff --git a/build.zig b/build.zig index 562938a..e609877 100644 --- a/build.zig +++ b/build.zig @@ -314,12 +314,12 @@ pub fn build(b: *std.Build) void { // driver to drive its device (open / control / interrupt / bulk). A protocol // module like vfs-protocol, shared by the bus driver and every class driver. const usb_transfer_protocol_module = b.addModule("usb-transfer-protocol", .{ - .root_source_file = b.path("system/drivers/usb-xhci-bus/usb-transfer-protocol.zig"), + .root_source_file = b.path("library/protocol/usb-transfer/usb-transfer-protocol.zig"), }); // The block-device protocol: read/write of fixed-size blocks, spoken between a // filesystem and a block driver (usb-storage). A protocol module like the rest. const block_protocol_module = b.addModule("block-protocol", .{ - .root_source_file = b.path("system/services/block/protocol.zig"), + .root_source_file = b.path("library/protocol/block/block-protocol.zig"), }); // Kernel tunables (maximum_cpus, stack sizes, tick rate). A dependency-free module of diff --git a/system/services/block/protocol.zig b/library/protocol/block/block-protocol.zig similarity index 100% rename from system/services/block/protocol.zig rename to library/protocol/block/block-protocol.zig diff --git a/system/drivers/usb-xhci-bus/usb-transfer-protocol.zig b/library/protocol/usb-transfer/usb-transfer-protocol.zig similarity index 100% rename from system/drivers/usb-xhci-bus/usb-transfer-protocol.zig rename to library/protocol/usb-transfer/usb-transfer-protocol.zig diff --git a/system/services/device-manager/device-manager.zig b/system/services/device-manager/device-manager.zig index 0623b99..fd4c000 100644 --- a/system/services/device-manager/device-manager.zig +++ b/system/services/device-manager/device-manager.zig @@ -42,6 +42,13 @@ const virtio_gpu_pci_class: u64 = pci_class.ClassCode.pack(.{ .prog_if = 0, }); + +const vga_compatible_gpu_pci_class: u64 = pci_class.ClassCode.pack(.{ + .base = @intFromEnum(pci_class.BaseClass.display), + .subclass = @intFromEnum(pci_class.display.SubClass.vga_compatible), + .prog_if = 0, +}); + /// The driver that serves a *reported* PCI function (M19.3: matching moved /// from the boot snapshot to the bus reports), or null. A machine can carry /// several identical controllers — one driver instance per reported device, @@ -49,6 +56,7 @@ const virtio_gpu_pci_class: u64 = pci_class.ClassCode.pack(.{ fn pciDriverForIdentity(identity: u64) ?[]const u8 { return switch (identity) { xhci_pci_class => "/system/drivers/usb-xhci-bus", + vga_compatible_gpu_pci_class => "/system/drivers/display", virtio_gpu_pci_class => "/system/drivers/virtio-gpu", else => null, };