mirror of
https://git.missingno.dev/kolibrios-nvme-driver/
synced 2024-12-23 06:18:47 +01:00
perf(size): remove useless pow2 implementation
This commit is contained in:
parent
1ea8733a66
commit
e3241e35cc
@ -690,12 +690,7 @@ proc nvme_readwrite stdcall, ns:dword, buf:dword, start_sector:qword, numsectors
|
|||||||
jz .dptr_fail
|
jz .dptr_fail
|
||||||
|
|
||||||
DEBUGF DBG_INFO, "PRP1: %x, PRP2: %x\n", [ebx], [ebx + 4]
|
DEBUGF DBG_INFO, "PRP1: %x, PRP2: %x\n", [ebx], [ebx + 4]
|
||||||
|
|
||||||
mov eax, dword [start_sector]
|
mov eax, dword [start_sector]
|
||||||
mov ecx, dword [esi + NSINFO.lbads]
|
|
||||||
xor edx, edx
|
|
||||||
div ecx
|
|
||||||
DEBUGF DBG_INFO, "sector start: %u\n", eax
|
|
||||||
|
|
||||||
; According to the NVMe specification, the NLB field in the I/O read and write
|
; According to the NVMe specification, the NLB field in the I/O read and write
|
||||||
; commands is a 0-based value (i.e., 0 is equivalant to 1, 1 is equivalant to 2, ...)
|
; commands is a 0-based value (i.e., 0 is equivalant to 1, 1 is equivalant to 2, ...)
|
||||||
@ -1110,11 +1105,13 @@ proc nvme_init stdcall, pci:dword
|
|||||||
mov dword [ebx + NSINFO.capacity + 4], eax
|
mov dword [ebx + NSINFO.capacity + 4], eax
|
||||||
;DEBUGF DBG_INFO, "nvme%un%u: Namespace Size: %u + %u logical blocks\n", [esi + pcidev.num], [esi + pcidev.nsid], [edi + IDENTN.nsze], [edi + IDENTN.nsze + 4]
|
;DEBUGF DBG_INFO, "nvme%un%u: Namespace Size: %u + %u logical blocks\n", [esi + pcidev.num], [esi + pcidev.nsid], [edi + IDENTN.nsze], [edi + IDENTN.nsze + 4]
|
||||||
;DEBUGF DBG_INFO, "nvme%un%u: Namespace Capacity: %u + %u logical blocks\n", [esi + pcidev.num], [esi + pcidev.nsid], [edi + IDENTN.ncap], [edi + IDENTN.ncap + 4]
|
;DEBUGF DBG_INFO, "nvme%un%u: Namespace Capacity: %u + %u logical blocks\n", [esi + pcidev.num], [esi + pcidev.nsid], [edi + IDENTN.ncap], [edi + IDENTN.ncap + 4]
|
||||||
mov eax, dword [edi + IDENTN.lbaf0]
|
mov ecx, dword [edi + IDENTN.lbaf0]
|
||||||
shr eax, 16 ; Get LBADS
|
shr ecx, 16 ; Get LBADS
|
||||||
and eax, 0xff
|
and ecx, 0xff
|
||||||
stdcall pow2, eax
|
dec ecx
|
||||||
;DEBUGF DBG_INFO, "nvme%un%u: Namespace LBA Data Size: %u\n", [esi + pcidev.num], [esi + pcidev.nsid], eax
|
mov eax, 2
|
||||||
|
shl eax, cl
|
||||||
|
DEBUGF DBG_INFO, "nvme%un%u: Namespace LBA Data Size: %u\n", [esi + pcidev.num], [esi + pcidev.nsid], eax
|
||||||
|
|
||||||
; KolibriOS only supports a LBADS of 512, so if it's a higher value then we
|
; KolibriOS only supports a LBADS of 512, so if it's a higher value then we
|
||||||
; have to ignore this namespace
|
; have to ignore this namespace
|
||||||
@ -1128,7 +1125,7 @@ proc nvme_init stdcall, pci:dword
|
|||||||
div ecx
|
div ecx
|
||||||
mov dword [ebx + NSINFO.pg_sectors], eax
|
mov dword [ebx + NSINFO.pg_sectors], eax
|
||||||
invoke KernelFree, edi
|
invoke KernelFree, edi
|
||||||
if 1
|
if 0
|
||||||
invoke KernelAlloc, 0x6000
|
invoke KernelAlloc, 0x6000
|
||||||
test eax, eax
|
test eax, eax
|
||||||
jz .exit_fail
|
jz .exit_fail
|
||||||
@ -1138,6 +1135,7 @@ proc nvme_init stdcall, pci:dword
|
|||||||
jz .exit_fail
|
jz .exit_fail
|
||||||
mov edx, NVM_CMD_READ
|
mov edx, NVM_CMD_READ
|
||||||
mov dword [eax], 25
|
mov dword [eax], 25
|
||||||
|
add edi, 0x5
|
||||||
stdcall nvme_readwrite, [esi + pcidev.nsinfo], edi, 0x1000, 0, eax
|
stdcall nvme_readwrite, [esi + pcidev.nsinfo], edi, 0x1000, 0, eax
|
||||||
DEBUGF DBG_INFO, "STRING: %s\n", edi
|
DEBUGF DBG_INFO, "STRING: %s\n", edi
|
||||||
add edi, 0x2000
|
add edi, 0x2000
|
||||||
@ -1303,25 +1301,6 @@ proc sqytdbl_write stdcall, pci:dword, y:word, cmd:dword
|
|||||||
|
|
||||||
endp
|
endp
|
||||||
|
|
||||||
; Calculates 2^x
|
|
||||||
proc pow2 stdcall, x:byte
|
|
||||||
|
|
||||||
push ecx
|
|
||||||
mov cl, [x]
|
|
||||||
xor eax, eax
|
|
||||||
inc eax
|
|
||||||
test cl, cl
|
|
||||||
jnz @f
|
|
||||||
pop ecx
|
|
||||||
ret
|
|
||||||
|
|
||||||
@@:
|
|
||||||
shl eax, cl
|
|
||||||
pop ecx
|
|
||||||
ret
|
|
||||||
|
|
||||||
endp
|
|
||||||
|
|
||||||
proc nvme_cmd_wait stdcall, pci:dword, y:dword, cid:word
|
proc nvme_cmd_wait stdcall, pci:dword, y:dword, cid:word
|
||||||
|
|
||||||
push esi
|
push esi
|
||||||
@ -1488,7 +1467,7 @@ align 4
|
|||||||
dd 0 ; no close function
|
dd 0 ; no close function
|
||||||
dd 0 ; no closemedia function
|
dd 0 ; no closemedia function
|
||||||
dd nvme_query_media
|
dd nvme_query_media
|
||||||
dd 0
|
dd nvme_read
|
||||||
dd 0 ; no write function (for now)
|
dd 0 ; no write function (for now)
|
||||||
dd 0 ; no flush function
|
dd 0 ; no flush function
|
||||||
dd 0 ; use default cache size
|
dd 0 ; use default cache size
|
||||||
|
Loading…
Reference in New Issue
Block a user