diff --git a/kernel/include/kernel/ACPI/AML/Alias.h b/kernel/include/kernel/ACPI/AML/Alias.h index 6b23ebc3..6e66e2c8 100644 --- a/kernel/include/kernel/ACPI/AML/Alias.h +++ b/kernel/include/kernel/ACPI/AML/Alias.h @@ -16,7 +16,7 @@ namespace Kernel::ACPI::AML , target(target) {} - BAN::RefPtr named_target() override { return target; } + BAN::RefPtr 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::create(alias_string.value().path.back(), source_object->named_target())); + auto alias = MUST(BAN::RefPtr::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; diff --git a/kernel/include/kernel/ACPI/AML/CopyObject.h b/kernel/include/kernel/ACPI/AML/CopyObject.h index bd102e3a..ad83092a 100644 --- a/kernel/include/kernel/ACPI/AML/CopyObject.h +++ b/kernel/include/kernel/ACPI/AML/CopyObject.h @@ -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(); if (!source) { AML_ERROR("CopyObject source is null"); diff --git a/kernel/include/kernel/ACPI/AML/NamedObject.h b/kernel/include/kernel/ACPI/AML/NamedObject.h index 8a9dfc81..e617ad0e 100644 --- a/kernel/include/kernel/ACPI/AML/NamedObject.h +++ b/kernel/include/kernel/ACPI/AML/NamedObject.h @@ -12,8 +12,6 @@ namespace Kernel::ACPI::AML NameSeg name; NamedObject(Node::Type type, NameSeg name) : Node(type), name(name) {} - - [[nodiscard]] virtual BAN::RefPtr 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 named_target() override { return object; } + BAN::RefPtr to_underlying() override { return object; } BAN::RefPtr convert(uint8_t mask) override { diff --git a/kernel/include/kernel/ACPI/AML/Node.h b/kernel/include/kernel/ACPI/AML/Node.h index 09c0cae5..1329c19c 100644 --- a/kernel/include/kernel/ACPI/AML/Node.h +++ b/kernel/include/kernel/ACPI/AML/Node.h @@ -60,6 +60,7 @@ namespace Kernel::ACPI::AML virtual bool is_scope() const { return false; } + [[nodiscard]] virtual BAN::RefPtr to_underlying() { return this; } [[nodiscard]] virtual BAN::RefPtr convert(uint8_t mask) = 0; [[nodiscard]] virtual BAN::RefPtr copy() { return this; } [[nodiscard]] virtual BAN::RefPtr store(BAN::RefPtr) { AML_TODO("store, type {}", static_cast(type)); return {}; } diff --git a/kernel/include/kernel/ACPI/AML/Register.h b/kernel/include/kernel/ACPI/AML/Register.h index 7ff0b0b6..c1857589 100644 --- a/kernel/include/kernel/ACPI/AML/Register.h +++ b/kernel/include/kernel/ACPI/AML/Register.h @@ -12,6 +12,8 @@ namespace Kernel::ACPI::AML Register(); Register(BAN::RefPtr node); + BAN::RefPtr to_underlying() override { return value; } + BAN::RefPtr convert(uint8_t mask) override; BAN::RefPtr store(BAN::RefPtr source) override;