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

add sqytdbl_write and cqyhdbl_write

This commit is contained in:
Abdur-Rahman Mansoor 2024-05-30 17:11:24 -04:00
parent 1197535b9c
commit a0cc2ec6a5

View File

@ -337,7 +337,7 @@ proc nvme_init stdcall, pci:dword
; Attach interrupt handler
movzx eax, byte [esi + pcidev.iline]
invoke AttachIntHandler, eax, irq_handler, 0
invoke AttachIntHandler, eax, irq_handler, esi
test eax, eax
jz .exit_fail
DEBUGF DBG_INFO, "(NVMe) Successfully attached interrupt handler\n"
@ -411,14 +411,31 @@ proc nvme_wait stdcall, mmio:dword
endp
proc cq0thbl_write stdcall, mmio:dword, dstrd:dword
; Writes to completion queue 'y' head doorbell
proc cqyhdbl_write stdcall, mmio:dword, dstrd:byte, y:byte
; 1000h + (2 * (4 << CAP.DSTRD))
mov eax, [dstrd]
shl eax, 4
imul eax, 2
; 1000h + ((2y + 1) * (4 << CAP.DSTRD))
xor ecx, ecx
shl ecx, [y]
inc ecx
mov eax, 4
shl eax, [dstrd]
imul eax, ecx
add eax, 0x1000
ret
endp
; Writes to submission queue 'y' tail doorbell
proc sqytdbl_write stdcall, mmio:dword, dstrd:byte, y:byte
; 1000h + (2y * (4 << CAP.DSTRD))
xor ecx, ecx
shl ecx, [y]
mov eax, 4
shl eax, [dstrd]
imul eax, ecx
add eax, 0x1000
ret
endp