1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 08:38:10 +00:00

Kernel: Wait for NVMe controller to change enabled state

We need to wait up to CAP.TO units of 500ms when changing CC.EN to
enable or disable the controller.
This commit is contained in:
Tom 2022-01-15 13:45:50 -07:00 committed by Brian Gianforcaro
parent 8a879e205b
commit 0d65af5e0f
3 changed files with 61 additions and 15 deletions

View file

@ -10,6 +10,7 @@
#include <AK/NonnullRefPtrVector.h>
#include <AK/OwnPtr.h>
#include <AK/RefPtr.h>
#include <AK/Time.h>
#include <AK/Tuple.h>
#include <AK/Types.h>
#include <Kernel/Bus/PCI/Device.h>
@ -63,6 +64,7 @@ private:
{
m_dbl_stride = (m_controller_regs->cap >> CAP_DBL_SHIFT) & CAP_DBL_MASK;
}
bool wait_for_ready(bool);
private:
PCI::DeviceIdentifier m_pci_device_id;
@ -72,6 +74,7 @@ private:
Memory::TypedMapping<volatile ControllerRegister> m_controller_regs;
bool m_admin_queue_ready { false };
size_t m_device_count {};
AK::Time m_ready_timeout;
u32 m_bar;
u8 m_dbl_stride;
static Atomic<u8> controller_id;