2020-04-09 14:39:10 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, Liav A. <liavalb@hotmail.co.il>
|
|
|
|
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 11:24:48 +03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2020-04-09 14:39:10 +03:00
|
|
|
*/
|
|
|
|
|
2020-04-09 19:17:27 +03:00
|
|
|
#include <Kernel/ACPI/DynamicParser.h>
|
2020-04-09 14:39:10 +03:00
|
|
|
#include <Kernel/CommandLine.h>
|
|
|
|
|
|
|
|
namespace Kernel {
|
|
|
|
namespace ACPI {
|
|
|
|
|
2021-02-19 23:29:46 +03:00
|
|
|
UNMAP_AFTER_INIT void initialize()
|
2020-04-09 14:39:10 +03:00
|
|
|
{
|
2021-03-03 11:51:55 +03:00
|
|
|
auto feature_level = kernel_command_line().acpi_feature_level();
|
|
|
|
if (feature_level == AcpiFeatureLevel::Disabled)
|
2020-04-09 15:31:47 +03:00
|
|
|
return;
|
|
|
|
|
2020-04-09 18:12:58 +03:00
|
|
|
auto rsdp = StaticParsing::find_rsdp();
|
2020-05-22 14:34:53 +03:00
|
|
|
if (!rsdp.has_value())
|
2020-04-09 15:31:47 +03:00
|
|
|
return;
|
|
|
|
|
2021-03-03 11:51:55 +03:00
|
|
|
if (feature_level == AcpiFeatureLevel::Enabled)
|
2020-05-22 14:34:53 +03:00
|
|
|
Parser::initialize<DynamicParser>(rsdp.value());
|
2020-04-09 15:31:47 +03:00
|
|
|
else
|
2020-05-22 14:34:53 +03:00
|
|
|
Parser::initialize<Parser>(rsdp.value());
|
2020-04-09 15:31:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool is_enabled()
|
|
|
|
{
|
|
|
|
return Parser::the();
|
2020-04-09 14:39:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|