diff --git a/drivers/nvme/nvme.asm b/drivers/nvme/nvme.asm index 85ae1df..73fbfed 100644 --- a/drivers/nvme/nvme.asm +++ b/drivers/nvme/nvme.asm @@ -229,6 +229,7 @@ proc abort stdcall, pci:dword, cid:word, sqid:word push esi mov esi, [pci] + mov esi, dword [esi + pcidev.sq_ptr] stdcall memset, esi, 0, sizeof.SQ_ENTRY stdcall set_cdw0, [pci], ADMIN_QUEUE, ADM_CMD_ABORT mov dword [esi + SQ_ENTRY.cdw0], eax @@ -250,12 +251,13 @@ proc set_features stdcall, pci:dword, dptr:dword, fid:byte mov esi, [pci] mov esi, dword [esi + pcidev.sq_ptr] stdcall memset, esi, 0, sizeof.SQ_ENTRY - stdcall set_cdw0, [pci], ADMIN_QUEUE, AMD_CMD_SET_FEATURES + stdcall set_cdw0, [pci], ADMIN_QUEUE, ADM_CMD_SET_FEATURES + mov dword [esi + SQ_ENTRY.cdw0], eax mov eax, [dptr] mov dword [esi + SQ_ENTRY.dptr], eax - mov al, [fid] - mov byte [esi + SQ_ENTRY.cdw10], al - ; TODO: Set CDW10.SV and CDW14.UUID to valid value + movzx eax, [fid] + or eax, 1 shl 31 ; CDW10.SV + mov dword [esi + SQ_ENTRY.cdw10], eax stdcall write_admin_cmd, [pci] pop esi ret @@ -589,8 +591,8 @@ proc nvme_init stdcall, pci:dword and al, 0x40 ; maximum completion queue entry size should at least be 16 bytes jl .exit_fail - ;invoke GetPhysAddr, esi - ;stdcall set_features, [pci], eax, FID_NUMBER_OF_QUEUES + invoke GetPhysAddr, esi + stdcall set_features, [pci], eax, FID_NUMBER_OF_QUEUES ; Creates I/O Queues ;stdcall create_io_completion_queue, [pci], @@ -738,6 +740,7 @@ proc write_admin_cmd stdcall, pci:dword mov esi, dword [esi + pcidev.queue_entries] mov ax, word [esi + NVM_QUEUE_ENTRY.tail] cmp ax, NVM_ASQS + je @f xor ax, ax @@: @@ -819,6 +822,7 @@ proc irq_handler .fail0: jmp .fail0 .not_fail0: + not eax end if and dword [esi + NVM_QUEUE_ENTRY.cid_slots], eax jmp .end @@ -832,6 +836,7 @@ proc irq_handler .fail1: jmp .fail0 .not_fail1: + not eax end if and dword [esi + NVM_QUEUE_ENTRY.cid_slots + 4], eax