2
0
mirror of https://git.missingno.dev/kolibrios-nvme-driver/ synced 2025-01-03 11:25:55 +01:00

implement reporting on namespace info

This commit is contained in:
Abdur-Rahman Mansoor 2024-06-25 15:24:52 -04:00
parent 3db664b53e
commit f612befee6
2 changed files with 26 additions and 1 deletions

View File

@ -710,10 +710,35 @@ proc nvme_init stdcall, pci:dword
invoke GetPhysAddr
stdcall create_io_submission_queue, [pci], eax, 1, 1
if 1
stdcall determine_active_nsids, [pci]
test eax, eax
jz .exit_fail ; No active NSIDS
mov esi, [pci]
mov dword [esi + pcidev.nsid], eax
DEBUGF DBG_INFO, "(NVMe) Found active NSID: %u\n", eax
else
mov esi, [pci]
xor eax, eax
inc eax
mov dword [esi + pcidev.nsid], eax
end if
invoke KernelAlloc, 0x1000
test eax, eax
jz .exit_fail
mov edi, eax
invoke GetPhysAddr
stdcall nvme_identify, [pci], [esi + pcidev.nsid], eax, CNS_IDNS
mov al, byte [edi + IDENTN.nsfeat]
DEBUGF DBG_INFO, "(nvme%un%u): Namespace Features: 0x%x\n", 0, [esi + pcidev.nsid], al
DEBUGF DBG_INFO, "(nvme%un%u): Namespace Size: %u + %u logical blocks\n", 0, [esi + pcidev.nsid], [edi + IDENTN.nsze], [edi + IDENTN.nsze + 4]
DEBUGF DBG_INFO, "(nvme%un%u): Namespace Capacity: %u + %u logical blocks\n", 0, [esi + pcidev.nsid], [edi + IDENTN.ncap], [edi + IDENTN.ncap + 4]
mov eax, dword [edi + IDENTN.lbaf0]
shr eax, 16 ; Get LBADS
and eax, 0xff
stdcall pow2, eax
DEBUGF DBG_INFO, "(nvme%un%u): Namespace LBA Data Size: %u\n", 0, [esi + pcidev.nsid], eax
invoke KernelFree, edi
DEBUGF DBG_INFO, "(NVMe) Successfully initialized driver!\n"
xor eax, eax

View File

@ -311,7 +311,7 @@ struct pcidev
io_addr dd ?
queue_entries dd ?
version dd ?
nsids dd ?
nsid dd ?
nn dd ?
dstrd db ?
rb 3 ; align