Kernel: Rewrite the AML conversion API

This doesn't currently make the interpreter any better, but it will make
further implementation easier to be spec (or hardware...) compliant
This commit is contained in:
2024-08-15 02:13:41 +03:00
parent 44d5c8c4b4
commit 3f5ee6f414
37 changed files with 564 additions and 416 deletions

View File

@@ -19,18 +19,22 @@ namespace Kernel::ACPI::AML
auto sleep_time_result = AML::parse_object(context);
if (!sleep_time_result.success())
return ParseResult::Failure;
auto sleep_time = sleep_time_result.node() ? sleep_time_result.node()->as_integer() : BAN::RefPtr<AML::Integer>();
if (!sleep_time)
auto sleep_time_node = sleep_time_result.node()
? sleep_time_result.node()->convert(AML::Node::ConvInteger)
: BAN::RefPtr<AML::Node>();
if (!sleep_time_node)
{
AML_ERROR("Sleep time cannot be evaluated to an integer");
return ParseResult::Failure;
}
const auto sleep_time_value = static_cast<AML::Integer*>(sleep_time_node.ptr())->value;
#if AML_DEBUG_LEVEL >= 2
AML_DEBUG_PRINTLN("Sleeping for {} ms", sleep_time->value);
AML_DEBUG_PRINTLN("Sleeping for {} ms", sleep_time_value);
#endif
SystemTimer::get().sleep_ms(sleep_time->value);
SystemTimer::get().sleep_ms(sleep_time_value);
return ParseResult::Success;
}
};