mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
Kernel/Storage: Don't try to enumerate PCI adapters if PCI is disabled
If there's no PCI bus, then it's safe to assume that we run on a x86 machine that has an ISA IDE controller in the system. In such case, we just instantiate a ISAIDEController object that assumes fixed locations of IDE IO ports.
This commit is contained in:
Notes:
sideshowbarker
2024-07-17 18:08:55 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/30eeba1981 Pull-request: https://github.com/SerenityOS/serenity/pull/12046
@@ -16,7 +16,8 @@
|
||||
#include <Kernel/FileSystem/Ext2FileSystem.h>
|
||||
#include <Kernel/Panic.h>
|
||||
#include <Kernel/Storage/ATA/AHCIController.h>
|
||||
#include <Kernel/Storage/ATA/IDEController.h>
|
||||
#include <Kernel/Storage/ATA/ISAIDEController.h>
|
||||
#include <Kernel/Storage/ATA/PCIIDEController.h>
|
||||
#include <Kernel/Storage/NVMe/NVMeController.h>
|
||||
#include <Kernel/Storage/Partition/EBRPartitionTable.h>
|
||||
#include <Kernel/Storage/Partition/GUIDPartitionTable.h>
|
||||
@@ -45,7 +46,7 @@ bool StorageManagement::boot_argument_contains_partition_uuid()
|
||||
return m_boot_argument.starts_with(partition_uuid_prefix);
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT void StorageManagement::enumerate_controllers(bool force_pio, bool nvme_poll)
|
||||
UNMAP_AFTER_INIT void StorageManagement::enumerate_pci_controllers(bool force_pio, bool nvme_poll)
|
||||
{
|
||||
VERIFY(m_controllers.is_empty());
|
||||
|
||||
@@ -77,7 +78,7 @@ UNMAP_AFTER_INIT void StorageManagement::enumerate_controllers(bool force_pio, b
|
||||
|
||||
auto subclass_code = static_cast<SubclassID>(device_identifier.subclass_code().value());
|
||||
if (subclass_code == SubclassID::IDEController && kernel_command_line().is_ide_enabled()) {
|
||||
m_controllers.append(IDEController::initialize(device_identifier, force_pio));
|
||||
m_controllers.append(PCIIDEController::initialize(device_identifier, force_pio));
|
||||
}
|
||||
|
||||
if (subclass_code == SubclassID::SATAController
|
||||
@@ -94,7 +95,6 @@ UNMAP_AFTER_INIT void StorageManagement::enumerate_controllers(bool force_pio, b
|
||||
}
|
||||
});
|
||||
}
|
||||
m_controllers.append(RamdiskController::initialize());
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT void StorageManagement::enumerate_storage_devices()
|
||||
@@ -273,7 +273,16 @@ UNMAP_AFTER_INIT void StorageManagement::initialize(StringView root_device, bool
|
||||
{
|
||||
VERIFY(s_device_minor_number == 0);
|
||||
m_boot_argument = root_device;
|
||||
enumerate_controllers(force_pio, poll);
|
||||
if (PCI::Access::is_disabled()) {
|
||||
// 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());
|
||||
} else {
|
||||
enumerate_pci_controllers(force_pio, poll);
|
||||
}
|
||||
// Note: Whether PCI bus is present on the system or not, always try to attach
|
||||
// a given ramdisk.
|
||||
m_controllers.append(RamdiskController::initialize());
|
||||
enumerate_storage_devices();
|
||||
enumerate_disk_partitions();
|
||||
if (!boot_argument_contains_partition_uuid()) {
|
||||
|
||||
Reference in New Issue
Block a user