Kernel: Add API to get ACPI reference paths
This commit is contained in:
parent
b3b5b40163
commit
aba49cc93f
|
@ -44,6 +44,8 @@ namespace Kernel::ACPI::AML
|
||||||
};
|
};
|
||||||
BAN::ErrorOr<FindResult> find_named_object(const Scope& scope, const NameString& name_string, bool force_absolute = false);
|
BAN::ErrorOr<FindResult> find_named_object(const Scope& scope, const NameString& name_string, bool force_absolute = false);
|
||||||
|
|
||||||
|
BAN::ErrorOr<Scope> find_reference_scope(const Reference* reference);
|
||||||
|
|
||||||
BAN::ErrorOr<void> for_each_child(const Scope&, const BAN::Function<BAN::Iteration(BAN::StringView, Reference*)>&);
|
BAN::ErrorOr<void> for_each_child(const Scope&, const BAN::Function<BAN::Iteration(BAN::StringView, Reference*)>&);
|
||||||
BAN::ErrorOr<void> for_each_child(const Scope&, const BAN::Function<BAN::Iteration(const Scope&, Reference*)>&);
|
BAN::ErrorOr<void> for_each_child(const Scope&, const BAN::Function<BAN::Iteration(const Scope&, Reference*)>&);
|
||||||
|
|
||||||
|
|
|
@ -454,6 +454,18 @@ namespace Kernel::ACPI::AML
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BAN::ErrorOr<Scope> Namespace::find_reference_scope(const Reference* reference)
|
||||||
|
{
|
||||||
|
for (const auto& [obj_path, obj_ref] : m_named_objects)
|
||||||
|
{
|
||||||
|
if (obj_ref != reference)
|
||||||
|
continue;
|
||||||
|
return obj_path.copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
return BAN::Error::from_errno(ENOENT);
|
||||||
|
}
|
||||||
|
|
||||||
BAN::ErrorOr<void> Namespace::for_each_child(const Scope& scope, const BAN::Function<BAN::Iteration(BAN::StringView, Reference*)>& callback)
|
BAN::ErrorOr<void> Namespace::for_each_child(const Scope& scope, const BAN::Function<BAN::Iteration(BAN::StringView, Reference*)>& callback)
|
||||||
{
|
{
|
||||||
for (const auto& [obj_path, obj_ref] : m_named_objects)
|
for (const auto& [obj_path, obj_ref] : m_named_objects)
|
||||||
|
|
Loading…
Reference in New Issue