2
0
mirror of https://git.missingno.dev/kolibrios-nvme-driver/ synced 2025-01-31 01:30:05 +01:00

feat: implement create_io_completion_queue

This commit is contained in:
Abdur-Rahman Mansoor 2024-06-04 14:44:06 -04:00
parent 80eac9303c
commit 2b9f8d7f37
2 changed files with 30 additions and 0 deletions

View File

@ -128,6 +128,34 @@ proc nvme_identify stdcall, pci:dword, slot:dword, nsid:dword, dptr:dword, cid:w
endp
; See page 101 of the NVMe 1.4 specification for reference
proc create_io_completion_queue stdcall, pci:dword, prp1:dword, qid:word, ien:byte
push esi ebx
mov esi, [pci]
xor ebx, ebx
movzx eax, [ien]
and eax, 10b
or ebx, eax
movzx eax, byte [esi + pcidev.pc]
and eax, 0x1
or ebx, eax ; CDW.PC
mov esi, [esi + pcidev.sq_ptr]
stdcall memset, esi, 0, sizeof.SQ_ENTRY
mov dword [esi + SQ_ENTRY.cdw11], ebx
mov bx, [qid] ; CDW10.QID
or ebx, (sizeof.CQ_ENTRY shl 16) ; CDW10.QSIZE
mov dword [esi + SQ_ENTRY.cdw10], ebx
mov ebx, [prp1]
mov dword [esi + SQ_ENTRY.dptr], ebx
stdcall sqytdbl_write, [pci], [qid], 0 ; setting last param to 0 for now, change later
pop ebx esi
ret
endp
proc detect_nvme
invoke GetPCIList

View File

@ -237,6 +237,8 @@ struct pcidev
sq_ptr dd ?
cq_ptr dd ?
dstrd dd ?
pc db ?
rb 3 ; align
ends
TOTAL_PCIDEVS = 4
TOTAL_PCIDEVS_MALLOC_SZ = TOTAL_PCIDEVS * sizeof.pcidev