|
@@ -46,28 +46,28 @@ bool StorageManagement::boot_argument_contains_partition_uuid()
|
|
|
UNMAP_AFTER_INIT void StorageManagement::enumerate_controllers(bool force_pio)
|
|
|
{
|
|
|
VERIFY(m_controllers.is_empty());
|
|
|
+
|
|
|
+ using SubclassID = PCI::MassStorage::SubclassID;
|
|
|
if (!kernel_command_line().disable_physical_storage()) {
|
|
|
- if (kernel_command_line().is_ide_enabled()) {
|
|
|
- PCI::enumerate([&](PCI::DeviceIdentifier const& device_identifier) {
|
|
|
- if (device_identifier.class_code().value() == to_underlying(PCI::ClassID::MassStorage)
|
|
|
- && device_identifier.subclass_code().value() == to_underlying(PCI::MassStorage::SubclassID::IDEController)) {
|
|
|
- m_controllers.append(IDEController::initialize(device_identifier, force_pio));
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
+
|
|
|
PCI::enumerate([&](PCI::DeviceIdentifier const& device_identifier) {
|
|
|
- if (device_identifier.class_code().value() == to_underlying(PCI::ClassID::MassStorage)
|
|
|
- && device_identifier.subclass_code().value() == to_underlying(PCI::MassStorage::SubclassID::SATAController)
|
|
|
+ if (device_identifier.class_code().value() != to_underlying(PCI::ClassID::MassStorage)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ 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));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (subclass_code == SubclassID::SATAController
|
|
|
&& device_identifier.prog_if().value() == to_underlying(PCI::MassStorage::SATAProgIF::AHCI)) {
|
|
|
m_controllers.append(AHCIController::initialize(device_identifier));
|
|
|
}
|
|
|
- });
|
|
|
- PCI::enumerate([&](PCI::DeviceIdentifier const& device_identifier) {
|
|
|
- if (device_identifier.class_code().value() == to_underlying(PCI::ClassID::MassStorage)
|
|
|
- && device_identifier.subclass_code().value() == to_underlying(PCI::MassStorage::SubclassID::NVMeController)) {
|
|
|
+ if (subclass_code == SubclassID::NVMeController) {
|
|
|
auto controller = NVMeController::try_initialize(device_identifier);
|
|
|
if (controller.is_error()) {
|
|
|
- dmesgln("Unable to initialize NVMe controller");
|
|
|
+ dmesgln("Unable to initialize NVMe controller: {}", controller.error());
|
|
|
} else {
|
|
|
m_controllers.append(controller.release_value());
|
|
|
}
|