1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 03:17:35 +00:00

Kernel: Remove "non-operational" ACPI parser state

If we don't support ACPI, just don't instantiate an ACPI parser.
This is way less confusing than having a special parser class whose
only purpose is to do nothing.

We now search for the RSDP in ACPI::initialize() instead of letting
the parser constructor do it. This allows us to defer the decision
to create a parser until we're sure we can make a useful one.
This commit is contained in:
Andreas Kling 2020-04-09 14:31:47 +02:00
parent d95362d8cd
commit 4644217094
13 changed files with 46 additions and 111 deletions

View file

@ -49,17 +49,23 @@ static FeatureLevel determine_feature_level()
void initialize()
{
switch (determine_feature_level()) {
case FeatureLevel::Enabled:
Parser::initialize<DynamicParser>();
break;
case FeatureLevel::Limited:
Parser::initialize<StaticParser>();
break;
case FeatureLevel::Disabled:
Parser::initialize<Parser>();
break;
}
auto feature_level = determine_feature_level();
if (feature_level == FeatureLevel::Disabled)
return;
auto rsdp = StaticParsing::search_rsdp();
if (rsdp.is_null())
return;
if (feature_level == FeatureLevel::Enabled)
Parser::initialize<DynamicParser>(rsdp);
else
Parser::initialize<StaticParser>(rsdp);
}
bool is_enabled()
{
return Parser::the();
}
}