2
0
mirror of https://git.missingno.dev/kolibrios-nvme-driver/ synced 2025-01-03 03:15:56 +01:00

another fix for shutdown

This commit is contained in:
Abdur-Rahman Mansoor 2024-08-11 15:37:37 -04:00
parent 96fcd601b3
commit 588d4a958c
2 changed files with 10 additions and 7 deletions

View File

@ -78,7 +78,7 @@ proc create_io_submission_queue stdcall, pci:dword, prp1:dword, qid:dword, cqid:
mov dword [esi + pcidev.spinlock], 1
sub esp, sizeof.SQ_ENTRY
stdcall memsetdz, esp, sizeof.SQ_ENTRY / 4
stdcall set_cdw0, [pci], ADMIN_QUEUE, ADM_CMD_CRE_IO_SUBMISSION_QUEUE
stdcall set_cdw0, esi, ADMIN_QUEUE, ADM_CMD_CRE_IO_SUBMISSION_QUEUE
mov dword [esp + SQ_ENTRY.cdw0], eax
mov eax, [prp1]
mov dword [esp + SQ_ENTRY.prp1], eax
@ -106,13 +106,13 @@ proc abort stdcall, pci:dword, cid:word, sqid:word
mov dword [esi + pcidev.spinlock], 1
sub esp, sizeof.SQ_ENTRY
stdcall memsetdz, esp, sizeof.SQ_ENTRY / 4
stdcall set_cdw0, [pci], ADMIN_QUEUE, ADM_CMD_ABORT
stdcall set_cdw0, esi, ADMIN_QUEUE, ADM_CMD_ABORT
mov dword [esp + SQ_ENTRY.cdw0], eax
movzx eax, [cid]
shl eax, 16
or eax, word [sqid]
mov dword [esp + SQ_ENTRY.cdw10], eax
stdcall sqytdbl_write, [pci], ADMIN_QUEUE, esp
stdcall sqytdbl_write, esi, ADMIN_QUEUE, esp
add esp, sizeof.SQ_ENTRY
stdcall nvme_poll, esi
pop esi
@ -149,11 +149,11 @@ proc delete_io_completion_queue stdcall, pci:dword, qid:word
mov dword [esi + pcidev.spinlock], 1
sub esp, sizeof.SQ_ENTRY
stdcall memsetdz, esp, sizeof.SQ_ENTRY / 4
stdcall set_cdw0, [pci], ADMIN_QUEUE, ADM_CMD_DEL_IO_COMPLETION_QUEUE
stdcall set_cdw0, esi, ADMIN_QUEUE, ADM_CMD_DEL_IO_COMPLETION_QUEUE
mov dword [esp + SQ_ENTRY.cdw0], eax
mov ax, [qid]
mov word [esp + SQ_ENTRY.cdw10], ax
stdcall sqytdbl_write, [pci], ADMIN_QUEUE, esp
stdcall sqytdbl_write, esi, ADMIN_QUEUE, esp
add esp, sizeof.SQ_ENTRY
stdcall nvme_poll, esi
pop esi
@ -190,11 +190,11 @@ proc delete_io_submission_queue stdcall, pci:dword, qid:word
mov dword [esi + pcidev.spinlock], 1
sub esp, sizeof.SQ_ENTRY
stdcall memsetdz, esp, sizeof.SQ_ENTRY / 4
stdcall set_cdw0, [pci], ADMIN_QUEUE, ADM_CMD_DEL_IO_SUBMISSION_QUEUE
stdcall set_cdw0, esi, ADMIN_QUEUE, ADM_CMD_DEL_IO_SUBMISSION_QUEUE
mov dword [esp + SQ_ENTRY.cdw0], eax
mov ax, [qid]
mov word [esp + SQ_ENTRY.cdw10], ax
stdcall sqytdbl_write, [pci], ADMIN_QUEUE, esp
stdcall sqytdbl_write, esi, ADMIN_QUEUE, esp
add esp, sizeof.SQ_ENTRY
stdcall nvme_poll, esi
pop esi

View File

@ -1254,6 +1254,7 @@ endp
proc nvme_cleanup
DEBUGF DBG_INFO, "nvme: Cleaning up...\n"
push ebx esi edi
mov esi, dword [p_nvme_devices]
test esi, esi
@ -1291,6 +1292,7 @@ proc nvme_cleanup
cmp ebx, LAST_QUEUE_ID
jbe .get_queue
pop ebx
inc ebx
cmp ebx, dword [pcidevs_len]
jne .get_pcidev
@ -1300,6 +1302,7 @@ proc nvme_cleanup
and eax, not CC_SHN
or eax, CC_SHN_NORMAL_SHUTDOWN
mov dword [edi + NVME_MMIO.CC], eax
stdcall nvme_disable_ctrl, esi
; Wait for shutdown processing to complete
@@: