diff options
author | Brian Gianforcaro <b.gianfo@gmail.com> | 2021-03-03 00:51:55 -0800 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-03 11:05:16 +0100 |
commit | 84a399de5d977009b07652bf2dfefaff163693f8 (patch) | |
tree | 1ec685482477ecf8177dcf68ac0190e8a7ff3fbe /Kernel/ACPI/Initialize.cpp | |
parent | 74881ac649742ea5b1b34c78ee365440e04ef046 (diff) | |
download | serenity-84a399de5d977009b07652bf2dfefaff163693f8.zip |
Kernel: Move Kernel CommandLine parsing to strongly typed API.
Previously all of the CommandLine parsing was spread out around the
Kernel. Instead move it all into the Kernel CommandLine class, and
expose a strongly typed API for querying the state of options.
Diffstat (limited to 'Kernel/ACPI/Initialize.cpp')
-rw-r--r-- | Kernel/ACPI/Initialize.cpp | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/Kernel/ACPI/Initialize.cpp b/Kernel/ACPI/Initialize.cpp index 8249549170..539b5992ee 100644 --- a/Kernel/ACPI/Initialize.cpp +++ b/Kernel/ACPI/Initialize.cpp @@ -31,33 +31,17 @@ namespace Kernel { namespace ACPI { -enum class FeatureLevel { - Enabled, - Limited, - Disabled, -}; - -UNMAP_AFTER_INIT static FeatureLevel determine_feature_level() -{ - auto value = kernel_command_line().lookup("acpi").value_or("on"); - if (value == "limited") - return FeatureLevel::Limited; - if (value == "off") - return FeatureLevel::Disabled; - return FeatureLevel::Enabled; -} - UNMAP_AFTER_INIT void initialize() { - auto feature_level = determine_feature_level(); - if (feature_level == FeatureLevel::Disabled) + 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; - if (feature_level == FeatureLevel::Enabled) + if (feature_level == AcpiFeatureLevel::Enabled) Parser::initialize<DynamicParser>(rsdp.value()); else Parser::initialize<Parser>(rsdp.value()); |