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

fix: set bus master, memory space access, and I/O space access bit in PCI command register

This commit is contained in:
Abdur-Rahman Mansoor 2024-08-08 15:23:39 -04:00
parent ef7f1d3459
commit d9e04ec7cd

View File

@ -605,10 +605,16 @@ proc nvme_init stdcall, pci:dword
push ebx esi edi
mov esi, dword [pci]
; Check the PCI header to see if interrupts are disabled, if so
; we have to re-enable them
invoke PciRead16, dword [esi + pcidev.bus], dword [esi + pcidev.devfn], PCI_header00.command
and eax, not (1 shl 10)
; Enable Bus Master bit, memory space access, and I/O space access. QEMU automatically sets the
; bus master bit, but Virtualbox does not. Not sure about the other bits though, but let's set them
; to 1 to anyway just to be extra cautious.
; See: https://git.kolibrios.org/GSoC/kolibrios-nvme-driver/issues/1#issuecomment-467
or eax, (1 shl 2) or (1 shl 1) or 1
invoke PciWrite16, dword [esi + pcidev.bus], dword [esi + pcidev.devfn], PCI_header00.command, eax
; Check if the device has a pointer to the capabilities list (status register bit 4 set to 1)