mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:17:44 +00: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:
parent
fafa339264
commit
30eeba1981
11 changed files with 283 additions and 142 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue