Repository navigation
LibACPI: Add enough stuff to load the Qemu DSDT (3/N) - #27134
cqundefine wants to merge 18 commits into
Conversation
Some opcodes encode how many bytes a list of something takes, this will be needed very soon.
Sometimes reading an operand doesn't produce an operand, but a node or something else.
When an opcode would get filtered at root it would try to get the opcode value to print the error message, which is absent on the root frame.
The comment noted these should be added, but I accidentally left them out when refactoring. Co-authored-by: RatcheT2497 <ratchetnumbers@proton.me>
Those two always come in pairs so lets do it in one commit. This doesn't yet support evaluating fields as it's not yet needed and would require setting up callbacks from the interpreter. Co-authored-by: RatcheT2497 <ratchetnumbers@proton.me>
It was mistakenly added in the previous PR even though it never has any other argument than nullptr.
For now just create a node, but don't actually do anything with the body as it's not needed for now. Co-authored-by: RatcheT2497 <ratchetnumbers@proton.me>
Co-authored-by: RatcheT2497 <ratchetnumbers@proton.me>
Co-authored-by: RatcheT2497 <ratchetnumbers@proton.me>
Co-authored-by: RatcheT2497 <ratchetnumbers@proton.me>
Co-authored-by: RatcheT2497 <ratchetnumbers@proton.me>
Do this similarly to repeating over a byte count.
Co-authored-by: RatcheT2497 <ratchetnumbers@proton.me>
While this opcode is deprecated, it is still widely used and we need to support it. Co-authored-by: RatcheT2497 <ratchetnumbers@proton.me>
Now that we have all the primitives we need, let's add the missing objects. Co-authored-by: RatcheT2497 <ratchetnumbers@proton.me>
Just as the previous test, the AML table was compiled with using IASL 20260930 without any flags.
| PCC = 10, | ||
| PRM = 11, |
There was a problem hiding this comment.
nit: the spec also has these as full words. We usually prefer full words over abbreviations unless where the abbreviation is easier to understand and more common.
(I personally don't know what these stand for.)
| PCC = 10, | ||
| PRM = 11, |
There was a problem hiding this comment.
very nit: Why didn't you keep these as hex? The spec has them as hex.
| // opcodes here, I'm adding it in here. | ||
| // DeviceOp is also missing. Adding it here too. | ||
| // MutexOp likewise missing. It's named and creates an object, so here it be. | ||
| // DeviceOp, MethodOp and MutexOp are also missing. Adding it here too beacuse they also create an object. |
There was a problem hiding this comment.
nit: s/it/them, s/beacuse/because
| OperandType::ByteData, | ||
| OperandType::TermArg, | ||
| OperandType::TermArg, | ||
| OperandType::End |
There was a problem hiding this comment.
nit: please add trailing commas for every multi-line initializer like this.
|
|
||
| protected: | ||
| u8 m_space_raw; | ||
| i64 m_offset; |
There was a problem hiding this comment.
You are using i64 here now, but u64 everywhere else for ACPI integers. Are ACPI integers signed or unsigned? Or does that depend on the usage of them?
| auto value = MUST(m_data.as<String>()); | ||
| TRY(builder.try_appendff("('{}')"sv, StringView(value.buffer()))); | ||
| } else if (m_data.is<Buffer>()) { | ||
| TRY(builder.try_append("Buffer"sv)); |
There was a problem hiding this comment.
Should we print the buffer contents (with :hex-dump maybe)?
| } else if (m_data.is<Buffer>()) { | ||
| TRY(builder.try_append("Buffer"sv)); | ||
| } else if (m_data.is<Package>()) { | ||
| TRY(builder.try_append("Package"sv)); |
There was a problem hiding this comment.
Might be nice to print the contents here. Easiest way to do so would be to add a formatter for Object. Then the Vector formatter should just work.
| DEBUG_LOG("Reading package element..."); | ||
|
|
||
| auto initial = TRY(stream.peek_byte()); | ||
| if (is_namestring_start(initial)) { |
There was a problem hiding this comment.
Shouldn't we print an interpreter error for types that we don't support yet here? Or do I not understand how this works?
I'm also confused by the "// NOTE: Reading NameString will be handled a different way." comment. In what different way?
| StringView kind() const override { return "Processor"sv; } | ||
|
|
||
| protected: | ||
| u32 m_address { 0 }; |
There was a problem hiding this comment.
The ACPI 6.3 spec seems to call this the address of the "processor register block". And m_block_length the length of it.
| { | ||
| auto interpreter = TRY_OR_FAIL(load_test_table("data_objects_and_named_objects.aml"sv)); | ||
|
|
||
| auto string = TRY_OR_FAIL(interpreter->evaluate(TRY_OR_FAIL(ACPI::AML::NameString::from_string_view("\\STR0"sv)))); |
There was a problem hiding this comment.
Seeing these ACPI::AML::NameString::from_string_view everywhere makes me feel like we should add a StringView overload to evaluate maybe?
This adds enough features to allow our AML interpreter to load the standard DSDT provided but Qemu.