2
0
mirror of https://git.missingno.dev/kolibrios-nvme-driver/ synced 2024-12-22 13:58:47 +01:00

refactor: dont map MMIO registers twice

This commit is contained in:
Abdur-Rahman Mansoor 2024-08-02 12:54:41 -04:00
parent 404f451e0c
commit f40321f869

View File

@ -563,29 +563,15 @@ proc device_is_compat stdcall, pci:dword
test eax, eax
jz .failure
mov edx, eax
push edx
invoke MapIoMem, eax, sizeof.NVME_MMIO, PG_SW+PG_NOCACHE
invoke MapIoMem, eax, 0x2000, PG_SW+PG_NOCACHE
test eax, eax
jz .failure
;DEBUGF DBG_INFO, "(NVMe) MMIO allocated at: 0x%x\n", eax
mov dword [esi + pcidev.io_addr], eax
mov eax, dword [eax + NVME_MMIO.CAP + 4]
and eax, CAP_DSTRD
mov byte [esi + pcidev.dstrd], al
; 1003h + ((2y + 1) * (4 << CAP.DSTRD))
mov eax, 4
shl ax, cl
mov ecx, NVM_ASQS
shl ecx, 1
inc ecx
imul ecx, eax
add ecx, 0x1003
pop edx
invoke MapIoMem, edx, ecx, PG_SW+PG_NOCACHE
mov dword [esi + pcidev.io_addr], eax
mov eax, dword [esi + pcidev.io_addr]
mov eax, dword [eax + NVME_MMIO.VS]
DEBUGF DBG_INFO, "nvme%u: Controller version: 0x%x\n", [esi + pcidev.num], eax
mov dword [esi + pcidev.version], eax