From caf8e435139f2501cf28be17f784af3af7e0cfb1 Mon Sep 17 00:00:00 2001 From: Abdur-Rahman Mansoor Date: Thu, 8 Aug 2024 18:37:05 -0400 Subject: [PATCH] remove useless exact alignment alloc --- drivers/nvme/nvme.asm | 12 ------------ drivers/nvme/nvme.inc | 8 +++----- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/drivers/nvme/nvme.asm b/drivers/nvme/nvme.asm index 357d029..cad32a9 100644 --- a/drivers/nvme/nvme.asm +++ b/drivers/nvme/nvme.asm @@ -718,22 +718,10 @@ proc nvme_init stdcall, pci:dword xor ebx, ebx .init_queues: - invoke AllocPages, QUEUE_ALLOC_SIZE / PAGE_SIZE - test eax, eax - jz .exit_fail - or eax, PG_SW+PG_NOCACHE - mov esi, eax invoke KernelAlloc, QUEUE_ALLOC_SIZE test eax, eax jz .exit_fail mov dword [edi + ebx + NVM_QUEUE_ENTRY.cq_ptr], eax - push ebx - mov ebx, eax - mov eax, esi - mov ecx, QUEUE_ALLOC_SIZE / PAGE_SIZE - invoke CommitPages - pop ebx - mov eax, dword [edi + ebx + NVM_QUEUE_ENTRY.cq_ptr] mov edx, eax add eax, CQ_ALLOC_SIZE mov dword [edi + ebx + NVM_QUEUE_ENTRY.sq_ptr], eax diff --git a/drivers/nvme/nvme.inc b/drivers/nvme/nvme.inc index dca1fc1..8cab8d6 100644 --- a/drivers/nvme/nvme.inc +++ b/drivers/nvme/nvme.inc @@ -17,15 +17,15 @@ VS130 = 0x00010300 ; (v1.3.0) VS140 = 0x00010400 ; (v1.4.0) NVM_MPS = 0 ; Memory Page Size (2 ^ (12 + MPS)) -NVM_ASQS = 256 ; Admin Submission Queue Size +NVM_ASQS = 64 ; Admin Submission Queue Size NVM_ACQS = NVM_ASQS ; Admin Completion Queue Size LAST_QUEUE_ID = 1 ; Index of the last queue SQ_ENTRIES = NVM_ASQS ; I/O and Admin Submission Queue Size CQ_ENTRIES = NVM_ACQS ; I/O and Admin Completion Queue Size PAGE_SIZE = 4096 shl NVM_MPS ; Use 4KiB pages SUPPORTED_LBADS = 9 ; KolibriOS only supports LBADS of 512, later on we may remove this restriction -SQ_ALLOC_SIZE = NVM_ASQS * sizeof.SQ_ENTRY -CQ_ALLOC_SIZE = NVM_ACQS * sizeof.CQ_ENTRY +SQ_ALLOC_SIZE = 0x1000 +CQ_ALLOC_SIZE = 0x1000 QUEUE_ALLOC_SIZE = SQ_ALLOC_SIZE + CQ_ALLOC_SIZE SIZEOF_SQ_ENTRY = 6 ; log2(sizeof.SQ_ENTRY) SIZEOF_CQ_ENTRY = 4 ; log2(sizeof.CQ_ENTRY) @@ -574,8 +574,6 @@ assert sizeof.NSGRANLS = 288 assert sizeof.NVMQCMD = 16 assert SIZEOF_SQ_ENTRY = 6 assert SIZEOF_CQ_ENTRY = 4 -assert (SQ_ENTRIES * sizeof.SQ_ENTRY) mod PAGE_SIZE = 0 -assert (CQ_ENTRIES * sizeof.CQ_ENTRY) mod PAGE_SIZE = 0 ; NOTE: DO NOT CHANGE THIS ASSERTION! ; If you do decide to change it, you'll have