diff --git a/drivers/nvme/nvme.asm b/drivers/nvme/nvme.asm index 6e85d29..58a7370 100644 --- a/drivers/nvme/nvme.asm +++ b/drivers/nvme/nvme.asm @@ -30,14 +30,14 @@ include "macros.inc" proc START c, reason:dword - cmp [reason], DRV_ENTRY - jne .err + cmp [reason], DRV_ENTRY + jne .err .entry: DEBUGF DBG_INFO, "Detecting NVMe hardware...\n" - call detect_nvme + call detect_nvme test eax, eax - jz .err + jz .err mov eax, dword [p_nvme_devices] test eax, eax jz .err @@ -54,29 +54,30 @@ proc START c, reason:dword inc ecx cmp ecx, dword [pcidevs_len] jne .loop - invoke RegService, my_service, service_proc - ret + invoke RegService, my_service, service_proc + ret .err: call nvme_cleanup - xor eax, eax - ret + xor eax, eax + ret endp proc service_proc stdcall, ioctl:dword - mov ebx, [ioctl] - mov eax, [ebx+IOCTL.io_code] - cmp eax, SRV_GETVERSION - jne @F + mov ebx, [ioctl] + mov eax, [ebx+IOCTL.io_code] + cmp eax, SRV_GETVERSION + jne @F + + mov eax, [ebx+IOCTL.output] + cmp [ebx+IOCTL.out_size], 4 + jne @F + mov dword [eax], API_VERSION + xor eax, eax + ret - mov eax, [ebx+IOCTL.output] - cmp [ebx+IOCTL.out_size], 4 - jne @F - mov dword [eax], API_VERSION - xor eax, eax - ret @@: or eax, -1 ret @@ -89,6 +90,7 @@ proc memset stdcall, p_data:dword, val:byte, sz:dword mov edx, [sz] mov bl, [val] xor ecx, ecx + @@: mov byte [p_data + ecx], bl inc ecx @@ -129,7 +131,7 @@ endp proc detect_nvme - invoke GetPCIList + invoke GetPCIList mov edx, eax .check_dev: @@ -268,10 +270,10 @@ proc nvme_init stdcall, pci:dword ; Configure Admin Submission/Completion Queue Base Address - xor eax, eax - inc eax + xor eax, eax + inc eax pop ebx - ret + ret .exit_fail: PDEBUGF DBG_INFO, "PCI(%u.%u.%u): failed to initialize NVMe controller\n", byte [pci + pcidev.bus], byte [pci + pcidev.devfn] diff --git a/drivers/nvme/nvme.inc b/drivers/nvme/nvme.inc index 3863bf1..eb050af 100644 --- a/drivers/nvme/nvme.inc +++ b/drivers/nvme/nvme.inc @@ -210,7 +210,7 @@ struct pcidev bus db ? devfn db ? rw 1 - mmio_ptr dd ? + mmio_ptr dd ? ends TOTAL_PCIDEVS = 4 TOTAL_PCIDEVS_MALLOC_SZ = TOTAL_PCIDEVS * sizeof.pcidev