Kernel: Fix and add some AML to_underlying functions

This commit is contained in:
Bananymous 2024-08-18 20:44:51 +03:00
parent 8902032b42
commit 0fa16cf982
3 changed files with 14 additions and 2 deletions

View File

@ -67,7 +67,7 @@ namespace Kernel::ACPI::AML
return ParseResult::Failure;
}
auto package_element = package->elements[index];
result = MUST(BAN::RefPtr<AML::Reference>::create(package_element));
result = MUST(BAN::RefPtr<AML::Reference>::create(package_element->to_underlying()));
break;
}
case AML::Node::Type::String:

View File

@ -92,6 +92,18 @@ namespace Kernel::ACPI::AML
return element->convert(mask);
}
BAN::RefPtr<AML::Node> to_underlying() override
{
if (!initialized)
{
AML_ERROR("Trying to store into uninitialized PackageElement");
return {};
}
if (!resolved && !resolve())
return {};
return element;
}
BAN::RefPtr<AML::Node> store(BAN::RefPtr<AML::Node> node) override
{
if (!initialized)

View File

@ -12,7 +12,7 @@ namespace Kernel::ACPI::AML
Register();
Register(BAN::RefPtr<AML::Node> node);
BAN::RefPtr<AML::Node> to_underlying() override { return value; }
BAN::RefPtr<AML::Node> to_underlying() override { return value->to_underlying(); }
BAN::RefPtr<AML::Node> convert(uint8_t mask) override;
BAN::RefPtr<AML::Node> store(BAN::RefPtr<AML::Node> source) override;