mirror of
https://git.missingno.dev/kolibrios-nvme-driver/
synced 2025-01-22 05:08:16 +01:00
fix: write command and nvme_cmd_wait hanging
This commit is contained in:
parent
76f94d74e1
commit
2d1e0d4aa4
@ -445,7 +445,7 @@ proc get_log_page stdcall, pci:dword, dptr:dword, lid:byte
|
||||
endp
|
||||
|
||||
; See page 269-271 of the NVMe 1.4 specification for reference
|
||||
proc nvme_write stdcall, pci:dword, qid:word, nsid:dword, dptr:dword, slba:qword, nlb:word
|
||||
proc nvme_write stdcall, pci:dword, qid:word, nsid:dword, dptr:dword, slba_lo:dword, slba_hi:dword, nlb:word
|
||||
|
||||
; TODO: Use IDENTC.NOIOB to construct read/write commands that don't
|
||||
; cross the I/O boundary to achieve optimal performance
|
||||
@ -460,9 +460,9 @@ proc nvme_write stdcall, pci:dword, qid:word, nsid:dword, dptr:dword, slba:qword
|
||||
mov dword [esp + SQ_ENTRY.dptr], eax
|
||||
mov eax, [nsid]
|
||||
mov dword [esp + SQ_ENTRY.nsid], eax
|
||||
mov eax, dword [slba]
|
||||
mov eax, [slba_lo]
|
||||
mov dword [esp + SQ_ENTRY.cdw10], eax
|
||||
mov eax, 0 ; SLBA + 32 (fix later)
|
||||
mov eax, [slba_hi] ; SLBA + 32 (fix later)
|
||||
mov dword [esp + SQ_ENTRY.cdw11], eax
|
||||
movzx eax, [nlb]
|
||||
mov word [esp + SQ_ENTRY.cdw12], ax
|
||||
@ -822,12 +822,11 @@ proc nvme_init stdcall, pci:dword
|
||||
DEBUGF DBG_INFO, "nvme%un%u: Namespace LBA Data Size: %u\n", [esi + pcidev.num], [esi + pcidev.nsid], eax
|
||||
invoke KernelFree, edi
|
||||
|
||||
;mov eax, test_string
|
||||
invoke KernelAlloc, 0x1000
|
||||
test eax, eax
|
||||
jz .exit_fail
|
||||
invoke GetPhysAddr
|
||||
stdcall nvme_write, [pci], 1, [esi + pcidev.nsid], eax, 1, 1
|
||||
stdcall nvme_write, [pci], 1, [esi + pcidev.nsid], eax, 0, 0, 1
|
||||
DEBUGF DBG_INFO, "nvme%u: Successfully initialized driver\n", [esi + pcidev.num]
|
||||
xor eax, eax
|
||||
inc eax
|
||||
@ -981,6 +980,7 @@ proc sqytdbl_write stdcall, pci:dword, y:word, cmd:dword
|
||||
imul ecx, sizeof.NVM_QUEUE_ENTRY
|
||||
mov word [edi + ecx + NVM_QUEUE_ENTRY.tail], ax
|
||||
dec ax
|
||||
movzx ecx, [y]
|
||||
stdcall nvme_cmd_wait, [pci], ecx, eax
|
||||
pop edi esi ebx
|
||||
ret
|
||||
@ -1028,6 +1028,7 @@ proc nvme_cmd_wait stdcall, pci:dword, y:dword, cid:word
|
||||
ret
|
||||
|
||||
.phase_tag_1:
|
||||
;DEBUGF DBG_INFO, "status: %x\n", [esi + ecx + CQ_ENTRY.status]
|
||||
test byte [esi + ecx + CQ_ENTRY.status], CQ_PHASE_TAG
|
||||
jz .phase_tag_1
|
||||
pop esi
|
||||
@ -1113,8 +1114,7 @@ proc irq_handler
|
||||
test al, 1000b ; check interrupt status
|
||||
jz .not_our_irq
|
||||
|
||||
mov edi, esi
|
||||
mov edi, dword [edi + pcidev.io_addr]
|
||||
mov edi, dword [esi + pcidev.io_addr]
|
||||
mov dword [edi + NVME_MMIO.INTMS], 0x3
|
||||
xor ecx, ecx
|
||||
|
||||
@ -1135,8 +1135,8 @@ proc irq_handler
|
||||
|
||||
.not_our_irq:
|
||||
; Interrupt not handled by driver, return 0
|
||||
xor eax, eax
|
||||
pop edi esi
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
endp
|
||||
|
Loading…
Reference in New Issue
Block a user