From a181eccd9cf3e72433d94cc802f6750d00c2ba28 Mon Sep 17 00:00:00 2001 From: Abdur-Rahman Mansoor Date: Tue, 28 May 2024 12:26:27 -0400 Subject: [PATCH] fix: allocate appropriate number of pages --- drivers/nvme/nvme.asm | 8 ++++---- drivers/nvme/nvme.inc | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/nvme/nvme.asm b/drivers/nvme/nvme.asm index 8886bf6..7a70a08 100644 --- a/drivers/nvme/nvme.asm +++ b/drivers/nvme/nvme.asm @@ -265,25 +265,25 @@ proc nvme_init stdcall, pci:dword ; Configure IOSQES, IOCQES, MPS, CSS mov eax, dword [edi + NVME_MMIO.CC] + and eax, not (CC_IOSQES or CC_IOCQES or CC_MPS or CC_CSS) or eax, (4 shl 16) or (6 shl 20) - and eax, not (CC_MPS or CC_CSS) mov dword [edi + NVME_MMIO.CC], eax ; Configure Admin Queue Attributes mov eax, dword [edi + NVME_MMIO.AQA] and eax, not (AQA_ASQS or AQA_ACQS) - or eax, 2 or (2 shl 16) + or eax, NVM_ASQS or (NVM_ACQS shl 16) mov dword [edi + NVME_MMIO.AQA], eax ; Configure Admin Submission/Completion Queue Base Address - invoke AllocPage + invoke AllocPages, NVM_ASQS test eax, eax jz .exit_fail ;or eax, PG_SW or PG_NOCACHE mov dword [edi + NVME_MMIO.ASQ], eax and dword [edi + NVME_MMIO.ASQ + 4], 0 DEBUGF DBG_INFO, "(NVMe) ASQ = 0x%x\n", eax - invoke AllocPage + invoke AllocPages, NVM_ACQS test eax, eax jz .exit_fail ;or eax, PG_SW or PG_NOCACHE diff --git a/drivers/nvme/nvme.inc b/drivers/nvme/nvme.inc index fee26da..2b9a9e6 100644 --- a/drivers/nvme/nvme.inc +++ b/drivers/nvme/nvme.inc @@ -9,9 +9,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Supported NVMe Controller Version -NVM_SUPPORTED_CONTROLLER_VERSION = 0x00010400 ; (v1.4) +NVM_SUPPORTED_CONTROLLER_VERSION = 0x00010400 ; (v1.4.0) -NVM_MPS = 0 +NVM_MPS = 0 ; Memory Page Size (2 ^ (12 + MPS)) +NVM_ASQS = 2 ; Admin Submission Queue Size +NVM_ACQS = NVM_ASQS ; Admin Completion Queue Size ; Opcodes for NVM commands NVM_CMD_FLUSH = 0x00