Kernel: Add AML API for getting underlying value of nodes
This commit is contained in:
parent
d8dabab4fb
commit
6408bb2efa
|
@ -16,7 +16,7 @@ namespace Kernel::ACPI::AML
|
|||
, target(target)
|
||||
{}
|
||||
|
||||
BAN::RefPtr<AML::Node> named_target() override { return target; }
|
||||
BAN::RefPtr<AML::Node> to_underlying() override { return target; }
|
||||
|
||||
bool is_scope() const override { return target->is_scope(); }
|
||||
|
||||
|
@ -59,7 +59,7 @@ namespace Kernel::ACPI::AML
|
|||
return ParseResult::Success;
|
||||
}
|
||||
|
||||
auto alias = MUST(BAN::RefPtr<Alias>::create(alias_string.value().path.back(), source_object->named_target()));
|
||||
auto alias = MUST(BAN::RefPtr<Alias>::create(alias_string.value().path.back(), source_object->to_underlying()));
|
||||
if (!Namespace::root_namespace()->add_named_object(context, alias_string.value(), alias))
|
||||
return ParseResult::Success;
|
||||
|
||||
|
|
|
@ -19,7 +19,9 @@ namespace Kernel::ACPI::AML
|
|||
auto source_result = AML::parse_object(context);
|
||||
if (!source_result.success())
|
||||
return ParseResult::Failure;
|
||||
auto source = source_result.node();
|
||||
auto source = source_result.node()
|
||||
? source_result.node()->to_underlying()
|
||||
: BAN::RefPtr<AML::Node>();
|
||||
if (!source)
|
||||
{
|
||||
AML_ERROR("CopyObject source is null");
|
||||
|
|
|
@ -12,8 +12,6 @@ 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
|
||||
|
@ -24,7 +22,7 @@ namespace Kernel::ACPI::AML
|
|||
: NamedObject(Node::Type::Name, name), object(BAN::move(object))
|
||||
{}
|
||||
|
||||
BAN::RefPtr<AML::Node> named_target() override { return object; }
|
||||
BAN::RefPtr<AML::Node> to_underlying() override { return object; }
|
||||
|
||||
BAN::RefPtr<AML::Node> convert(uint8_t mask) override
|
||||
{
|
||||
|
|
|
@ -60,6 +60,7 @@ namespace Kernel::ACPI::AML
|
|||
|
||||
virtual bool is_scope() const { return false; }
|
||||
|
||||
[[nodiscard]] virtual BAN::RefPtr<AML::Node> to_underlying() { return this; }
|
||||
[[nodiscard]] virtual BAN::RefPtr<AML::Node> convert(uint8_t mask) = 0;
|
||||
[[nodiscard]] virtual BAN::RefPtr<Node> copy() { return this; }
|
||||
[[nodiscard]] virtual BAN::RefPtr<AML::Node> store(BAN::RefPtr<AML::Node>) { AML_TODO("store, type {}", static_cast<uint8_t>(type)); return {}; }
|
||||
|
|
|
@ -12,6 +12,8 @@ namespace Kernel::ACPI::AML
|
|||
Register();
|
||||
Register(BAN::RefPtr<AML::Node> node);
|
||||
|
||||
BAN::RefPtr<AML::Node> to_underlying() override { return value; }
|
||||
|
||||
BAN::RefPtr<AML::Node> convert(uint8_t mask) override;
|
||||
BAN::RefPtr<AML::Node> store(BAN::RefPtr<AML::Node> source) override;
|
||||
|
||||
|
|
Loading…
Reference in New Issue