diff options
author | Liav A <liavalb@gmail.com> | 2022-01-15 09:17:07 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-23 01:12:55 +0100 |
commit | eb9c8f389503cad155b4b025baf7ace7389c7b15 (patch) | |
tree | f8e2843bc38cf2369cd571e728b3898b043ff78b /Kernel/Storage | |
parent | df73e8b46b3b5634320f2f2075954d5d2dad682c (diff) | |
download | serenity-eb9c8f389503cad155b4b025baf7ace7389c7b15.zip |
Kernel/PCI: Add basic support for the VMD PCI bridge device
Diffstat (limited to 'Kernel/Storage')
-rw-r--r-- | Kernel/Storage/StorageManagement.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Kernel/Storage/StorageManagement.cpp b/Kernel/Storage/StorageManagement.cpp index d7a1692756..6bc2eb9d84 100644 --- a/Kernel/Storage/StorageManagement.cpp +++ b/Kernel/Storage/StorageManagement.cpp @@ -9,6 +9,7 @@ #include <AK/UUID.h> #include <Kernel/Bus/PCI/API.h> #include <Kernel/Bus/PCI/Access.h> +#include <Kernel/Bus/PCI/Controller/VolumeManagementDevice.h> #include <Kernel/CommandLine.h> #include <Kernel/Devices/BlockDevice.h> #include <Kernel/FileSystem/Ext2FileSystem.h> @@ -55,6 +56,24 @@ UNMAP_AFTER_INIT void StorageManagement::enumerate_controllers(bool force_pio) return; } + { + static constexpr PCI::HardwareID vmd_device = { 0x8086, 0x9a0b }; + if (device_identifier.hardware_id() == vmd_device) { + auto controller = PCI::VolumeManagementDevice::must_create(device_identifier); + PCI::Access::the().add_host_controller_and_enumerate_attached_devices(move(controller), [this](PCI::DeviceIdentifier const& device_identifier) -> void { + auto subclass_code = static_cast<SubclassID>(device_identifier.subclass_code().value()); + if (subclass_code == SubclassID::NVMeController) { + auto controller = NVMeController::try_initialize(device_identifier); + if (controller.is_error()) { + dmesgln("Unable to initialize NVMe controller: {}", controller.error()); + } else { + m_controllers.append(controller.release_value()); + } + } + }); + } + } + 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)); |