mirror of
https://git.missingno.dev/kolibrios-nvme-driver/
synced 2024-12-22 22:08:47 +01:00
refactor: put nvme_cmd_wait
directly in sqytdbl_write
instead
This also fixes the strange crashing (I think... I have not been able to replicate it) when creating the I/O queues, as I think what happens is since I didn't wait for the I/O completion queue to be created, the CQID may not be valid when creating the I/O submission queue which is why the system weirded out like that.
This commit is contained in:
parent
2fc8e7f34e
commit
bd69938eb8
@ -564,7 +564,6 @@ proc nvme_init stdcall, pci:dword
|
||||
invoke GetPhysAddr
|
||||
; pci:dword, nsid:dword, dptr:dword, cns:byte
|
||||
stdcall nvme_identify, [pci], 0, eax, CNS_IDCS
|
||||
stdcall nvme_cmd_wait, [pci], 0, 0
|
||||
mov edi, ebx
|
||||
lea ebx, byte [edi + IDENTC.sn]
|
||||
lea eax, byte [esi + pcidev.serial]
|
||||
@ -598,8 +597,6 @@ proc nvme_init stdcall, pci:dword
|
||||
mov eax, (NVM_ASQS - 1) or ((NVM_ACQS - 1) shl 16) ; CDW11 (set the number of queues we want)
|
||||
stdcall set_features, [pci], NULLPTR, FID_NUMBER_OF_QUEUES, eax
|
||||
mov esi, dword [p_nvme_devices]
|
||||
;stdcall nvme_wait, dword [esi + pcidev.io_addr]
|
||||
stdcall nvme_cmd_wait, [pci], 0, 1
|
||||
mov esi, dword [esi + pcidev.queue_entries]
|
||||
mov esi, dword [esi + NVM_QUEUE_ENTRY.cq_ptr]
|
||||
mov eax, dword [esi + sizeof.CQ_ENTRY + CQ_ENTRY.cdw0]
|
||||
@ -801,7 +798,10 @@ proc sqytdbl_write stdcall, pci:dword, y:word, cmd:dword
|
||||
DEBUGF DBG_INFO, "(NVMe) Writing to submission queue doorbell register 0x%x: %u\n", dx, ax
|
||||
mov esi, dword [esi + pcidev.io_addr]
|
||||
mov word [esi + edx], ax
|
||||
movzx ecx, [y]
|
||||
mov word [edi + NVM_QUEUE_ENTRY.tail], ax
|
||||
dec ax
|
||||
stdcall nvme_cmd_wait, [pci], ecx, eax
|
||||
pop edi esi ebx
|
||||
ret
|
||||
|
||||
@ -826,12 +826,12 @@ proc pow2 stdcall, x:byte
|
||||
|
||||
endp
|
||||
|
||||
proc nvme_cmd_wait stdcall, pci:dword, y:byte, cid:word
|
||||
proc nvme_cmd_wait stdcall, pci:dword, y:dword, cid:dword
|
||||
|
||||
push esi
|
||||
mov esi, [pci]
|
||||
movzx ecx, [cid]
|
||||
movzx edx, [y]
|
||||
movzx ecx, word [cid]
|
||||
movzx edx, byte [y]
|
||||
imul edx, sizeof.NVM_QUEUE_ENTRY
|
||||
mov esi, dword [esi + pcidev.queue_entries]
|
||||
lea esi, [esi + edx]
|
||||
|
Loading…
Reference in New Issue
Block a user