2
0
mirror of https://git.missingno.dev/kolibrios-nvme-driver/ synced 2025-02-02 02:20:09 +01:00

feat: add function table and fix determine_active_nsids

This commit is contained in:
Abdur-Rahman Mansoor 2024-06-25 14:37:19 -04:00
parent b4d3c82480
commit 3db664b53e

View File

@ -88,6 +88,9 @@ proc service_proc stdcall, ioctl:dword
endp
proc nvme_query_media stdcall
endp
proc set_cdw0 stdcall, pci:dword, y:dword, opcode:byte
stdcall get_new_cid, [pci], [y]
@ -197,7 +200,6 @@ proc is_active_namespace stdcall, pci:dword, nsid:dword
ret
.is_active_nsid:
DEBUGF DBG_INFO, "(NVMe) Active NSID: %u\n", [nsid]
invoke KernelFree, esi
pop edi esi
xor eax, eax
@ -213,32 +215,28 @@ endp
; to appropriate values
proc determine_active_nsids stdcall, pci:dword
push ebx esi edi
push ebx esi
mov esi, [pci]
;mov edi, [edi + pcidev.nsids]
xor ebx, ebx
xor ecx, ecx
xor edx, edx
inc ecx
.loop:
cmp ecx, dword [esi + pcidev.nn]
jg .ret
push ecx edx
push ecx
stdcall is_active_namespace, [pci], ecx
pop edx ecx
pop ecx
test eax, eax
jz .not_active_namespace
;mov dword [edi + ecx * 4], ecx
mov ebx, ecx
inc edx
.not_active_namespace:
inc ecx
jmp .loop
.ret:
pop edi esi ebx
pop edi esi
mov eax, ebx
ret
@ -715,6 +713,7 @@ proc nvme_init stdcall, pci:dword
stdcall determine_active_nsids, [pci]
test eax, eax
jz .exit_fail ; No active NSIDS
DEBUGF DBG_INFO, "(NVMe) Found active NSID: %u\n", eax
DEBUGF DBG_INFO, "(NVMe) Successfully initialized driver!\n"
xor eax, eax
@ -1053,6 +1052,16 @@ align 4
p_nvme_devices dd 0
pcidevs_len dd 0
my_service db "NVMe",0 ;max 16 chars include zero
disk_functions:
dd disk_functions.end - disk_functions
dd 0 ; no close function
dd 0 ; no closemedia function
dd nvme_query_media
dd 0 ; no read function (for now)
dd 0 ; no write function (for now)
dd 0 ; no flush function
dd 0 ; use default cache size
.end:
if __DEBUG__
include_debug_strings
end if