mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:58:11 +00:00
Kernel/NVMe: Add initial NVMe driver support
Add a basic NVMe driver support to serenity based on NVMe spec 1.4. The driver can support multiple NVMe drives (subsystems). But in a NVMe drive, the driver can support one controller with multiple namespaces. Each core will get a separate NVMe Queue. As the system lacks MSI support, PIN based interrupts are used for IO. Tested the NVMe support by replacing IDE driver with the NVMe driver :^)
This commit is contained in:
parent
602b35aa62
commit
e99fafb683
13 changed files with 946 additions and 0 deletions
|
@ -15,6 +15,7 @@
|
|||
#include <Kernel/Panic.h>
|
||||
#include <Kernel/Storage/ATA/AHCIController.h>
|
||||
#include <Kernel/Storage/ATA/IDEController.h>
|
||||
#include <Kernel/Storage/NVMe/NVMeController.h>
|
||||
#include <Kernel/Storage/Partition/EBRPartitionTable.h>
|
||||
#include <Kernel/Storage/Partition/GUIDPartitionTable.h>
|
||||
#include <Kernel/Storage/Partition/MBRPartitionTable.h>
|
||||
|
@ -61,6 +62,17 @@ UNMAP_AFTER_INIT void StorageManagement::enumerate_controllers(bool force_pio)
|
|||
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)) {
|
||||
auto controller = NVMeController::try_initialize(device_identifier);
|
||||
if (controller.is_error()) {
|
||||
dmesgln("Unable to initialize NVMe controller");
|
||||
} else {
|
||||
m_controllers.append(controller.release_value());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
m_controllers.append(RamdiskController::initialize());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue