acpi: discovery is handed its node like every other driver
The last claimant. The kernel seeds the acpi-tables node, so it sits in the same boot snapshot the manager already scans to find the PCI host bridge — there was never a bootstrap problem, only a lookup nobody had written. The manager claims it and names it in the spawn; the service stops claiming. Every driver in the system now receives its hardware rather than taking it. Two failures on the way, both mine. addDriver puts the device id in argv[1], and the acpi service read argv[1] as a self-verify device-count floor — so handed device 7 it decided it was in test mode, printed "acpi-parse: ok", and never reported a device. The test argument is now floor:N, which a bare id cannot be mistaken for. And acpi-parse spawns the service directly rather than through the manager, so nothing handed it the node. That test now claims and transfers it exactly as the manager does, which is the right shape: the test plays the manager's role instead of the service reaching for hardware. device_claim now has two callers left: the manager, which is the acquirer and should have it, and the display service's GOP path. That is recorded as question 10 — the framebuffer is not a device, so the answer is likely that it leaves the device table rather than being exempted from its rules. Suite 118/118.
This commit is contained in:
@@ -257,6 +257,7 @@ const delegated_drivers = [_][]const u8{
|
||||
"pci-bus",
|
||||
"virtio-gpu",
|
||||
"ps2-bus",
|
||||
"discovery",
|
||||
};
|
||||
|
||||
/// Matched on the **last path component**, because a driver reaches this table under
|
||||
@@ -420,6 +421,18 @@ fn initialise(endpoint: ipc.Handle) bool {
|
||||
const total = device.enumerate(buffer);
|
||||
const count = @min(total, buffer.len);
|
||||
|
||||
// The node discovery needs: the kernel seeds it, so it is in this same snapshot
|
||||
// and can be handed over like any other assignment. Discovery used to find and
|
||||
// claim it itself — the last driver that acquired hardware by naming it rather
|
||||
// than being given it (docs/os-development/device-authority.md).
|
||||
var tables_node: u64 = device_manager_protocol.no_device;
|
||||
for (buffer[0..count]) |descriptor| {
|
||||
if (descriptor.class == @intFromEnum(device.DeviceClass.acpi_tables)) {
|
||||
tables_node = descriptor.id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var matched: usize = 0;
|
||||
for (buffer[0..count]) |descriptor| {
|
||||
if (descriptor.class == @intFromEnum(device.DeviceClass.pci_host_bridge)) {
|
||||
@@ -441,7 +454,7 @@ fn initialise(endpoint: ipc.Handle) bool {
|
||||
// under the neutral name "discovery", spawned once at startup. It finds and
|
||||
// claims the acpi-tables (or devicetree-blob) node itself. Not a per-device
|
||||
// match — it is the discoverer, not a driver bound to one device.
|
||||
addDriver("discovery", device_manager_protocol.no_device, false);
|
||||
addDriver("discovery", tables_node, false);
|
||||
|
||||
if (test_restart_mode) {
|
||||
// The driver-restart scenario's fixture: claims device 0 (the tree
|
||||
|
||||
Reference in New Issue
Block a user