mirror of
https://git.missingno.dev/kolibrios-nvme-driver/
synced 2024-12-22 22:08:47 +01:00
feat: get reading from single prp entry working
This commit is contained in:
parent
405dcb5155
commit
f3a8ed0f6f
@ -724,7 +724,7 @@ nvme_read:
|
||||
nvme_write:
|
||||
mov edx, NVM_CMD_WRITE
|
||||
|
||||
proc nvme_readwrite stdcall, ns:dword, dst:dword, start_sector:qword, numsectors_ptr:dword
|
||||
proc nvme_readwrite stdcall, ns:dword, buf:dword, start_sector:qword, numsectors_ptr:dword
|
||||
|
||||
push ebx esi edi
|
||||
sub esp, 16
|
||||
@ -734,7 +734,7 @@ proc nvme_readwrite stdcall, ns:dword, dst:dword, start_sector:qword, numsectors
|
||||
mov dword [ebx + 8], edx ; command type (read or write)
|
||||
mov dword [ebx + 12], eax ; save original numsectors value
|
||||
mov esi, [ns]
|
||||
mov edi, [dst]
|
||||
mov edi, [buf]
|
||||
|
||||
mov edx, [numsectors_ptr]
|
||||
mov edx, [edx]
|
||||
@ -756,14 +756,16 @@ proc nvme_readwrite stdcall, ns:dword, dst:dword, start_sector:qword, numsectors
|
||||
; assume command completes successfully for now
|
||||
|
||||
; Write PRP1
|
||||
; investigate: why does this change the value of esi??
|
||||
push esi ebx edi
|
||||
stdcall write_prp_buf, esi, dword [ebx], edi, [numsectors_ptr]
|
||||
DEBUGF DBG_INFO, "Successfully wrote PRP1\n"
|
||||
pop edi ebx esi
|
||||
test eax, eax
|
||||
jz .end
|
||||
|
||||
; check if PRP2 is needed at all
|
||||
mov ecx, dword [esi + NSINFO.pg_sectors]
|
||||
mov edx, dword [ebx + 8]
|
||||
mov edx, dword [ebx + 12]
|
||||
cmp edx, ecx
|
||||
jbe .end
|
||||
|
||||
@ -788,7 +790,7 @@ proc nvme_readwrite stdcall, ns:dword, dst:dword, start_sector:qword, numsectors
|
||||
mov ecx, dword [esi + NSINFO.lbads]
|
||||
div ecx
|
||||
mov ebx, eax
|
||||
stdcall write_prp_list_buf, dword [ebx + 4], [dst], ebx
|
||||
stdcall write_prp_list_buf, dword [ebx + 4], [buf], ebx
|
||||
stdcall free_prp_list, dword [ebx + 4], ebx, FALSE
|
||||
|
||||
.end:
|
||||
@ -1192,9 +1194,10 @@ proc nvme_init stdcall, pci:dword
|
||||
jz .exit_fail
|
||||
mov edx, NVM_CMD_READ
|
||||
mov dword [eax], 0x1
|
||||
stdcall nvme_readwrite, [esi + pcidev.nsinfo], edi, 1, 0, eax
|
||||
stdcall nvme_readwrite, [esi + pcidev.nsinfo], edi, 0, 0, eax
|
||||
test eax, eax
|
||||
jz .exit_fail
|
||||
DEBUGF DBG_INFO, "%s\n", edi
|
||||
DEBUGF DBG_INFO, "nvme%u: Successfully initialized driver\n", [esi + pcidev.num]
|
||||
xor eax, eax
|
||||
inc eax
|
||||
|
Loading…
Reference in New Issue
Block a user