2
0
mirror of https://git.missingno.dev/kolibrios-nvme-driver/ synced 2025-01-31 01:30:05 +01:00

fix nvme_identify and irq_handler

This commit is contained in:
Abdur-Rahman Mansoor 2024-06-09 14:57:42 -04:00
parent dd3ebb1716
commit 34bfcf8719

View File

@ -155,7 +155,7 @@ proc nvme_identify stdcall, pci:dword, nsid:dword, dptr:dword, cid:word, cns:byt
mov dword [esi + SQ_ENTRY.dptr], eax
movzx eax, [cid]
shl eax, 16
or dword [esi + SQ_ENTRY.cdw0], ADM_CMD_IDENTIFY
mov dword [esi + SQ_ENTRY.cdw0], ADM_CMD_IDENTIFY
or dword [esi + SQ_ENTRY.cdw0], eax
mov al, [cns]
mov byte [esi + SQ_ENTRY.cdw10], al
@ -572,7 +572,7 @@ proc nvme_init stdcall, pci:dword
mov dword [dptr], eax
invoke GetPhysAddr
; pci:dword, nsid:dword, dptr:dword, cid:word, cns:byte
stdcall nvme_identify, [pci], 0, eax, 0, CNS_IDCS
stdcall nvme_identify, [pci], 0, eax, 2, CNS_IDCS
xor eax, eax
inc eax
@ -742,11 +742,10 @@ proc irq_handler
mov esi, dword [esi + pcidev.io_addr]
mov edi, dword [edi + pcidev.cq_ptr]
mov dword [esi + NVME_MMIO.INTMS], 0x1
mov eax, dword [edi + CQ_ENTRY.sqid]
DEBUGF DBG_INFO, "(NVMe) SQID: %u\n", eax
mov eax, dword [edi + CQ_ENTRY.status]
DEBUGF DBG_INFO, "(NVMe) Status: %x\n", eax
test al, al
mov ax, word [edi + CQ_ENTRY.status]
and ax, not CQ_PHASE_TAG ; ignore phase tag bit
DEBUGF DBG_INFO, "(NVMe) Status: %x\n", ax
test al, al ; check status code (0 on success)
jz @f
; error occurred