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

@@ -17,8 +17,18 @@ namespace Kernel::ACPI::AML
{
static uint64_t total_node_count;
enum class Type
enum Conversion : uint8_t
{
ConvBuffer = 1 << 0,
ConvBufferField = 1 << 1,
ConvFieldUnit = 1 << 2,
ConvInteger = 1 << 3,
ConvString = 1 << 4,
};
enum class Type : uint8_t
{
None,
Alias,
BankFieldElement,
Buffer,
@@ -50,14 +60,9 @@ namespace Kernel::ACPI::AML
virtual bool is_scope() const { return false; }
virtual BAN::RefPtr<Node> copy() { return this; }
[[nodiscard]] virtual BAN::RefPtr<AML::Buffer> as_buffer();
[[nodiscard]] virtual BAN::RefPtr<AML::Integer> as_integer();
[[nodiscard]] virtual BAN::RefPtr<AML::String> as_string();
[[nodiscard]] virtual BAN::RefPtr<AML::Node> evaluate() { AML_TODO("evaluate, type {}", static_cast<uint8_t>(type)); return nullptr; }
[[nodiscard]] virtual bool store(BAN::RefPtr<AML::Node>) { AML_TODO("store, type {}", static_cast<uint8_t>(type)); return false; }
[[nodiscard]] virtual BAN::RefPtr<AML::Node> convert(uint8_t mask) = 0;
[[nodiscard]] virtual BAN::RefPtr<Node> copy() { return this; }
[[nodiscard]] virtual BAN::RefPtr<AML::Node> store(BAN::RefPtr<AML::Node>) { AML_TODO("store, type {}", static_cast<uint8_t>(type)); return {}; }
virtual void debug_print(int indent) const = 0;
};