diff options
author | Liav A <liavalb@gmail.com> | 2022-09-02 10:02:16 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-09-20 18:43:05 +0100 |
commit | 0a220a413f15bc79c5b4ea58df3c018c7395f6c6 (patch) | |
tree | 29a1b3602e2f7de14bbef7d2f0ce858e6a5e279d /Kernel | |
parent | 4555cac63974914c52f711acd2f64ac02e0e9df8 (diff) | |
download | serenity-0a220a413f15bc79c5b4ea58df3c018c7395f6c6.zip |
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.
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Bus/PCI/Initializer.cpp | 6 | ||||
-rw-r--r-- | Kernel/CommandLine.cpp | 2 | ||||
-rw-r--r-- | Kernel/CommandLine.h | 2 |
3 files changed, 10 insertions, 0 deletions
diff --git a/Kernel/Bus/PCI/Initializer.cpp b/Kernel/Bus/PCI/Initializer.cpp index a6a9162368..2ca868014c 100644 --- a/Kernel/Bus/PCI/Initializer.cpp +++ b/Kernel/Bus/PCI/Initializer.cpp @@ -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(); } diff --git a/Kernel/CommandLine.cpp b/Kernel/CommandLine.cpp index b50f776a7e..ad9349f68d 100644 --- a/Kernel/CommandLine.cpp +++ b/Kernel/CommandLine.cpp @@ -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); diff --git a/Kernel/CommandLine.h b/Kernel/CommandLine.h index 618f031088..28a48ac6e0 100644 --- a/Kernel/CommandLine.h +++ b/Kernel/CommandLine.h @@ -32,7 +32,9 @@ enum class AcpiFeatureLevel { enum class PCIAccessLevel { None, +#if ARCH(I386) || ARCH(X86_64) IOAddressing, +#endif MemoryAddressing, }; |