mirror of
https://git.missingno.dev/kolibrios-nvme-driver/
synced 2024-12-30 17:53:08 +01:00
save changes for now
This commit is contained in:
parent
998d51f9e8
commit
d4d59184fe
@ -48,7 +48,7 @@ local AnythingLoadedSuccessfully db 0
|
||||
|
||||
.entry:
|
||||
DEBUGF DBG_INFO, "Detecting NVMe device...\n"
|
||||
call detect_nvme
|
||||
stdcall detect_nvme, TRUE
|
||||
test eax, eax
|
||||
jz .err
|
||||
xor ebx, ebx
|
||||
@ -86,7 +86,7 @@ local AnythingLoadedSuccessfully db 0
|
||||
ret
|
||||
|
||||
.err:
|
||||
;call nvme_cleanup
|
||||
call nvme_cleanup
|
||||
pop edi esi
|
||||
ret
|
||||
|
||||
@ -505,7 +505,7 @@ proc nvme_readwrite stdcall, ns:dword, buf:dword, start_sector:qword, numsectors
|
||||
|
||||
endp
|
||||
|
||||
proc detect_nvme
|
||||
proc detect_nvme stdcall, exit_if_already_allocated:dword
|
||||
|
||||
invoke GetPCIList
|
||||
mov esi, eax
|
||||
@ -527,7 +527,31 @@ proc detect_nvme
|
||||
inc eax
|
||||
ret
|
||||
|
||||
.pcidev_already_has_owner:
|
||||
cmp dword [esi + PCIDEV.owner], 0
|
||||
jnz .next_dev
|
||||
mov eax, dword [p_nvme_devices]
|
||||
test eax, eax
|
||||
jnz @f
|
||||
invoke KernelAlloc, sizeof.pcidev * TOTAL_PCIDEVS
|
||||
test eax, eax
|
||||
jz .err
|
||||
|
||||
@@:
|
||||
mov ecx, dword [pcidevs_len]
|
||||
cmp ecx, TOTAL_PCIDEVS
|
||||
je .exit_success
|
||||
inc ecx
|
||||
mov dword [pcidevs_len], ecx
|
||||
mov edx, dword [esi + PCIDEV.owner]
|
||||
imul ecx, sizeof.pcidev
|
||||
mov dword [eax + ecx], edx
|
||||
jmp .next_dev
|
||||
|
||||
.found_dev:
|
||||
cmp byte [exit_if_already_allocated], 0
|
||||
je .pcidev_already_has_owner
|
||||
|
||||
; skip PCIDEV.owner check if the PCI device pointer has already been
|
||||
; allocated (without this check, more than 1 NVMe device cannot be
|
||||
; registered)
|
||||
@ -540,11 +564,7 @@ proc detect_nvme
|
||||
@@:
|
||||
PDEBUGF DBG_INFO, "PCI(%u.%u.%u): Detected NVMe device...\n", [esi + PCIDEV.bus], [esi + PCIDEV.devfn]
|
||||
cmp dword [pcidevs_len], TOTAL_PCIDEVS
|
||||
jne @f
|
||||
DEBUGF DBG_INFO, "Can't add any more NVMe devices...\n"
|
||||
jmp .exit_success
|
||||
|
||||
@@:
|
||||
je .exit_success
|
||||
inc dword [pcidevs_len]
|
||||
cmp dword [p_nvme_devices], 0
|
||||
jnz @f ; was the pointer already allocated?
|
||||
@ -1252,7 +1272,7 @@ endp
|
||||
|
||||
proc nvme_cleanup
|
||||
|
||||
DEBUGF DBG_INFO, "nvme_cleanup called\n"
|
||||
;stdcall detect_nvme, FALSE
|
||||
mov esi, dword [p_nvme_devices]
|
||||
test esi, esi
|
||||
jnz @f
|
||||
@ -1328,6 +1348,7 @@ proc nvme_cleanup
|
||||
|
||||
.free_pcidevs:
|
||||
invoke KernelFree, dword [p_nvme_devices]
|
||||
pop edi esi
|
||||
ret
|
||||
|
||||
endp
|
||||
|
Loading…
Reference in New Issue
Block a user