diff --git a/drivers/nvme/nvme.asm b/drivers/nvme/nvme.asm index 72d8d12..942847d 100644 --- a/drivers/nvme/nvme.asm +++ b/drivers/nvme/nvme.asm @@ -564,7 +564,6 @@ proc nvme_init stdcall, pci:dword invoke GetPhysAddr ; pci:dword, nsid:dword, dptr:dword, cns:byte stdcall nvme_identify, [pci], 0, eax, CNS_IDCS - stdcall nvme_cmd_wait, [pci], 0, 0 mov edi, ebx lea ebx, byte [edi + IDENTC.sn] lea eax, byte [esi + pcidev.serial] @@ -598,8 +597,6 @@ proc nvme_init stdcall, pci:dword mov eax, (NVM_ASQS - 1) or ((NVM_ACQS - 1) shl 16) ; CDW11 (set the number of queues we want) stdcall set_features, [pci], NULLPTR, FID_NUMBER_OF_QUEUES, eax mov esi, dword [p_nvme_devices] - ;stdcall nvme_wait, dword [esi + pcidev.io_addr] - stdcall nvme_cmd_wait, [pci], 0, 1 mov esi, dword [esi + pcidev.queue_entries] mov esi, dword [esi + NVM_QUEUE_ENTRY.cq_ptr] mov eax, dword [esi + sizeof.CQ_ENTRY + CQ_ENTRY.cdw0] @@ -801,7 +798,10 @@ proc sqytdbl_write stdcall, pci:dword, y:word, cmd:dword DEBUGF DBG_INFO, "(NVMe) Writing to submission queue doorbell register 0x%x: %u\n", dx, ax mov esi, dword [esi + pcidev.io_addr] mov word [esi + edx], ax + movzx ecx, [y] mov word [edi + NVM_QUEUE_ENTRY.tail], ax + dec ax + stdcall nvme_cmd_wait, [pci], ecx, eax pop edi esi ebx ret @@ -826,12 +826,12 @@ proc pow2 stdcall, x:byte endp -proc nvme_cmd_wait stdcall, pci:dword, y:byte, cid:word +proc nvme_cmd_wait stdcall, pci:dword, y:dword, cid:dword push esi mov esi, [pci] - movzx ecx, [cid] - movzx edx, [y] + movzx ecx, word [cid] + movzx edx, byte [y] imul edx, sizeof.NVM_QUEUE_ENTRY mov esi, dword [esi + pcidev.queue_entries] lea esi, [esi + edx]