Kernel/AML: General cleanup and compliance improvements
This commit is contained in:
parent
75884ca6b8
commit
490a28ee7a
|
@ -171,7 +171,7 @@ namespace Kernel::ACPI::AML
|
|||
// TODO: optimize for whole byte accesses
|
||||
for (size_t i = 0; i < field_bit_size; i++)
|
||||
{
|
||||
const size_t bit = field_bit_offset + 1;
|
||||
const size_t bit = field_bit_offset + i;
|
||||
buffer[bit / 8] &= ~(1 << (bit % 8));
|
||||
buffer[bit / 8] |= ((value >> i) & 1) << (bit % 8);
|
||||
}
|
||||
|
|
|
@ -51,13 +51,13 @@ namespace Kernel::ACPI::AML
|
|||
switch (destination->type)
|
||||
{
|
||||
case AML::Node::Type::Alias:
|
||||
static_cast<AML::Alias*>(destination.ptr())->target = source;
|
||||
static_cast<AML::Alias*>(destination.ptr())->target = source->copy();
|
||||
return source;
|
||||
case AML::Node::Type::Name:
|
||||
static_cast<AML::Name*>(destination.ptr())->object = source;
|
||||
static_cast<AML::Name*>(destination.ptr())->object = source->copy();
|
||||
return source;
|
||||
case AML::Node::Type::Register:
|
||||
static_cast<AML::Register*>(destination.ptr())->value = source;
|
||||
static_cast<AML::Register*>(destination.ptr())->value = source->copy();
|
||||
return source;
|
||||
default:
|
||||
ASSERT_NOT_REACHED();
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <kernel/ACPI/AML/Package.h>
|
||||
#include <kernel/ACPI/AML/ParseContext.h>
|
||||
#include <kernel/ACPI/AML/Reference.h>
|
||||
#include <kernel/ACPI/AML/Register.h>
|
||||
|
||||
namespace Kernel::ACPI::AML
|
||||
{
|
||||
|
@ -20,25 +21,20 @@ namespace Kernel::ACPI::AML
|
|||
auto source_result = AML::parse_object(context);
|
||||
if (!source_result.success())
|
||||
return ParseResult::Failure;
|
||||
auto source = source_result.node()
|
||||
? source_result.node()->convert(AML::Node::ConvBuffer | AML::Node::ConvInteger | AML::Node::ConvString)
|
||||
: BAN::RefPtr<AML::Node>();
|
||||
auto source = source_result.node() ? source_result.node()->to_underlying() : BAN::RefPtr<AML::Node>();
|
||||
if (source && source->type != AML::Node::Type::Package)
|
||||
source = source->convert(AML::Node::ConvBuffer | AML::Node::ConvInteger | AML::Node::ConvString);
|
||||
if (!source)
|
||||
{
|
||||
AML_ERROR("IndexOp source could not be converted");
|
||||
if (source)
|
||||
{
|
||||
source->debug_print(0);
|
||||
AML_DEBUG_PRINTLN("");
|
||||
}
|
||||
return ParseResult::Failure;
|
||||
}
|
||||
|
||||
auto index_result = AML::parse_object(context);
|
||||
if (!index_result.success())
|
||||
return ParseResult::Failure;
|
||||
auto index_node = source_result.node()
|
||||
? source_result.node()->convert(AML::Node::ConvInteger)
|
||||
auto index_node = index_result.node()
|
||||
? index_result.node()->convert(AML::Node::ConvInteger)
|
||||
: BAN::RefPtr<AML::Node>();
|
||||
if (!index_node)
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <kernel/ACPI/AML/Node.h>
|
||||
#include <kernel/ACPI/AML/ParseContext.h>
|
||||
#include <kernel/ACPI/AML/Pkg.h>
|
||||
#include <kernel/ACPI/AML/Reference.h>
|
||||
|
||||
namespace Kernel::ACPI::AML
|
||||
{
|
||||
|
@ -100,9 +101,11 @@ namespace Kernel::ACPI::AML
|
|||
}
|
||||
if (!resolved && !resolve())
|
||||
return {};
|
||||
if (element->type == AML::Node::Type::Reference)
|
||||
return element->store(node);
|
||||
element = node->copy();
|
||||
ASSERT(element->type != AML::Node::Type::Reference);
|
||||
if (node->type == AML::Node::Type::Reference)
|
||||
element = static_cast<AML::Reference*>(element.ptr())->node;
|
||||
else
|
||||
element = element->copy();
|
||||
return element;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Kernel::ACPI
|
|||
{
|
||||
if (node->type == AML::Node::Type::Reference)
|
||||
node = static_cast<AML::Reference*>(node.ptr())->node;
|
||||
else if (node)
|
||||
else if (node->type != AML::Node::Type::Buffer && node->type != AML::Node::Type::Package)
|
||||
node = node->copy();
|
||||
if (node->type == AML::Node::Type::Register)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue