1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +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

@ -36,13 +36,11 @@
namespace Kernel {
namespace PCI {
static bool test_acpi();
static bool test_pci_io();
static bool test_pci_mmio();
static Access::Type detect_optimal_access_type(bool mmio_allowed)
{
if (mmio_allowed && test_acpi() && test_pci_mmio())
if (mmio_allowed && ACPI::is_enabled() && !ACPI::Parser::the()->find_table("MCFG").is_null())
return Access::Type::MMIO;
if (test_pci_io())
@ -57,7 +55,7 @@ void initialize()
bool mmio_allowed = kernel_command_line().lookup("pci_mmio").value_or("off") == "on";
if (detect_optimal_access_type(mmio_allowed) == Access::Type::MMIO)
MMIOAccess::initialize(ACPI::Parser::the().find_table("MCFG"));
MMIOAccess::initialize(ACPI::Parser::the()->find_table("MCFG"));
else
IOAccess::initialize();
@ -68,13 +66,6 @@ void initialize()
});
}
bool test_acpi()
{
if ((kernel_command_line().contains("noacpi")) || !ACPI::Parser::the().is_operable())
return false;
return true;
}
bool test_pci_io()
{
klog() << "Testing PCI via manual probing... ";
@ -90,10 +81,5 @@ bool test_pci_io()
return false;
}
bool test_pci_mmio()
{
return !ACPI::Parser::the().find_table("MCFG").is_null();
}
}
}