mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
Kernel: Split ACPI init between early and full initilization
To get rid of the duplicate table parsing code we need the ACPI parser during interrupt initilization, but to perform the full ACPI initilization we setup an IRQ handler which needs interrupts to be initialized. After this split during early initilization we only read the information about the tables to make it available and do the rest after interrupts are initilizated. This also keeps ACPI errors as being not deadly.
This commit is contained in:
1 parent
8207cfb956
commit
d65ebd86d9
5 files changed
+13
-9
No files matched your search
@@ -233,14 +233,19 @@ extern "C" [[noreturn]] UNMAP_AFTER_INIT NO_SANITIZE_COVERAGE void init(BootInfo
|
||||
MUST(DeviceTree::Management::the().probe_drivers(DeviceTree::Driver::ProbeStage::InterruptController));
|
||||
#endif
|
||||
|
||||
if (auto maybe_error = ACPI::early_initialize(); maybe_error.is_error())
|
||||
dmesgln("ACPI: Error during early initilization: {}", maybe_error.release_error());
|
||||
|
||||
InterruptManagement::initialize();
|
||||
|
||||
#if ARCH(AARCH64) || ARCH(RISCV64)
|
||||
MUST(DeviceTree::Management::the().probe_drivers(DeviceTree::Driver::ProbeStage::Early));
|
||||
#endif
|
||||
|
||||
if (auto maybe_error = ACPI::initialize(); maybe_error.is_error())
|
||||
dmesgln("Error while initializing ACPI: {}", maybe_error.release_error());
|
||||
if (ACPI::is_enabled()) {
|
||||
if (auto maybe_error = ACPI::Parser::the()->full_initialize(); maybe_error.is_error())
|
||||
dmesgln("ACPI: Error during full initilization: {}", maybe_error.release_error());
|
||||
}
|
||||
|
||||
// Initialize TimeManagement before using randomness!
|
||||
TimeManagement::initialize(0);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
namespace Kernel::ACPI {
|
||||
|
||||
UNMAP_AFTER_INIT ErrorOr<void> initialize()
|
||||
UNMAP_AFTER_INIT ErrorOr<void> early_initialize()
|
||||
{
|
||||
auto feature_level = kernel_command_line().acpi_feature_level();
|
||||
if (feature_level == AcpiFeatureLevel::Disabled)
|
||||
|
||||
@@ -11,6 +11,6 @@
|
||||
namespace Kernel::ACPI {
|
||||
|
||||
bool is_enabled();
|
||||
ErrorOr<void> initialize();
|
||||
ErrorOr<void> early_initialize();
|
||||
|
||||
}
|
||||
@@ -48,7 +48,8 @@ ErrorOr<void> Parser::initialize(PhysicalAddress rsdp)
|
||||
if (!s_acpi_parser)
|
||||
return ENOMEM;
|
||||
|
||||
TRY(s_acpi_parser->locate_static_data());
|
||||
TRY(s_acpi_parser->locate_main_system_description_table());
|
||||
TRY(s_acpi_parser->initialize_main_system_description_table());
|
||||
|
||||
guard.disarm();
|
||||
return {};
|
||||
@@ -136,10 +137,8 @@ void Parser::enumerate_static_tables(Function<void(StringView, PhysicalAddress,
|
||||
}
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT ErrorOr<void> Parser::locate_static_data()
|
||||
UNMAP_AFTER_INIT ErrorOr<void> Parser::full_initialize()
|
||||
{
|
||||
TRY(locate_main_system_description_table());
|
||||
TRY(initialize_main_system_description_table());
|
||||
TRY(process_fadt_data());
|
||||
TRY(process_dsdt());
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@ public:
|
||||
static ErrorOr<void> initialize(PhysicalAddress rsdp);
|
||||
|
||||
Optional<PhysicalAddress> find_table(StringView signature);
|
||||
ErrorOr<void> full_initialize();
|
||||
|
||||
void try_acpi_reboot();
|
||||
bool can_reboot();
|
||||
@@ -109,7 +110,6 @@ private:
|
||||
|
||||
bool handle_interrupt();
|
||||
|
||||
ErrorOr<void> locate_static_data();
|
||||
ErrorOr<void> locate_main_system_description_table();
|
||||
ErrorOr<void> initialize_main_system_description_table();
|
||||
ErrorOr<size_t> get_table_size(PhysicalAddress);
|
||||
|
||||
Reference in new issue
Block a user