mirror of
https://git.missingno.dev/kolibrios-nvme-driver/
synced 2025-01-03 03:15:56 +01:00
fix: command wrapping
This commit is contained in:
parent
37b926d2e1
commit
f98d3b95b6
@ -1128,13 +1128,13 @@ proc sqytdbl_write stdcall, pci:dword, y:word, cmd:dword
|
||||
invoke MutexLock
|
||||
|
||||
mov esi, [pci]
|
||||
movzx eax, word [edi + NVM_QUEUE_ENTRY.tail]
|
||||
cmp ax, (NVM_ASQS - 1)
|
||||
mov ax, word [edi + NVM_QUEUE_ENTRY.tail]
|
||||
inc ax
|
||||
cmp ax, NVM_ASQS
|
||||
jb @f
|
||||
xor ax, ax
|
||||
|
||||
@@:
|
||||
inc ax
|
||||
; 1000h + (2y * (4 << CAP.DSTRD))
|
||||
movzx ebx, [y]
|
||||
shl ebx, 1
|
||||
@ -1194,30 +1194,17 @@ proc consume_cq_entries stdcall, pci:dword, queue:dword
|
||||
shl ecx, SIZEOF_NVM_QUEUE_ENTRY
|
||||
mov esi, dword [esi + pcidev.queue_entries]
|
||||
lea esi, [esi + ecx]
|
||||
mov edi, dword [esi + NVM_QUEUE_ENTRY.cq_ptr]
|
||||
movzx eax, word [esi + NVM_QUEUE_ENTRY.tail]
|
||||
movzx ecx, word [esi + NVM_QUEUE_ENTRY.head]
|
||||
;stdcall is_queue_full, eax, ecx
|
||||
;test eax, eax
|
||||
;jnz .end
|
||||
movzx ecx, word [esi + NVM_QUEUE_ENTRY.head]
|
||||
cmp ecx, (NVM_ACQS - 1)
|
||||
jb .loop
|
||||
cmp cx, word [esi + NVM_QUEUE_ENTRY.tail]
|
||||
je .end
|
||||
inc ecx
|
||||
cmp ecx, NVM_ACQS
|
||||
jb @f
|
||||
xor ecx, ecx
|
||||
mov word [esi + NVM_QUEUE_ENTRY.head], cx
|
||||
|
||||
.loop:
|
||||
cmp cx, word [esi + NVM_QUEUE_ENTRY.tail]
|
||||
je .end
|
||||
mov edx, ecx
|
||||
shl edx, SIZEOF_CQ_ENTRY
|
||||
mov ax, word [edi + edx + CQ_ENTRY.status]
|
||||
;DEBUGF DBG_INFO, "Status: 0x%x\n", ax
|
||||
inc cx
|
||||
push ecx
|
||||
@@:
|
||||
stdcall cqyhdbl_write, [pci], [queue], ecx
|
||||
pop ecx
|
||||
jmp .loop
|
||||
|
||||
.end:
|
||||
pop edi esi
|
||||
|
Loading…
Reference in New Issue
Block a user