mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 09:00:22 +00:00
Kernel/PCI: Don't use x86 initialization methods in non-x86 builds
Using the IO address space is only relevant for x86 machines, so let's not compile instructions to access the PCI configuration space when we don't target x86 platforms.
This commit is contained in:
parent
4555cac639
commit
0a220a413f
Notes:
sideshowbarker
2024-07-17 06:48:27 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/0a220a413f Pull-request: https://github.com/SerenityOS/serenity/pull/15173 Reviewed-by: https://github.com/linusg
3 changed files with 10 additions and 0 deletions
|
@ -23,6 +23,7 @@ static bool test_pci_io();
|
|||
|
||||
UNMAP_AFTER_INIT static PCIAccessLevel detect_optimal_access_type()
|
||||
{
|
||||
#if ARCH(I386) || ARCH(X86_64)
|
||||
auto boot_determined = kernel_command_line().pci_access_level();
|
||||
if (!ACPI::is_enabled() || !ACPI::Parser::the()->find_table("MCFG"sv).has_value())
|
||||
return PCIAccessLevel::IOAddressing;
|
||||
|
@ -32,6 +33,7 @@ UNMAP_AFTER_INIT static PCIAccessLevel detect_optimal_access_type()
|
|||
|
||||
if (!g_pci_access_io_probe_failed)
|
||||
return PCIAccessLevel::IOAddressing;
|
||||
#endif
|
||||
|
||||
PANIC("No PCI bus access method detected!");
|
||||
}
|
||||
|
@ -44,17 +46,21 @@ UNMAP_AFTER_INIT void initialize()
|
|||
return;
|
||||
switch (detect_optimal_access_type()) {
|
||||
case PCIAccessLevel::MemoryAddressing: {
|
||||
// FIXME: There are other arch-specific methods to find the memory range
|
||||
// for accessing the PCI configuration space.
|
||||
auto mcfg = ACPI::Parser::the()->find_table("MCFG"sv);
|
||||
VERIFY(mcfg.has_value());
|
||||
auto success = Access::initialize_for_multiple_pci_domains(mcfg.value());
|
||||
VERIFY(success);
|
||||
break;
|
||||
}
|
||||
#if ARCH(I386) || ARCH(X86_64)
|
||||
case PCIAccessLevel::IOAddressing: {
|
||||
auto success = Access::initialize_for_one_pci_domain();
|
||||
VERIFY(success);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
|
|
@ -149,8 +149,10 @@ UNMAP_AFTER_INIT PCIAccessLevel CommandLine::pci_access_level() const
|
|||
auto value = lookup("pci"sv).value_or("ecam"sv);
|
||||
if (value == "ecam"sv)
|
||||
return PCIAccessLevel::MemoryAddressing;
|
||||
#if ARCH(I386) || ARCH(X86_64)
|
||||
if (value == "io"sv)
|
||||
return PCIAccessLevel::IOAddressing;
|
||||
#endif
|
||||
if (value == "none"sv)
|
||||
return PCIAccessLevel::None;
|
||||
PANIC("Unknown PCI ECAM setting: {}", value);
|
||||
|
|
|
@ -32,7 +32,9 @@ enum class AcpiFeatureLevel {
|
|||
|
||||
enum class PCIAccessLevel {
|
||||
None,
|
||||
#if ARCH(I386) || ARCH(X86_64)
|
||||
IOAddressing,
|
||||
#endif
|
||||
MemoryAddressing,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue