From 84a399de5d977009b07652bf2dfefaff163693f8 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Wed, 3 Mar 2021 00:51:55 -0800 Subject: 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. --- Kernel/ACPI/Initialize.cpp | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'Kernel/ACPI/Initialize.cpp') 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(rsdp.value()); else Parser::initialize(rsdp.value()); -- cgit v1.2.3