Compare commits
No commits in common. "a07cbabcb3778006993d0f84549d120b2f53a4ed" and "19d16620a64f12f5d7f797d951d8ed959d7798d1" have entirely different histories.
a07cbabcb3
...
19d16620a6
|
@ -37,7 +37,9 @@ namespace Kernel
|
|||
|
||||
static constexpr inline uintptr_t uncanonicalize(uintptr_t addr)
|
||||
{
|
||||
return addr & 0x0000FFFFFFFFFFFF;
|
||||
if (addr & 0x0000800000000000)
|
||||
return addr & ~0xFFFF000000000000;
|
||||
return addr;
|
||||
}
|
||||
|
||||
static constexpr inline uintptr_t canonicalize(uintptr_t addr)
|
||||
|
|
|
@ -7,8 +7,37 @@
|
|||
namespace Kernel::ACPI::AML
|
||||
{
|
||||
|
||||
struct Alias
|
||||
struct Alias final : public AML::NamedObject
|
||||
{
|
||||
BAN::RefPtr<AML::Node> target;
|
||||
|
||||
Alias(NameSeg name, BAN::RefPtr<AML::Node> target)
|
||||
: NamedObject(Node::Type::Alias, name)
|
||||
, target(target)
|
||||
{}
|
||||
|
||||
BAN::RefPtr<AML::Node> to_underlying() override { return target; }
|
||||
|
||||
bool is_scope() const override { return target->is_scope(); }
|
||||
|
||||
BAN::RefPtr<AML::Node> convert(uint8_t mask) override
|
||||
{
|
||||
ASSERT(target);
|
||||
return target->convert(mask);
|
||||
}
|
||||
|
||||
BAN::RefPtr<Node> copy() override
|
||||
{
|
||||
ASSERT(target);
|
||||
return target->copy();
|
||||
}
|
||||
|
||||
BAN::RefPtr<AML::Node> store(BAN::RefPtr<AML::Node> node) override
|
||||
{
|
||||
ASSERT(target);
|
||||
return target->store(node);
|
||||
}
|
||||
|
||||
static ParseResult parse(ParseContext& context)
|
||||
{
|
||||
ASSERT(context.aml_data.size() >= 1);
|
||||
|
@ -30,19 +59,27 @@ namespace Kernel::ACPI::AML
|
|||
return ParseResult::Success;
|
||||
}
|
||||
|
||||
if (!Namespace::root_namespace()->add_named_object(context, alias_string.value(), source_object))
|
||||
auto alias = MUST(BAN::RefPtr<Alias>::create(alias_string.value().path.back(), source_object->to_underlying()));
|
||||
if (!Namespace::root_namespace()->add_named_object(context, alias_string.value(), alias))
|
||||
return ParseResult::Success;
|
||||
|
||||
#if AML_DEBUG_LEVEL >= 2
|
||||
AML_DEBUG_PRINT("Alias \"");
|
||||
alias_string->debug_print();
|
||||
AML_DEBUG_PRINT("\" => ");
|
||||
source_object->debug_print(0);
|
||||
alias->debug_print(0);
|
||||
AML_DEBUG_PRINTLN("");
|
||||
#endif
|
||||
|
||||
return ParseResult::Success;
|
||||
}
|
||||
|
||||
void debug_print(int indent) const override
|
||||
{
|
||||
AML_DEBUG_PRINT_INDENT(indent);
|
||||
AML_DEBUG_PRINTLN("Alias {} { ", name);
|
||||
target->debug_print(indent + 1);
|
||||
AML_DEBUG_PRINTLN("");
|
||||
AML_DEBUG_PRINT_INDENT(indent);
|
||||
AML_DEBUG_PRINT("}");
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -50,6 +50,9 @@ namespace Kernel::ACPI::AML
|
|||
|
||||
switch (destination->type)
|
||||
{
|
||||
case AML::Node::Type::Alias:
|
||||
static_cast<AML::Alias*>(destination.ptr())->target = source->copy();
|
||||
return source;
|
||||
case AML::Node::Type::Name:
|
||||
static_cast<AML::Name*>(destination.ptr())->object = source->copy();
|
||||
return source;
|
||||
|
|
|
@ -67,12 +67,7 @@ namespace Kernel::ACPI::AML
|
|||
return ParseResult::Failure;
|
||||
}
|
||||
auto package_element = package->elements[index];
|
||||
if (!package_element)
|
||||
{
|
||||
AML_ERROR("IndexOp target is null package element");
|
||||
return ParseResult::Failure;
|
||||
}
|
||||
result = MUST(BAN::RefPtr<AML::Reference>::create(package_element));
|
||||
result = MUST(BAN::RefPtr<AML::Reference>::create(package_element->to_underlying()));
|
||||
break;
|
||||
}
|
||||
case AML::Node::Type::String:
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace Kernel::ACPI::AML
|
|||
enum class Type : uint8_t
|
||||
{
|
||||
None,
|
||||
Alias,
|
||||
BankFieldElement,
|
||||
Buffer,
|
||||
BufferField,
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace Kernel::ACPI::AML
|
|||
switch (object->type)
|
||||
{
|
||||
case AML::Node::Type::None:
|
||||
case AML::Node::Type::Alias:
|
||||
case AML::Node::Type::Name:
|
||||
case AML::Node::Type::PackageElement:
|
||||
case AML::Node::Type::Reference:
|
||||
|
|
|
@ -84,7 +84,7 @@ namespace Kernel::ACPI::AML
|
|||
{
|
||||
if (!initialized)
|
||||
{
|
||||
AML_ERROR("Trying to convert uninitialized PackageElement");
|
||||
AML_ERROR("Trying to store into uninitialized PackageElement");
|
||||
return {};
|
||||
}
|
||||
if (!resolved && !resolve())
|
||||
|
@ -96,7 +96,7 @@ namespace Kernel::ACPI::AML
|
|||
{
|
||||
if (!initialized)
|
||||
{
|
||||
AML_ERROR("Trying to read uninitialized PackageElement");
|
||||
AML_ERROR("Trying to store into uninitialized PackageElement");
|
||||
return {};
|
||||
}
|
||||
if (!resolved && !resolve())
|
||||
|
@ -108,17 +108,17 @@ namespace Kernel::ACPI::AML
|
|||
{
|
||||
if (!initialized)
|
||||
{
|
||||
initialized = true;
|
||||
resolved = true;
|
||||
AML_ERROR("Trying to store into uninitialized PackageElement");
|
||||
return {};
|
||||
}
|
||||
if (!resolved && !resolve())
|
||||
return {};
|
||||
ASSERT(!element || element->type != AML::Node::Type::Reference);
|
||||
ASSERT(element->type != AML::Node::Type::Reference);
|
||||
if (node->type == AML::Node::Type::Reference)
|
||||
element = static_cast<AML::Reference*>(node.ptr())->node;
|
||||
element = static_cast<AML::Reference*>(element.ptr())->node;
|
||||
else
|
||||
element = node->copy();
|
||||
return node;
|
||||
element = element->copy();
|
||||
return element;
|
||||
}
|
||||
|
||||
static ParseResult parse(AML::ParseContext& context, BAN::RefPtr<AML::Package> package)
|
||||
|
|
|
@ -22,8 +22,8 @@ namespace Kernel::ACPI::AML
|
|||
if (!object_result.success())
|
||||
return ParseResult::Failure;
|
||||
auto object_node = object_result.node();
|
||||
if (object_node)
|
||||
object_node = object_node->to_underlying();
|
||||
if (object_node && object_node->type == AML::Node::Type::Register)
|
||||
object_node = static_cast<AML::Register*>(object_node.ptr())->value;
|
||||
if (!object_node)
|
||||
{
|
||||
AML_ERROR("SizeOf object is null");
|
||||
|
|
|
@ -495,7 +495,25 @@ acpi_release_global_lock:
|
|||
dwarnln("\\_S5 not found");
|
||||
return;
|
||||
}
|
||||
auto s5_evaluated = s5_object->to_underlying();
|
||||
BAN::RefPtr<AML::Node> s5_evaluated = s5_object;
|
||||
while (true)
|
||||
{
|
||||
bool done = false;
|
||||
switch (s5_evaluated->type)
|
||||
{
|
||||
case AML::Node::Type::Alias:
|
||||
s5_evaluated = static_cast<AML::Alias*>(s5_evaluated.ptr())->target;
|
||||
break;
|
||||
case AML::Node::Type::Name:
|
||||
s5_evaluated = static_cast<AML::Name*>(s5_evaluated.ptr())->object;
|
||||
break;
|
||||
default:
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
if (done)
|
||||
break;
|
||||
}
|
||||
if (!s5_evaluated)
|
||||
{
|
||||
dwarnln("Failed to evaluate \\_S5");
|
||||
|
|
|
@ -159,6 +159,7 @@ namespace Kernel::ACPI
|
|||
LockGuard _(m_object_mutex);
|
||||
|
||||
ASSERT(!object_path.path.empty());
|
||||
ASSERT(object_path.path.back() == object->name);
|
||||
|
||||
auto canonical_path = resolve_path(parse_context.scope, object_path, FindMode::ForceAbsolute, false);
|
||||
ASSERT(canonical_path.has_value());
|
||||
|
|
|
@ -93,8 +93,6 @@ namespace Kernel::ACPI
|
|||
auto result_integer = result.value()
|
||||
? result.value()->convert(AML::Node::ConvInteger)
|
||||
: BAN::RefPtr<AML::Node>();
|
||||
if (!result_integer)
|
||||
return {};
|
||||
return static_cast<AML::Integer*>(result_integer.ptr());
|
||||
}
|
||||
|
||||
|
|
|
@ -277,7 +277,6 @@ namespace Kernel
|
|||
memcpy(PageTable::fast_page_as_ptr(), g_ap_init_addr, PAGE_SIZE);
|
||||
});
|
||||
|
||||
uint8_t initialized_aps = 0;
|
||||
for (auto& processor : m_processors)
|
||||
{
|
||||
if (processor.apic_id == bsp_id)
|
||||
|
@ -340,17 +339,15 @@ namespace Kernel
|
|||
udelay(100);
|
||||
}
|
||||
});
|
||||
|
||||
initialized_aps++;
|
||||
}
|
||||
|
||||
__atomic_store_n(&g_ap_startup_done[0], 1, __ATOMIC_SEQ_CST);
|
||||
|
||||
const size_t timeout_ms = SystemTimer::get().ms_since_boot() + 500;
|
||||
while (__atomic_load_n(&g_ap_running_count[0], __ATOMIC_SEQ_CST) < initialized_aps)
|
||||
while (__atomic_load_n(&g_ap_running_count[0], __ATOMIC_SEQ_CST) < m_processors.size() - 1)
|
||||
{
|
||||
if (SystemTimer::get().ms_since_boot() >= timeout_ms)
|
||||
Kernel::panic("Could not start all APs ({}/{} started)", g_ap_running_count[0], initialized_aps);
|
||||
Kernel::panic("Could not start all processors");
|
||||
__builtin_ia32_pause();
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
struct ParsedCommandLine
|
||||
{
|
||||
bool force_pic = false;
|
||||
bool disable_acpi = false;
|
||||
bool disable_serial = false;
|
||||
bool disable_smp = false;
|
||||
bool disable_usb = false;
|
||||
|
@ -83,8 +82,6 @@ static void parse_command_line()
|
|||
cmdline.disable_smp = true;
|
||||
else if (argument == "nousb")
|
||||
cmdline.disable_usb = true;
|
||||
else if (argument == "noacpi")
|
||||
cmdline.disable_acpi = true;
|
||||
else if (argument == "nodebug")
|
||||
g_disable_debug = true;
|
||||
else if (argument.starts_with("ps2="))
|
||||
|
@ -223,7 +220,7 @@ static void init2(void*)
|
|||
dprintln("USBManager initialized");
|
||||
}
|
||||
|
||||
if (!cmdline.disable_acpi && ACPI::ACPI::get().enter_acpi_mode(InterruptController::get().is_using_apic()).is_error())
|
||||
if (ACPI::ACPI::get().enter_acpi_mode(InterruptController::get().is_using_apic()).is_error())
|
||||
dprintln("Failed to enter ACPI mode");
|
||||
|
||||
DevFileSystem::get().initialize_device_updater();
|
||||
|
|
|
@ -13,8 +13,6 @@ setjmp:
|
|||
|
||||
ret
|
||||
|
||||
.size setjmp, . - setjmp
|
||||
|
||||
// void longjmp(jmp_buf env, int val)
|
||||
.global longjmp
|
||||
longjmp:
|
||||
|
@ -28,5 +26,3 @@ longjmp:
|
|||
movl 0(%edx), %esp
|
||||
movl 4(%edx), %ecx
|
||||
jmp *%ecx
|
||||
|
||||
.size longjmp, . - longjmp
|
||||
|
|
|
@ -10,7 +10,6 @@ setjmp:
|
|||
xorq %rax, %rax
|
||||
|
||||
ret
|
||||
.size setjmp, . - setjmp
|
||||
|
||||
// void longjmp(jmp_buf env, int val)
|
||||
.global longjmp
|
||||
|
@ -22,4 +21,3 @@ longjmp:
|
|||
movq 0(%rdi), %rsp
|
||||
movq 8(%rdi), %rcx
|
||||
jmp *%rcx
|
||||
.size longjmp, . - longjmp
|
||||
|
|
Loading…
Reference in New Issue