Kernel: AML add flag to force absolute lookup for ACPI namespace
This commit is contained in:
@@ -54,12 +54,7 @@ namespace Kernel::ACPI::AML
|
||||
));
|
||||
if (!Namespace::root_namespace()->add_named_object(context, name_string.value(), method))
|
||||
return ParseResult::Failure;
|
||||
|
||||
auto method_scope = Namespace::root_namespace()->resolve_path(context.scope, name_string.value());
|
||||
if (!method_scope.has_value())
|
||||
return ParseResult::Failure;
|
||||
method->term_list = method_pkg.value();
|
||||
method->scope = AML::NameString(method_scope.release_value());
|
||||
|
||||
#if AML_DEBUG_LEVEL >= 2
|
||||
method->debug_print(0);
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Kernel::ACPI::AML
|
||||
template<typename F>
|
||||
static void for_each_child(const AML::NameString& scope, const F& callback)
|
||||
{
|
||||
auto canonical_path = root_namespace()->resolve_path({}, scope);
|
||||
auto canonical_path = root_namespace()->resolve_path(scope, {}, FindMode::ForceAbsolute);
|
||||
ASSERT(canonical_path.has_value());
|
||||
|
||||
for (auto& [path, child] : root_namespace()->m_objects)
|
||||
@@ -39,10 +39,15 @@ namespace Kernel::ACPI::AML
|
||||
|
||||
void debug_print(int indent) const override;
|
||||
|
||||
BAN::Optional<BAN::String> resolve_path(const AML::NameString& relative_base, const AML::NameString& relative_path, bool allow_nonexistent = false);
|
||||
enum class FindMode
|
||||
{
|
||||
Normal,
|
||||
ForceAbsolute,
|
||||
};
|
||||
BAN::Optional<BAN::String> resolve_path(const AML::NameString& relative_base, const AML::NameString& relative_path, FindMode mode, bool check_existence = true) const;
|
||||
|
||||
// Find an object in the namespace. Returns nullptr if the object is not found.
|
||||
BAN::RefPtr<NamedObject> find_object(const AML::NameString& relative_base, const AML::NameString& relative_path);
|
||||
BAN::RefPtr<NamedObject> find_object(const AML::NameString& relative_base, const AML::NameString& relative_path, FindMode mode);
|
||||
|
||||
// Add an object to the namespace. Returns false if the parent object could not be added.
|
||||
bool add_named_object(ParseContext&, const AML::NameString& object_path, BAN::RefPtr<NamedObject> object);
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Kernel::ACPI::AML
|
||||
// resolve references
|
||||
for (auto& reference : unresolved_references)
|
||||
{
|
||||
auto object = Namespace::root_namespace()->find_object(scope, reference.name);
|
||||
auto object = Namespace::root_namespace()->find_object(scope, reference.name, Namespace::FindMode::Normal);
|
||||
if (!object)
|
||||
{
|
||||
AML_ERROR("Failed to resolve reference {} in package", reference.name);
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace Kernel::ACPI::AML
|
||||
auto name = NameString::parse(context.aml_data);
|
||||
if (!name.has_value())
|
||||
return ParseResult::Failure;
|
||||
object = Namespace::root_namespace()->find_object(context.scope, name.value());
|
||||
object = Namespace::root_namespace()->find_object(context.scope, name.value(), Namespace::FindMode::Normal);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user