2
0
mirror of https://git.missingno.dev/kolibrios-nvme-driver/ synced 2024-12-22 22:08:47 +01:00

fix: allocate appropriate number of pages

This commit is contained in:
Abdur-Rahman Mansoor 2024-05-28 12:26:27 -04:00
parent e7e5ac98f0
commit a181eccd9c
2 changed files with 8 additions and 6 deletions

View File

@ -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

View File

@ -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