From 1c69e25c2b1cf80f33574142bf29b1c544ee2e00 Mon Sep 17 00:00:00 2001 From: Abdur-Rahman Mansoor Date: Sat, 22 Jun 2024 14:43:08 -0400 Subject: [PATCH] chore: add comments + save value of `IDENTC.nn` --- drivers/nvme/nvme.asm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/nvme.asm b/drivers/nvme/nvme.asm index 13daa8e..bd5c970 100644 --- a/drivers/nvme/nvme.asm +++ b/drivers/nvme/nvme.asm @@ -178,6 +178,8 @@ proc determine_active_nsids stdcall, pci:dword invoke GetPhysAddr stdcall nvme_identify, [pci], 0, eax, CNS_IDCS mov eax, dword [esi + IDENTC.nn] + mov edx, [pci] + mov dword [edx + pcidev.nn], eax test eax, eax jz .fail invoke KernelAlloc, 0x1000 @@ -191,10 +193,12 @@ proc determine_active_nsids stdcall, pci:dword .loop: cmp ecx, dword [esi + IDENTC.nn] jg .success - stdcall nvme_identify, [pci], ecx, ebx, CNS_IDNS + stdcall nvme_identify, [pci], ecx, ebx, CNS_IDNS ; identify N'th namespace push ecx xor ecx, ecx +; We want to check if entire struct is zeroed out, if so, it is not an active NSID, +; otherwise it is .inner_loop: mov eax, dword [edi + ecx * 4] test eax, eax