diff options
author | Liav A <liavalb@gmail.com> | 2022-09-03 08:15:32 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-09-20 18:43:05 +0100 |
commit | 948be9674a057658badceb469df14a5e92d818ea (patch) | |
tree | b534c264fbca02b478b17e73829ca989094787da | |
parent | bb6f61ee5d032877ea832611e1516db3489f44ad (diff) | |
download | serenity-948be9674a057658badceb469df14a5e92d818ea.zip |
Kernel: Don't compile ISA IDE controller code in non-x86 builds
The ISA IDE controller code makes sense to be compiled in a x86 build as
it relies on access to the x86 IO space. For other architectures, we can
just omit the code as there's no way we can use that code again.
To ensure we can omit the code easily, we move it to the Arch/x86
directory.
-rw-r--r-- | Kernel/Arch/x86/ISABus/IDEController.cpp (renamed from Kernel/Storage/ATA/GenericIDE/ISAController.cpp) | 2 | ||||
-rw-r--r-- | Kernel/Arch/x86/ISABus/IDEController.h (renamed from Kernel/Storage/ATA/GenericIDE/ISAController.h) | 0 | ||||
-rw-r--r-- | Kernel/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Kernel/Storage/ATA/GenericIDE/Channel.cpp | 2 | ||||
-rw-r--r-- | Kernel/Storage/ATA/GenericIDE/Channel.h | 4 | ||||
-rw-r--r-- | Kernel/Storage/StorageManagement.cpp | 7 |
6 files changed, 14 insertions, 3 deletions
diff --git a/Kernel/Storage/ATA/GenericIDE/ISAController.cpp b/Kernel/Arch/x86/ISABus/IDEController.cpp index ee8c48520b..b8b0e17e0d 100644 --- a/Kernel/Storage/ATA/GenericIDE/ISAController.cpp +++ b/Kernel/Arch/x86/ISABus/IDEController.cpp @@ -6,13 +6,13 @@ #include <AK/OwnPtr.h> #include <AK/Types.h> +#include <Kernel/Arch/x86/ISABus/IDEController.h> #include <Kernel/Bus/PCI/API.h> #include <Kernel/FileSystem/ProcFS.h> #include <Kernel/Library/LockRefPtr.h> #include <Kernel/Sections.h> #include <Kernel/Storage/ATA/ATADiskDevice.h> #include <Kernel/Storage/ATA/GenericIDE/Channel.h> -#include <Kernel/Storage/ATA/GenericIDE/ISAController.h> namespace Kernel { diff --git a/Kernel/Storage/ATA/GenericIDE/ISAController.h b/Kernel/Arch/x86/ISABus/IDEController.h index 9be7b3b37e..9be7b3b37e 100644 --- a/Kernel/Storage/ATA/GenericIDE/ISAController.h +++ b/Kernel/Arch/x86/ISABus/IDEController.h diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt index 0752e2245e..cb37e56307 100644 --- a/Kernel/CMakeLists.txt +++ b/Kernel/CMakeLists.txt @@ -95,7 +95,6 @@ set(KERNEL_SOURCES Storage/ATA/AHCI/InterruptHandler.cpp Storage/ATA/GenericIDE/Controller.cpp Storage/ATA/GenericIDE/Channel.cpp - Storage/ATA/GenericIDE/ISAController.cpp Storage/ATA/GenericIDE/PCIController.cpp Storage/ATA/ATAController.cpp Storage/ATA/ATADevice.cpp @@ -340,6 +339,7 @@ if ("${SERENITY_ARCH}" STREQUAL "i686" OR "${SERENITY_ARCH}" STREQUAL "x86_64") Arch/x86/Hypervisor/VMWareBackdoor.cpp + Arch/x86/ISABus/IDEController.cpp Arch/x86/PCI/Controller/HostBridge.cpp Arch/x86/PCI/Initializer.cpp ) diff --git a/Kernel/Storage/ATA/GenericIDE/Channel.cpp b/Kernel/Storage/ATA/GenericIDE/Channel.cpp index feda770ba2..b4e3e645a8 100644 --- a/Kernel/Storage/ATA/GenericIDE/Channel.cpp +++ b/Kernel/Storage/ATA/GenericIDE/Channel.cpp @@ -86,10 +86,12 @@ ErrorOr<void> IDEChannel::allocate_resources_for_pci_ide_controller(Badge<PCIIDE { return allocate_resources(force_pio); } +#if ARCH(I386) || ARCH(X86_64) ErrorOr<void> IDEChannel::allocate_resources_for_isa_ide_controller(Badge<ISAIDEController>) { return allocate_resources(false); } +#endif UNMAP_AFTER_INIT ErrorOr<void> IDEChannel::allocate_resources(bool force_pio) { diff --git a/Kernel/Storage/ATA/GenericIDE/Channel.h b/Kernel/Storage/ATA/GenericIDE/Channel.h index d77a2b3bf3..5c5f1715b2 100644 --- a/Kernel/Storage/ATA/GenericIDE/Channel.h +++ b/Kernel/Storage/ATA/GenericIDE/Channel.h @@ -37,7 +37,9 @@ class AsyncBlockDeviceRequest; class IDEController; class PCIIDEController; +#if ARCH(I386) || ARCH(X86_64) class ISAIDEController; +#endif class IDEChannel : public ATAPort , public IRQHandler { @@ -111,7 +113,9 @@ public: virtual StringView purpose() const override { return "PATA Channel"sv; } ErrorOr<void> allocate_resources_for_pci_ide_controller(Badge<PCIIDEController>, bool force_pio); +#if ARCH(I386) || ARCH(X86_64) ErrorOr<void> allocate_resources_for_isa_ide_controller(Badge<ISAIDEController>); +#endif private: static constexpr size_t m_logical_sector_size = 512; diff --git a/Kernel/Storage/StorageManagement.cpp b/Kernel/Storage/StorageManagement.cpp index d1648a8b81..e36bf0ade4 100644 --- a/Kernel/Storage/StorageManagement.cpp +++ b/Kernel/Storage/StorageManagement.cpp @@ -6,9 +6,13 @@ */ #include <AK/IterationDecision.h> +#include <AK/Platform.h> #include <AK/Singleton.h> #include <AK/StringView.h> #include <AK/UUID.h> +#if ARCH(I386) || ARCH(X86_64) +# include <Kernel/Arch/x86/ISABus/IDEController.h> +#endif #include <Kernel/Bus/PCI/API.h> #include <Kernel/Bus/PCI/Access.h> #include <Kernel/Bus/PCI/Controller/VolumeManagementDevice.h> @@ -19,7 +23,6 @@ #include <Kernel/Panic.h> #include <Kernel/Storage/ATA/AHCI/Controller.h> #include <Kernel/Storage/ATA/GenericIDE/Controller.h> -#include <Kernel/Storage/ATA/GenericIDE/ISAController.h> #include <Kernel/Storage/ATA/GenericIDE/PCIController.h> #include <Kernel/Storage/NVMe/NVMeController.h> #include <Kernel/Storage/Ramdisk/Controller.h> @@ -429,9 +432,11 @@ UNMAP_AFTER_INIT void StorageManagement::initialize(StringView root_device, bool VERIFY(s_storage_device_minor_number == 0); m_boot_argument = root_device; if (PCI::Access::is_disabled()) { +#if ARCH(I386) || ARCH(X86_64) // Note: If PCI is disabled, we assume that at least we have an ISA IDE controller // to probe and use m_controllers.append(ISAIDEController::initialize()); +#endif } else { enumerate_pci_controllers(force_pio, poll); } |