mirror of
https://git.missingno.dev/kolibrios-nvme-driver/
synced 2024-11-10 02:20:27 +01:00
feat: get reading from PRP2 entry working
This commit is contained in:
parent
f3a8ed0f6f
commit
b57c530854
@ -570,11 +570,12 @@ proc alloc_dptr stdcall, ns:dword, prps_ptr:dword, numsectors:dword
|
||||
cmp edx, eax
|
||||
jbe .success
|
||||
|
||||
; is the number of sectors equal to two memory pages in size? (todo: fix???)
|
||||
; is the number of sectors greater than to two memory pages?
|
||||
shl eax, 1
|
||||
cmp eax, edx
|
||||
jne @f
|
||||
cmp edx, eax
|
||||
jae @f
|
||||
|
||||
DEBUGF DBG_INFO, "Allocating single entry for PRP2\n"
|
||||
; allocate a single PRP entry for PRP2
|
||||
invoke AllocPage
|
||||
test eax, eax
|
||||
@ -743,6 +744,7 @@ proc nvme_readwrite stdcall, ns:dword, buf:dword, start_sector:qword, numsectors
|
||||
stdcall alloc_dptr, esi, ebx, edx
|
||||
test eax, eax
|
||||
jz .end
|
||||
DEBUGF DBG_INFO, "PRP1: %x, PRP2: %x\n", [ebx], [ebx + 4]
|
||||
stdcall nvme_io_rw, [esi + NSINFO.pci], \
|
||||
1, \
|
||||
[esi + NSINFO.nsid], \
|
||||
@ -763,6 +765,7 @@ proc nvme_readwrite stdcall, ns:dword, buf:dword, start_sector:qword, numsectors
|
||||
test eax, eax
|
||||
jz .end
|
||||
|
||||
DEBUGF DBG_INFO, "Successfully wrote PRP1\n"
|
||||
; check if PRP2 is needed at all
|
||||
mov ecx, dword [esi + NSINFO.pg_sectors]
|
||||
mov edx, dword [ebx + 12]
|
||||
@ -771,9 +774,10 @@ proc nvme_readwrite stdcall, ns:dword, buf:dword, start_sector:qword, numsectors
|
||||
|
||||
; check if PRP2 should be a PRP list or a regular entry
|
||||
shl ecx, 1
|
||||
cmp ecx, edx
|
||||
cmp edx, ecx
|
||||
ja .is_prp_list
|
||||
|
||||
DEBUGF DBG_INFO, "PRP2 entry\n"
|
||||
; PRP2 is a PRP entry
|
||||
mov eax, dword [ebx + 12]
|
||||
imul eax, dword [esi + NSINFO.lbads]
|
||||
@ -1193,7 +1197,7 @@ proc nvme_init stdcall, pci:dword
|
||||
test eax, eax
|
||||
jz .exit_fail
|
||||
mov edx, NVM_CMD_READ
|
||||
mov dword [eax], 0x1
|
||||
mov dword [eax], 0x9
|
||||
stdcall nvme_readwrite, [esi + pcidev.nsinfo], edi, 0, 0, eax
|
||||
test eax, eax
|
||||
jz .exit_fail
|
||||
|
Loading…
Reference in New Issue
Block a user