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