2
0
mirror of https://git.missingno.dev/kolibrios-nvme-driver/ synced 2026-03-09 12:53:24 +00:00

refactor: remove use of mutexes

We're not using asynchronous API at the moment anyways, so there's no
point in having them right now.
This commit is contained in:
2024-08-10 13:32:31 -04:00
parent f98d3b95b6
commit 435dea90dc

View File

@@ -992,7 +992,7 @@ proc get_new_cid stdcall, pci:dword, y:dword
mov ecx, [y]
shl ecx, SIZEOF_NVM_QUEUE_ENTRY
movzx eax, word [eax + ecx + NVM_QUEUE_ENTRY.head]
DEBUGF DBG_INFO, "get_new_cid: %u\n", eax
;DEBUGF DBG_INFO, "get_new_cid: %u\n", eax
ret
endp
@@ -1092,12 +1092,12 @@ proc cqyhdbl_write stdcall, pci:dword, y:dword, cqh:dword
mov word [edi + NVM_QUEUE_ENTRY.head], ax
; Unlock the mutex now that the command is complete
mov edi, dword [edi + NVM_QUEUE_ENTRY.cmd_ptr]
mov ecx, [cqh]
shl ecx, SIZEOF_NVMQCMD
add edi, ecx
mov ecx, dword [edi + NVMQCMD.mutex_ptr]
invoke MutexUnlock
;mov edi, dword [edi + NVM_QUEUE_ENTRY.cmd_ptr]
;mov ecx, [cqh]
;shl ecx, SIZEOF_NVMQCMD
;add edi, ecx
;mov ecx, dword [edi + NVMQCMD.mutex_ptr]
;invoke MutexUnlock
pop edi esi
ret
@@ -1113,7 +1113,7 @@ proc sqytdbl_write stdcall, pci:dword, y:word, cmd:dword
movzx ebx, [y]
shl ebx, SIZEOF_NVM_QUEUE_ENTRY
lea edi, [edi + ebx]
mov eax, dword [edi + NVM_QUEUE_ENTRY.cmd_ptr]
;mov eax, dword [edi + NVM_QUEUE_ENTRY.cmd_ptr]
mov edx, dword [edi + NVM_QUEUE_ENTRY.sq_ptr]
mov esi, [cmd]
mov ecx, dword [esi + SQ_ENTRY.cdw0]
@@ -1124,8 +1124,8 @@ proc sqytdbl_write stdcall, pci:dword, y:word, cmd:dword
shl ecx, SIZEOF_SQ_ENTRY
lea edx, [edx + ecx]
stdcall memcpyd, edx, esi, sizeof.SQ_ENTRY / 4
mov ecx, dword [ebx + NVMQCMD.mutex_ptr]
invoke MutexLock
;mov ecx, dword [ebx + NVMQCMD.mutex_ptr]
;invoke MutexLock
mov esi, [pci]
mov ax, word [edi + NVM_QUEUE_ENTRY.tail]
@@ -1229,13 +1229,7 @@ proc irq_handler
ja .not_our_irq
mov edi, dword [esi + pcidev.io_addr]
mov dword [edi + NVME_MMIO.INTMS], 0x3
;mov eax, dword [esi + pcidev.spinlock]
;test eax, eax
;jz @f ; not locked, so it must be an I/O command
stdcall consume_cq_entries, esi, 0
@@:
stdcall consume_cq_entries, esi, 1
; Interrupt handled by driver, return 1