Kernel: Cleanup AML debug dump output

This commit is contained in:
Bananymous 2024-04-17 15:35:42 +03:00
parent 956335e844
commit da0c45b7ee
6 changed files with 31 additions and 10 deletions

View File

@ -22,7 +22,7 @@ namespace Kernel::ACPI::AML
{
if (path.size() < canonical_path->size() + 1)
continue;
if (path[canonical_path->size()] != '.')
if (canonical_path->size() != 1 && path[canonical_path->size()] != '.')
continue;
if (path.sv().substring(0, canonical_path->size()) != canonical_path->sv())
continue;

View File

@ -102,11 +102,13 @@ namespace Kernel::ACPI::AML
AML_DEBUG_PRINTLN("");
for (const auto& element : elements)
{
AML_DEBUG_PRINT_INDENT(indent + 1);
if (element)
element->debug_print(0);
element->debug_print(indent + 1);
else
{
AML_DEBUG_PRINT_INDENT(indent + 1);
AML_DEBUG_PRINT("Uninitialized");
}
AML_DEBUG_PRINTLN("");
}
AML_DEBUG_PRINT_INDENT(indent);

View File

@ -68,7 +68,16 @@ namespace Kernel::ACPI::AML
virtual void debug_print(int indent) const override
{
AML_DEBUG_PRINT_INDENT(indent);
AML_DEBUG_PRINT("Processor {} (ID: {}, PBlkAddr: 0x{H}, PBlkLen: {})", name, id, pblk_addr, pblk_len);
AML_DEBUG_PRINTLN("Processor {} (ID: {}, PBlkAddr: 0x{H}, PBlkLen: {}) {", name, id, pblk_addr, pblk_len);
Namespace::root_namespace()->for_each_child(scope,
[&](const auto&, const auto& child)
{
child->debug_print(indent + 1);
AML_DEBUG_PRINTLN("");
}
);
AML_DEBUG_PRINT_INDENT(indent);
AML_DEBUG_PRINT("}");
}
};

View File

@ -46,7 +46,16 @@ namespace Kernel::ACPI::AML
virtual void debug_print(int indent) const override
{
AML_DEBUG_PRINT_INDENT(indent);
AML_DEBUG_PRINT("ThermalZone {}", name);
AML_DEBUG_PRINT("ThermalZone {} {", name);
Namespace::root_namespace()->for_each_child(scope,
[&](const auto&, const auto& child)
{
child->debug_print(indent + 1);
AML_DEBUG_PRINTLN("");
}
);
AML_DEBUG_PRINT_INDENT(indent);
AML_DEBUG_PRINT("}");
}
};

View File

@ -33,8 +33,10 @@ namespace Kernel::ACPI
void AML::Name::debug_print(int indent) const
{
AML_DEBUG_PRINT_INDENT(indent);
AML_DEBUG_PRINT("Name {} { ", name);
object->debug_print(0);
AML_DEBUG_PRINTLN("Name {} { ", name);
object->debug_print(indent + 1);
AML_DEBUG_PRINTLN("");
AML_DEBUG_PRINT_INDENT(indent);
AML_DEBUG_PRINT("}");
}

View File

@ -28,11 +28,10 @@ namespace Kernel::ACPI
LockGuard _(m_object_mutex);
AML_DEBUG_PRINT_INDENT(indent);
AML_DEBUG_PRINTLN("Namespace {} {", name);
for (auto& [path, child] : m_objects)
{
for_each_child(scope, [&](const auto&, const auto& child) {
child->debug_print(indent + 1);
AML_DEBUG_PRINTLN("");
}
});
AML_DEBUG_PRINT_INDENT(indent);
AML_DEBUG_PRINT("}");
}