mirror of
https://git.missingno.dev/kolibrios-nvme-driver/
synced 2025-02-08 13:16:52 +01:00
lock and unlock mutex for asynchronous API
This commit is contained in:
parent
7be08b3e44
commit
ef7f1d3459
@ -1080,6 +1080,15 @@ proc cqyhdbl_write stdcall, pci:dword, y:dword, cqh:dword
|
|||||||
mov esi, dword [esi + pcidev.io_addr]
|
mov esi, dword [esi + pcidev.io_addr]
|
||||||
mov word [esi + edx], ax ; Write to CQyHDBL
|
mov word [esi + edx], ax ; Write to CQyHDBL
|
||||||
mov word [edi + NVM_QUEUE_ENTRY.head], ax
|
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
|
pop edi esi
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -1106,7 +1115,7 @@ proc sqytdbl_write stdcall, pci:dword, y:word, cmd:dword
|
|||||||
lea edx, [edx + ecx]
|
lea edx, [edx + ecx]
|
||||||
stdcall memcpyd, edx, esi, sizeof.SQ_ENTRY / 4
|
stdcall memcpyd, edx, esi, sizeof.SQ_ENTRY / 4
|
||||||
mov ecx, dword [ebx + NVMQCMD.mutex_ptr]
|
mov ecx, dword [ebx + NVMQCMD.mutex_ptr]
|
||||||
;invoke MutexLock
|
invoke MutexLock
|
||||||
|
|
||||||
mov esi, [pci]
|
mov esi, [pci]
|
||||||
movzx eax, word [edi + NVM_QUEUE_ENTRY.tail]
|
movzx eax, word [edi + NVM_QUEUE_ENTRY.tail]
|
||||||
|
@ -30,6 +30,7 @@ QUEUE_ALLOC_SIZE = SQ_ALLOC_SIZE + CQ_ALLOC_SIZE
|
|||||||
SIZEOF_SQ_ENTRY = 6 ; log2(sizeof.SQ_ENTRY)
|
SIZEOF_SQ_ENTRY = 6 ; log2(sizeof.SQ_ENTRY)
|
||||||
SIZEOF_CQ_ENTRY = 4 ; log2(sizeof.CQ_ENTRY)
|
SIZEOF_CQ_ENTRY = 4 ; log2(sizeof.CQ_ENTRY)
|
||||||
SIZEOF_NVM_QUEUE_ENTRY = 4 ; log2(sizeof.NVM_QUEUE_ENTRY)
|
SIZEOF_NVM_QUEUE_ENTRY = 4 ; log2(sizeof.NVM_QUEUE_ENTRY)
|
||||||
|
SIZEOF_NVMQCMD = 4 ; log2(sizeof.NVMQCMD)
|
||||||
|
|
||||||
MSIXCAP_CID = 0x11
|
MSIXCAP_CID = 0x11
|
||||||
MSIXCAP_MXE = 1 shl 15 ; MSI-X Enable bit
|
MSIXCAP_MXE = 1 shl 15 ; MSI-X Enable bit
|
||||||
@ -570,6 +571,7 @@ assert sizeof.CQ_ENTRY = 16
|
|||||||
assert sizeof.IDENTC = 4096
|
assert sizeof.IDENTC = 4096
|
||||||
assert sizeof.IDENTN = 4096
|
assert sizeof.IDENTN = 4096
|
||||||
assert sizeof.NSGRANLS = 288
|
assert sizeof.NSGRANLS = 288
|
||||||
|
assert sizeof.NVMQCMD = 16
|
||||||
assert SIZEOF_SQ_ENTRY = 6
|
assert SIZEOF_SQ_ENTRY = 6
|
||||||
assert SIZEOF_CQ_ENTRY = 4
|
assert SIZEOF_CQ_ENTRY = 4
|
||||||
assert (SQ_ENTRIES * sizeof.SQ_ENTRY) mod PAGE_SIZE = 0
|
assert (SQ_ENTRIES * sizeof.SQ_ENTRY) mod PAGE_SIZE = 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user