Kernel: Add better conversion for AML Alias, Name and Reference
This commit is contained in:
parent
1cfe3dd4da
commit
cf970d5914
|
@ -16,13 +16,27 @@ namespace Kernel::ACPI::AML
|
|||
, target(target)
|
||||
{}
|
||||
|
||||
BAN::RefPtr<AML::Node> named_target() override { return target; }
|
||||
|
||||
bool is_scope() const override { return target->is_scope(); }
|
||||
|
||||
BAN::RefPtr<AML::Node> convert(uint8_t) override { return {}; }
|
||||
BAN::RefPtr<AML::Node> convert(uint8_t mask) override
|
||||
{
|
||||
ASSERT(target);
|
||||
return target->convert(mask);
|
||||
}
|
||||
|
||||
BAN::RefPtr<Node> copy() override { return target->copy(); }
|
||||
BAN::RefPtr<Node> copy() override
|
||||
{
|
||||
ASSERT(target);
|
||||
return target->copy();
|
||||
}
|
||||
|
||||
BAN::RefPtr<AML::Node> store(BAN::RefPtr<AML::Node> node) override { ASSERT(target); return target->store(node); }
|
||||
BAN::RefPtr<AML::Node> store(BAN::RefPtr<AML::Node> node) override
|
||||
{
|
||||
ASSERT(target);
|
||||
return target->store(node);
|
||||
}
|
||||
|
||||
static ParseResult parse(ParseContext& context)
|
||||
{
|
||||
|
@ -45,7 +59,7 @@ namespace Kernel::ACPI::AML
|
|||
return ParseResult::Success;
|
||||
}
|
||||
|
||||
auto alias = MUST(BAN::RefPtr<Alias>::create(alias_string.value().path.back(), source_object));
|
||||
auto alias = MUST(BAN::RefPtr<Alias>::create(alias_string.value().path.back(), source_object->named_target()));
|
||||
if (!Namespace::root_namespace()->add_named_object(context, alias_string.value(), alias))
|
||||
return ParseResult::Success;
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@ namespace Kernel::ACPI::AML
|
|||
NameSeg name;
|
||||
|
||||
NamedObject(Node::Type type, NameSeg name) : Node(type), name(name) {}
|
||||
|
||||
[[nodiscard]] virtual BAN::RefPtr<AML::Node> named_target() { return this; }
|
||||
};
|
||||
|
||||
struct Name final : public AML::NamedObject
|
||||
|
@ -22,15 +24,19 @@ namespace Kernel::ACPI::AML
|
|||
: NamedObject(Node::Type::Name, name), object(BAN::move(object))
|
||||
{}
|
||||
|
||||
BAN::RefPtr<AML::Node> convert(uint8_t) override { return {}; }
|
||||
BAN::RefPtr<AML::Node> named_target() override { return object; }
|
||||
|
||||
BAN::RefPtr<AML::Node> convert(uint8_t mask) override
|
||||
{
|
||||
ASSERT(object);
|
||||
return object->convert(mask);
|
||||
}
|
||||
|
||||
BAN::RefPtr<AML::Node> store(BAN::RefPtr<AML::Node> node) override
|
||||
{
|
||||
ASSERT(object);
|
||||
if (object->type == AML::Node::Type::Reference)
|
||||
ASSERT(object->type != AML::Node::Type::Reference);
|
||||
return object->store(node);
|
||||
object = node;
|
||||
return node;
|
||||
}
|
||||
|
||||
static ParseResult parse(ParseContext& context);
|
||||
|
|
|
@ -23,21 +23,13 @@ namespace Kernel::ACPI::AML
|
|||
|
||||
BAN::RefPtr<AML::Node> convert(uint8_t mask) override
|
||||
{
|
||||
if (!node)
|
||||
{
|
||||
AML_ERROR("Trying to convert null Reference");
|
||||
return {};
|
||||
}
|
||||
ASSERT(node);
|
||||
return node->convert(mask);
|
||||
}
|
||||
|
||||
BAN::RefPtr<AML::Node> store(BAN::RefPtr<AML::Node> value) override
|
||||
{
|
||||
if (!node)
|
||||
{
|
||||
AML_ERROR("Storing to null Reference");
|
||||
return {};
|
||||
}
|
||||
ASSERT(node);
|
||||
return node->store(value);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue