2
0
mirror of https://git.missingno.dev/kolibrios-nvme-driver/ synced 2025-02-01 18:10:29 +01:00

lock and unlock mutex for asynchronous API

This commit is contained in:
Abdur-Rahman Mansoor 2024-08-08 13:03:52 -04:00
parent 7be08b3e44
commit ef7f1d3459
2 changed files with 12 additions and 1 deletions

View File

@ -1080,6 +1080,15 @@ proc cqyhdbl_write stdcall, pci:dword, y:dword, cqh:dword
mov esi, dword [esi + pcidev.io_addr]
mov word [esi + edx], ax ; Write to CQyHDBL
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
pop edi esi
ret
@ -1106,7 +1115,7 @@ proc sqytdbl_write stdcall, pci:dword, y:word, cmd:dword
lea edx, [edx + ecx]
stdcall memcpyd, edx, esi, sizeof.SQ_ENTRY / 4
mov ecx, dword [ebx + NVMQCMD.mutex_ptr]
;invoke MutexLock
invoke MutexLock
mov esi, [pci]
movzx eax, word [edi + NVM_QUEUE_ENTRY.tail]

View File

@ -30,6 +30,7 @@ QUEUE_ALLOC_SIZE = SQ_ALLOC_SIZE + CQ_ALLOC_SIZE
SIZEOF_SQ_ENTRY = 6 ; log2(sizeof.SQ_ENTRY)
SIZEOF_CQ_ENTRY = 4 ; log2(sizeof.CQ_ENTRY)
SIZEOF_NVM_QUEUE_ENTRY = 4 ; log2(sizeof.NVM_QUEUE_ENTRY)
SIZEOF_NVMQCMD = 4 ; log2(sizeof.NVMQCMD)
MSIXCAP_CID = 0x11
MSIXCAP_MXE = 1 shl 15 ; MSI-X Enable bit
@ -570,6 +571,7 @@ assert sizeof.CQ_ENTRY = 16
assert sizeof.IDENTC = 4096
assert sizeof.IDENTN = 4096
assert sizeof.NSGRANLS = 288
assert sizeof.NVMQCMD = 16
assert SIZEOF_SQ_ENTRY = 6
assert SIZEOF_CQ_ENTRY = 4
assert (SQ_ENTRIES * sizeof.SQ_ENTRY) mod PAGE_SIZE = 0