Kernel/AML: Allow calling method through named objects

This commit is contained in:
Bananymous 2024-08-15 23:13:32 +03:00
parent d729d7f570
commit 75884ca6b8
1 changed files with 8 additions and 2 deletions

View File

@ -222,10 +222,16 @@ namespace Kernel::ACPI
AML_ERROR("NameString {} not found in namespace", name_string.value()); AML_ERROR("NameString {} not found in namespace", name_string.value());
return ParseResult::Failure; return ParseResult::Failure;
} }
if (aml_object->type != AML::Node::Type::Method)
auto underlying = aml_object->to_underlying();
if (aml_object->type != AML::Node::Type::Method && underlying->type != AML::Node::Type::Method)
return ParseResult(aml_object); return ParseResult(aml_object);
auto* method = static_cast<AML::Method*>(aml_object.ptr()); auto* method = static_cast<AML::Method*>(
aml_object->type == AML::Node::Type::Method
? aml_object.ptr()
: underlying.ptr()
);
BAN::Array<BAN::RefPtr<AML::Node>, 7> args; BAN::Array<BAN::RefPtr<AML::Node>, 7> args;
for (uint8_t i = 0; i < method->arg_count; i++) for (uint8_t i = 0; i < method->arg_count; i++)