mirror of
https://git.missingno.dev/kolibrios-nvme-driver/
synced 2024-12-22 13:58:47 +01:00
more bloat removal
This commit is contained in:
parent
835840231f
commit
a5c1920c0e
@ -163,7 +163,10 @@ proc nvme_query_media stdcall, userdata:dword, info:dword
|
||||
mov ebx, dword [esi + NSINFO.pci]
|
||||
mov edi, [info]
|
||||
mov dword [edi + DISKMEDIAINFO.flags], 0
|
||||
mov eax, dword [esi + NSINFO.lbads]
|
||||
mov cl, byte [esi + NSINFO.lbads]
|
||||
xor eax, eax
|
||||
inc eax
|
||||
shl eax, cl
|
||||
DEBUGF DBG_INFO, "nvme%un%u (Query Media): Sector size = %u\n", [ebx + pcidev.num], [esi + NSINFO.nsid], eax
|
||||
mov dword [edi + DISKMEDIAINFO.sectorsize], eax
|
||||
mov eax, dword [esi + NSINFO.capacity]
|
||||
@ -574,12 +577,6 @@ proc alloc_dptr stdcall, ns:dword, prps_ptr:dword, numsectors:dword, prp_list_pt
|
||||
mov cl, byte [esi + NSINFO.lbads]
|
||||
mov ebx, PAGE_SIZE
|
||||
shr ebx, cl
|
||||
mov eax, edx
|
||||
cmp eax, ebx
|
||||
jbe @f
|
||||
sub eax, ebx
|
||||
|
||||
@@:
|
||||
mov edx, [numsectors]
|
||||
|
||||
; is the buffer offset portion equal to 0?
|
||||
@ -591,7 +588,7 @@ proc alloc_dptr stdcall, ns:dword, prps_ptr:dword, numsectors:dword, prp_list_pt
|
||||
; is the number of sectors less than or equal to one memory page?
|
||||
cmp edx, ebx
|
||||
jbe .success
|
||||
shl eax, 1 ; it is page aligned, so set eax to 2 memory pages
|
||||
shl ebx, 1 ; it is page aligned, so set ebx to 2 memory pages
|
||||
|
||||
@@:
|
||||
; is the number of sectors greater than one or two memory pages?
|
||||
@ -1089,21 +1086,15 @@ proc nvme_init stdcall, pci:dword
|
||||
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 Capacity: %u + %u logical blocks\n", [esi + pcidev.num], [esi + pcidev.nsid], [edi + IDENTN.ncap], [edi + IDENTN.ncap + 4]
|
||||
mov ecx, dword [edi + IDENTN.lbaf0]
|
||||
shr ecx, 16 ; Get LBADS
|
||||
and ecx, 0xff
|
||||
movzx edx, cl
|
||||
dec ecx
|
||||
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
|
||||
mov eax, dword [edi + IDENTN.lbaf0]
|
||||
shr eax, 16 ; Get LBADS
|
||||
|
||||
; KolibriOS only supports a LBADS of 512, so if it's a higher value then we
|
||||
; have to ignore this namespace
|
||||
cmp eax, SUPPORTED_LBADS
|
||||
cmp al, SUPPORTED_LBADS
|
||||
jne .exit_fail
|
||||
|
||||
mov dword [ebx + NSINFO.lbads], eax
|
||||
mov byte [ebx + NSINFO.lbads], al
|
||||
invoke KernelFree, edi
|
||||
if 0
|
||||
invoke KernelAlloc, 0x6000
|
||||
|
@ -24,7 +24,7 @@ LAST_QUEUE_ID = 1 ; Index of the last queue
|
||||
SQ_ENTRIES = NVM_ASQS ; I/O and Admin Submission Queue Size
|
||||
CQ_ENTRIES = NVM_ACQS ; I/O and Admin Completion Queue Size
|
||||
PAGE_SIZE = 4096 shl NVM_MPS
|
||||
SUPPORTED_LBADS = 512 ; KolibriOS only supports LBADS of 512, later on we may remove this restriction
|
||||
SUPPORTED_LBADS = 9 ; KolibriOS only supports LBADS of 512, later on we may remove this restriction
|
||||
|
||||
ADMIN_QUEUE = 0 ; Admin Queue ID
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user