Kernel: Remove ACPI namespace from itself

This removes unnecessary cyclic reference
This commit is contained in:
Bananymous 2024-04-17 00:52:05 +03:00
parent cbc27a94ac
commit b959181afd
1 changed files with 4 additions and 3 deletions

View File

@ -34,7 +34,6 @@ namespace Kernel::ACPI
} }
AML_DEBUG_PRINT_INDENT(indent); AML_DEBUG_PRINT_INDENT(indent);
AML_DEBUG_PRINT("}"); AML_DEBUG_PRINT("}");
} }
BAN::Optional<BAN::String> AML::Namespace::resolve_path(const AML::NameString& relative_base, const AML::NameString& relative_path, FindMode mode, bool check_existence) const BAN::Optional<BAN::String> AML::Namespace::resolve_path(const AML::NameString& relative_base, const AML::NameString& relative_path, FindMode mode, bool check_existence) const
@ -77,7 +76,7 @@ namespace Kernel::ACPI
if (absolute_path.back() == '.') if (absolute_path.back() == '.')
absolute_path.pop_back(); absolute_path.pop_back();
if (!check_existence || m_objects.contains(absolute_path)) if (!check_existence || absolute_path == "\\"sv || m_objects.contains(absolute_path))
return absolute_path; return absolute_path;
return {}; return {};
} }
@ -126,6 +125,9 @@ namespace Kernel::ACPI
if (!canonical_path.has_value()) if (!canonical_path.has_value())
return nullptr; return nullptr;
if (canonical_path->sv() == "\\"sv)
return this;
auto it = m_objects.find(canonical_path.value()); auto it = m_objects.find(canonical_path.value());
if (it == m_objects.end()) if (it == m_objects.end())
return {}; return {};
@ -191,7 +193,6 @@ namespace Kernel::ACPI
ASSERT(!s_root_namespace); ASSERT(!s_root_namespace);
s_root_namespace = MUST(BAN::RefPtr<Namespace>::create(NameSeg("\\"sv))); s_root_namespace = MUST(BAN::RefPtr<Namespace>::create(NameSeg("\\"sv)));
s_root_namespace->scope = AML::NameString("\\"sv); s_root_namespace->scope = AML::NameString("\\"sv);
MUST(s_root_namespace->m_objects.insert("\\"sv, s_root_namespace));
Integer::Constants::Zero = MUST(BAN::RefPtr<Integer>::create(0, true)); Integer::Constants::Zero = MUST(BAN::RefPtr<Integer>::create(0, true));
Integer::Constants::One = MUST(BAN::RefPtr<Integer>::create(1, true)); Integer::Constants::One = MUST(BAN::RefPtr<Integer>::create(1, true));