2
0
mirror of https://git.missingno.dev/kolibrios-nvme-driver/ synced 2025-01-03 19:35:56 +01:00

add PCI_DEBUGF macro

This commit is contained in:
ramenu 2024-04-20 20:29:06 -04:00
parent fd468c5bda
commit f1f44c1357

View File

@ -26,6 +26,7 @@ include "../fdo.inc"
include "../pci.inc" include "../pci.inc"
include "../peimport.inc" include "../peimport.inc"
include "nvme.inc" include "nvme.inc"
include "macros.inc"
proc START c, reason:dword proc START c, reason:dword
@ -134,13 +135,7 @@ proc detect_nvme
ret ret
.found_dev: .found_dev:
if __DEBUG__ PCI_DEBUGF DBG_INFO, eax, "PCI(%u.%u.%u): Detected NVMe device...\n"
movzx ebx, byte [eax + PCIDEV.devfn]
shr ebx, 3 ; get rid of 3 lowest bits (function code), the rest bits is device code
movzx ecx, byte [eax + PCIDEV.devfn]
and ecx, 00000111b ; get only 3 lowest bits (function code)
DEBUGF DBG_INFO, "PCI(%u.%u.%u): Detected NVMe device...\n", [eax + PCIDEV.bus], ebx, ecx
end if
push eax push eax
mov eax, dword [pcidevs_len] mov eax, dword [pcidevs_len]
cmp eax, MAX_NVM_PCIDEVS cmp eax, MAX_NVM_PCIDEVS
@ -216,7 +211,7 @@ proc nvme_init, bus:dword, devfn:dword
test ebx, CAP_CSS_NVM_CMDSET test ebx, CAP_CSS_NVM_CMDSET
jz .exit_fail jz .exit_fail
if __DEBUG__ if __DEBUG__ eq 1
and ebx, CAP_MPSMIN and ebx, CAP_MPSMIN
and ecx, CAP_MPSMAX and ecx, CAP_MPSMAX
shr ebx, 16 shr ebx, 16