fix / debug

This commit is contained in:
Daniel Samson
2026-07-13 05:41:05 +01:00
parent d71a5f25d3
commit 3ec14509a0
8 changed files with 100 additions and 100 deletions
+10 -10
View File
@@ -72,16 +72,16 @@ pub fn main(init: runtime.process.Init) void {
const expected: ?usize = if (init.arguments.get(1)) |a| (std.fmt.parseInt(usize, a, 10) catch null) else null;
const buffer = runtime.allocator().alloc(device.DeviceDescriptor, 64) catch {
_ = runtime.system.write("system/services/acpi: out of memory\n");
_ = runtime.system.write("/system/services/acpi: out of memory\n");
return;
};
const node = findTablesNode(buffer) orelse {
_ = runtime.system.write("system/services/acpi: no acpi-tables node to claim\n");
_ = runtime.system.write("/system/services/acpi: no acpi-tables node to claim\n");
return;
};
node_id = node.id;
if (!device.claim(node_id)) {
_ = runtime.system.write("system/services/acpi: unable to claim acpi-tables\n");
_ = runtime.system.write("/system/services/acpi: unable to claim acpi-tables\n");
return;
}
@@ -103,17 +103,17 @@ pub fn main(init: runtime.process.Init) void {
if (block_count == blocks.len) break;
}
if (block_count == 0) {
_ = runtime.system.write("system/services/acpi: no AML blobs on the node\n");
_ = runtime.system.write("/system/services/acpi: no AML blobs on the node\n");
return;
}
const result = aml.parse(runtime.allocator(), blocks[0..block_count]) catch {
_ = runtime.system.write("system/services/acpi: AML parse failed\n");
_ = runtime.system.write("/system/services/acpi: AML parse failed\n");
return;
};
var namespace = result.namespace;
const devices = aml.deviceCount(&namespace);
writeLine("system/services/acpi: parsed {d} AML blob(s), {d} namespace devices\n", .{ block_count, devices });
writeLine("/system/services/acpi: parsed {d} AML blob(s), {d} namespace devices\n", .{ block_count, devices });
if (expected) |want| {
if (devices == want) {
_ = runtime.system.write("acpi-parse: ok\n");
@@ -150,9 +150,9 @@ pub fn main(init: runtime.process.Init) void {
const hid = entry.hid[0..entry.hid_len];
const desc = acpi_ids.description(hid);
if (desc.len != 0)
writeLine("system/services/acpi: reported {s} (device {d}, {d} resources) — {s}\n", .{ hid, entry.device_id, entry.resource_count, desc })
writeLine("/system/services/acpi: reported {s} (device {d}, {d} resources) — {s}\n", .{ hid, entry.device_id, entry.resource_count, desc })
else
writeLine("system/services/acpi: reported {s} (device {d}, {d} resources)\n", .{ hid, entry.device_id, entry.resource_count });
writeLine("/system/services/acpi: reported {s} (device {d}, {d} resources)\n", .{ hid, entry.device_id, entry.resource_count });
if (manager) |h| {
var report = protocol.ChildAdded{
.parent = node_id,
@@ -165,7 +165,7 @@ pub fn main(init: runtime.process.Init) void {
_ = runtime.ipc.call(h, std.mem.asBytes(&report), &reply) catch {};
}
}
writeLine("system/services/acpi: reported {d} device(s) to the manager\n", .{registered_count});
writeLine("/system/services/acpi: reported {d} device(s) to the manager\n", .{registered_count});
// Stay resident: the claim holds, and the service is here to grow into the
// supervised discoverer (M20.3, then the M21 event side on the SCI).
@@ -207,7 +207,7 @@ fn registerDevice(node: *aml.Node, hid: [8]u8, interpreter: *aml.Interpreter) vo
applyCrs(&descriptor, node, interpreter);
const id = device.register(node_id, &descriptor) orelse {
writeLine("system/services/acpi: register refused for {s}\n", .{hid[0..@intCast(hid_len)]});
writeLine("/system/services/acpi: register refused for {s}\n", .{hid[0..@intCast(hid_len)]});
return;
};
registered[registered_count] = .{ .hid = hid, .hid_len = @intCast(hid_len), .device_id = id, .resource_count = descriptor.resource_count };