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