mirror of
https://git.missingno.dev/kolibrios-nvme-driver/
synced 2025-02-02 02:20:09 +01:00
fix(nvme_readwrite): PRP2 checking
This commit is contained in:
parent
b21f83fef0
commit
66d24f8e49
@ -743,19 +743,20 @@ proc nvme_readwrite stdcall, ns:dword, dst:dword, start_sector:qword, numsectors
|
||||
dword [esp + 8]
|
||||
|
||||
; assume command completes successfully for now
|
||||
|
||||
; Write PRP1
|
||||
stdcall write_prp_buf, [ns], dword [esp], [dst], [numsectors_ptr]
|
||||
test eax, eax
|
||||
jz .end
|
||||
|
||||
; check if PRP2 should be a PRP list or a regular entry
|
||||
; check if PRP2 is needed at all
|
||||
mov ecx, dword [esi + NSINFO.pg_sectors]
|
||||
mov eax, PAGE_SIZE
|
||||
xor edx, edx
|
||||
div ecx
|
||||
mov ecx, eax
|
||||
mov esi, dword [esp + 4]
|
||||
cmp ebx, ecx
|
||||
cmp ecx, ebx
|
||||
jbe .end
|
||||
|
||||
; check if PRP2 should be a PRP list or a regular entry
|
||||
shl ecx, 1
|
||||
cmp ecx, ebx
|
||||
ja .is_prp_list
|
||||
|
||||
; PRP2 is a PRP entry
|
||||
@ -1166,15 +1167,18 @@ proc nvme_init stdcall, pci:dword
|
||||
mov dword [ebx + NSINFO.lbads], eax
|
||||
DEBUGF DBG_INFO, "nvme%un%u: Namespace LBA Data Size: %u\n", [esi + pcidev.num], [esi + pcidev.nsid], eax
|
||||
invoke KernelFree, edi
|
||||
|
||||
invoke KernelAlloc, 0x1000
|
||||
test eax, eax
|
||||
jz .exit_fail
|
||||
mov edi, eax
|
||||
;stdcall memcpy, eax, test_string, 50
|
||||
invoke GetPhysAddr
|
||||
stdcall nvme_io_rw, [pci], 1, [esi + pcidev.nsid], eax, 0, 0, 0, 1, NVM_CMD_READ
|
||||
DEBUGF DBG_INFO, "%s\n", edi
|
||||
invoke KernelAlloc, 0x4
|
||||
test eax, eax
|
||||
jz .exit_fail
|
||||
mov edx, NVM_CMD_READ
|
||||
mov dword [eax], 0x1
|
||||
stdcall nvme_readwrite, [esi + pcidev.nsinfo], edi, 1, eax
|
||||
test eax, eax
|
||||
jz .exit_fail
|
||||
DEBUGF DBG_INFO, "nvme%u: Successfully initialized driver\n", [esi + pcidev.num]
|
||||
xor eax, eax
|
||||
inc eax
|
||||
@ -1526,7 +1530,6 @@ align 4
|
||||
dd 0 ; use default cache size
|
||||
.end:
|
||||
if __DEBUG__
|
||||
test_string db "NVMe driver successfully wrote to disk! :D",0
|
||||
include_debug_strings
|
||||
end if
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user