2
0
mirror of https://git.missingno.dev/kolibrios-nvme-driver/ synced 2025-01-03 11:25:55 +01:00

feat: implement create_io_submission_queue

This commit is contained in:
Abdur-Rahman Mansoor 2024-06-04 15:02:44 -04:00
parent 2b9f8d7f37
commit 021012d350

View File

@ -143,6 +143,7 @@ proc create_io_completion_queue stdcall, pci:dword, prp1:dword, qid:word, ien:by
or ebx, eax ; CDW.PC or ebx, eax ; CDW.PC
mov esi, [esi + pcidev.sq_ptr] mov esi, [esi + pcidev.sq_ptr]
stdcall memset, esi, 0, sizeof.SQ_ENTRY stdcall memset, esi, 0, sizeof.SQ_ENTRY
; Since we are not using MSI-X or MSI vector (yet), CDW11.IV must be set to 0
mov dword [esi + SQ_ENTRY.cdw11], ebx mov dword [esi + SQ_ENTRY.cdw11], ebx
mov bx, [qid] ; CDW10.QID mov bx, [qid] ; CDW10.QID
or ebx, (sizeof.CQ_ENTRY shl 16) ; CDW10.QSIZE or ebx, (sizeof.CQ_ENTRY shl 16) ; CDW10.QSIZE
@ -156,6 +157,34 @@ proc create_io_completion_queue stdcall, pci:dword, prp1:dword, qid:word, ien:by
endp endp
; See page 103-104 of the NVMe 1.4 specification for reference
proc create_io_submission_queue stdcall, pci:dword, prp1:dword, qid:word, cqid:word
push esi ebx
mov esi, [pci]
movzx ebx, byte [esi + pcidev.pc]
and ebx, 0x1 ; CDW11.PC
mov esi, [esi + pcidev.sq_ptr]
stdcall memset, esi, 0, sizeof.SQ_ENTRY
movzx eax, [cqid]
shl eax, 16
or ebx, eax ; CDW11.CQID
; TODO: Set CDW10.QPRIO
mov dword [esi + SQ_ENTRY.cdw11], ebx
movzx ebx, sizeof.SQ_ENTRY
shl ebx, 16 ; CDW10.QSIZE
or ebx, [qid] ; CDW10.QID
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 proc detect_nvme
invoke GetPCIList invoke GetPCIList