Files
serenity/Kernel/Firmware/ACPI/Initialize.cpp
T
Undefine 3a825ccec0 Kernel: Split out the IRQHandler from ACPI parser and move IRQ lookup
Splitting it off allows initializing the later than right after Parser
creation, which allows us to move more resposibility to the Parser
instead of mapping the FADT twice.
2026-10-21 19:03:12 +02:00

45 lines
1.1 KiB
C++

/*
* Copyright (c) 2020-2021, Liav A. <[email protected]>
* Copyright (c) 2020, Andreas Kling <[email protected]>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <Kernel/Boot/BootInfo.h>
#include <Kernel/Boot/CommandLine.h>
#include <Kernel/Firmware/ACPI/Parser.h>
#include <Kernel/Firmware/ACPI/StaticParsing.h>
#include <Kernel/Memory/TypedMapping.h>
#include <Kernel/Sections.h>
namespace Kernel::ACPI {
UNMAP_AFTER_INIT ErrorOr<void> initialize()
{
auto feature_level = kernel_command_line().acpi_feature_level();
if (feature_level == AcpiFeatureLevel::Disabled)
return {};
auto rsdp = StaticParsing::find_rsdp();
if (!rsdp.has_value())
return ENOENT;
auto facp = TRY(StaticParsing::find_table(rsdp.value(), "FACP"sv));
if (!facp.has_value())
return ENOENT;
TRY(Parser::initialize(rsdp.value(), facp.value()));
if (kernel_command_line().acpi_feature_level() == AcpiFeatureLevel::Enabled)
Parser::the()->enable_aml_parsing();
return {};
}
bool is_enabled()
{
return Parser::the();
}
}