mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 19:35:06 +00:00
Kernel/ACPI: Return Optional container after table search
This is a better pattern than returning a PhysicalAddress with a zero value, so the code is more understandable now.
This commit is contained in:
parent
43b17f27a3
commit
bde3c7301e
7 changed files with 26 additions and 25 deletions
|
@ -21,7 +21,7 @@ static bool test_pci_io();
|
|||
|
||||
UNMAP_AFTER_INIT static PCIAccessLevel detect_optimal_access_type(PCIAccessLevel boot_determined)
|
||||
{
|
||||
if (!ACPI::is_enabled() || ACPI::Parser::the()->find_table("MCFG").is_null())
|
||||
if (!ACPI::is_enabled() || !ACPI::Parser::the()->find_table("MCFG").has_value())
|
||||
return PCIAccessLevel::IOAddressing;
|
||||
|
||||
if (boot_determined != PCIAccessLevel::IOAddressing)
|
||||
|
@ -39,7 +39,9 @@ UNMAP_AFTER_INIT void initialize()
|
|||
|
||||
switch (detect_optimal_access_type(boot_determined)) {
|
||||
case PCIAccessLevel::MemoryAddressing: {
|
||||
auto success = Access::initialize_for_memory_access(ACPI::Parser::the()->find_table("MCFG"));
|
||||
auto mcfg = ACPI::Parser::the()->find_table("MCFG");
|
||||
VERIFY(mcfg.has_value());
|
||||
auto success = Access::initialize_for_memory_access(mcfg.value());
|
||||
VERIFY(success);
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue