1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 23:57:43 +00:00

Kernel: Simplify scanning BIOS/EBDA and MP parser initialization

Add a MappedROM::find_chunk_starting_with() helper since that's a very
common usage pattern in clients of this code.

Also convert MultiProcessorParser from a persistent singleton object
to a temporary object constructed via a failable factory function.
This commit is contained in:
Andreas Kling 2020-05-22 13:34:53 +02:00
parent 84b7bc5e14
commit 4b847810bf
8 changed files with 47 additions and 101 deletions

View file

@ -129,9 +129,9 @@ PhysicalAddress InterruptManagement::search_for_madt()
{
dbg() << "Early access to ACPI tables for interrupt setup";
auto rsdp = ACPI::StaticParsing::find_rsdp();
if (rsdp.is_null())
if (!rsdp.has_value())
return {};
return ACPI::StaticParsing::find_table(rsdp, "APIC");
return ACPI::StaticParsing::find_table(rsdp.value(), "APIC");
}
InterruptManagement::InterruptManagement()
@ -189,8 +189,10 @@ void InterruptManagement::switch_to_ioapic_mode()
}
APIC::init();
APIC::enable_bsp();
MultiProcessorParser::initialize();
locate_pci_interrupt_overrides();
if (auto mp_parser = MultiProcessorParser::autodetect()) {
m_pci_interrupt_overrides = mp_parser->get_pci_interrupt_redirections();
}
}
void InterruptManagement::locate_apic_data()
@ -231,9 +233,4 @@ void InterruptManagement::locate_apic_data()
}
}
void InterruptManagement::locate_pci_interrupt_overrides()
{
m_pci_interrupt_overrides = MultiProcessorParser::the().get_pci_interrupt_redirections();
}
}