From 75884ca6b819feee2fb103180ce10869bbf2ad7a Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 15 Aug 2024 23:13:32 +0300 Subject: [PATCH] Kernel/AML: Allow calling method through named objects --- kernel/kernel/ACPI/AML/Node.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/kernel/kernel/ACPI/AML/Node.cpp b/kernel/kernel/ACPI/AML/Node.cpp index 59b6948d..1c0609bd 100644 --- a/kernel/kernel/ACPI/AML/Node.cpp +++ b/kernel/kernel/ACPI/AML/Node.cpp @@ -222,10 +222,16 @@ namespace Kernel::ACPI AML_ERROR("NameString {} not found in namespace", name_string.value()); 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); - auto* method = static_cast(aml_object.ptr()); + auto* method = static_cast( + aml_object->type == AML::Node::Type::Method + ? aml_object.ptr() + : underlying.ptr() + ); BAN::Array, 7> args; for (uint8_t i = 0; i < method->arg_count; i++)