mirror of
https://git.missingno.dev/kolibrios-nvme-driver/
synced 2025-01-31 01:30:05 +01:00
fix some stuff
This commit is contained in:
parent
3142d5bda8
commit
69445bb20f
@ -41,20 +41,23 @@ proc START c, reason:dword
|
||||
mov eax, dword [p_nvme_devices]
|
||||
test eax, eax
|
||||
jz .err
|
||||
stdcall device_is_compat, dword [eax + pcidev.bus], dword [eax + pcidev.devfn]
|
||||
xor ecx, ecx
|
||||
mov ebx, eax
|
||||
|
||||
.loop:
|
||||
stdcall device_is_compat, dword [ebx + ecx * sizeof.pcidev + pcidev.bus], dword [ebx + ecx * sizeof.pcidev + pcidev.devfn]
|
||||
test eax, eax
|
||||
jz .err
|
||||
|
||||
mov eax, dword [eax]
|
||||
stdcall nvme_init, dword [eax + pcidev.bus], dword [eax + pcidev.devfn]
|
||||
test eax, eax
|
||||
jz .err ; failed to initialize controller?
|
||||
jz @f
|
||||
stdcall nvme_init, dword [ebx + ecx * sizeof.pcidev + pcidev.bus], dword [ebx + ecx * sizeof.pcidev + pcidev.devfn]
|
||||
|
||||
@@:
|
||||
inc ecx
|
||||
cmp ecx, dword [pcidevs_len]
|
||||
jne .loop
|
||||
invoke RegService, my_service, service_proc
|
||||
ret
|
||||
|
||||
.err:
|
||||
DEBUGF DBG_INFO, "(NVMe): driver failed to initialize"
|
||||
call nvme_cleanup
|
||||
xor eax, eax
|
||||
ret
|
||||
@ -181,9 +184,9 @@ proc detect_nvme
|
||||
|
||||
endp
|
||||
|
||||
proc device_is_compat, bus:dword, devfn:dword
|
||||
proc device_is_compat, bus:byte, devfn:byte
|
||||
|
||||
invoke PciRead32, [bus], [devfn], PCI_header00.base_addr_0
|
||||
invoke PciRead32, dword [bus], dword [devfn], PCI_header00.base_addr_0
|
||||
and eax, 0xfffffff0
|
||||
test eax, eax
|
||||
jz .exit_fail
|
||||
@ -191,20 +194,20 @@ proc device_is_compat, bus:dword, devfn:dword
|
||||
invoke MapIoMem, eax, sizeof.NVME_REG_MAP, PG_SW+PG_NOCACHE
|
||||
test eax, eax
|
||||
jz .exit_fail
|
||||
mov [p_mmap], eax
|
||||
mov dword [p_mmap], eax
|
||||
xor eax, eax
|
||||
inc eax
|
||||
ret
|
||||
|
||||
.exit_fail:
|
||||
PDEBUGF DBG_INFO, "PCI(%u.%u.%u): incompatible NVMe device\n", byte [bus], byte [devfn]
|
||||
PDEBUGF DBG_INFO, "PCI(%u.%u.%u): incompatible NVMe device\n", [bus], [devfn]
|
||||
xor eax, eax
|
||||
ret
|
||||
|
||||
endp
|
||||
|
||||
; nvme_init: Initializes the NVMe controller
|
||||
proc nvme_init, bus:dword, devfn:dword
|
||||
proc nvme_init, bus:byte, devfn:byte
|
||||
|
||||
test eax, eax
|
||||
jz .exit_fail
|
||||
|
Loading…
x
Reference in New Issue
Block a user