summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/Modules/NVME
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-08-18 21:39:29 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-08-18 21:39:29 +0200
commitda70596895d8135e08f8caac6978117697b4c021 (patch)
tree2516785b5434df8453687f05dc8dd877438901ab /dev/Kernel/Modules/NVME
parent005de79004c9d30e64bdee6e14e06f9d47d1f2ab (diff)
[REFACTOR]
Improved project structure. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/Modules/NVME')
-rw-r--r--dev/Kernel/Modules/NVME/.gitkeep0
-rw-r--r--dev/Kernel/Modules/NVME/Defines.hxx116
-rw-r--r--dev/Kernel/Modules/NVME/compile_flags.txt4
3 files changed, 0 insertions, 120 deletions
diff --git a/dev/Kernel/Modules/NVME/.gitkeep b/dev/Kernel/Modules/NVME/.gitkeep
deleted file mode 100644
index e69de29b..00000000
--- a/dev/Kernel/Modules/NVME/.gitkeep
+++ /dev/null
diff --git a/dev/Kernel/Modules/NVME/Defines.hxx b/dev/Kernel/Modules/NVME/Defines.hxx
deleted file mode 100644
index 6ab57ccb..00000000
--- a/dev/Kernel/Modules/NVME/Defines.hxx
+++ /dev/null
@@ -1,116 +0,0 @@
-/* -------------------------------------------
-
- Copyright ZKA Technologies.
-
- Revision History:
-
- ??/??/24: Added file (amlel)
- 23 Jul 24: Update filename to Defines.hxx and using ALIGN_NVME for NVME structs. (amlel)
-
-------------------------------------------- */
-
-#ifndef __MODULE_NVME_HXX__
-#define __MODULE_NVME_HXX__
-
-#include <NewKit/Defines.hxx>
-
-/// TODO: checklist in: https://wiki.osdev.org/NVMe
-
-#define ALIGN_NVME ATTRIBUTE(aligned(sizeof(Kernel::NVMEInt32)))
-
-namespace Kernel
-{
- typedef UInt32 NVMEInt32;
-
- struct ALIGN_NVME NVMEBar0 final
- {
- NVMEInt32 fCap;
- NVMEInt32 fVer;
- NVMEInt32 fIntMaskSet;
- NVMEInt32 fIntMaskClr;
- NVMEInt32 fContrlConf;
- NVMEInt32 fContrlStat;
- NVMEInt32 fAdminQueueAttr;
- NVMEInt32 fAdminSubmissionQueue;
- NVMEInt32 fAdminCompletionQueue;
- };
-
- struct ALIGN_NVME NVMEQueue final
- {
- NVMEInt32 fOpcode;
- NVMEInt32 fNSID;
- NVMEInt32 fReserved[3];
- NVMEInt32 fMetadataPtr[5];
- NVMEInt32 fDataPtr[9];
- NVMEInt32 CommandSpecific[15];
- };
-
- enum
- {
- eCreateCompletionQueueNVME = 0x05,
- eCreateSubmissionQueueNVME = 0x01,
- eIdentifyNVME = 0x06,
- eReadNVME = 0x02,
- eWriteNVME = 0x01,
- };
-
- template <Int32 Opcode>
- inline Bool nvme_create_admin_command(NVMEQueue* entry, UInt32 nsid,
- UInt32 prpTransfer[3],
- UInt32 startingLba[2], UInt32 lowTransferBlocks)
- {
- if (entry == nullptr)
- return false;
-
- entry->CommandSpecific[9] = startingLba[0];
- entry->CommandSpecific[10] = startingLba[1];
-
- entry->CommandSpecific[11] = lowTransferBlocks;
-
- entry->CommandSpecific[5] = prpTransfer[0];
- entry->CommandSpecific[6] = prpTransfer[1];
- entry->CommandSpecific[7] = prpTransfer[2];
-
- entry->CommandSpecific[0] = nsid;
-
- return true;
- }
-
- template <Int32 Opcode>
- inline Bool nvme_create_io_command(NVMEQueue* entry, UInt64 baseAddress,
- UInt32 identLoAndQueueSizeHi, UInt32 flagsLoAndQueueComplIdHi,
- UInt32 identify, Bool provideIdentify = false, Bool namespaceIdentify = false)
- {
- if (entry == nullptr)
- return false;
-
- if (baseAddress == 0)
- return false;
-
- entry->fOpcode = Opcode;
-
- entry->CommandSpecific[5] = (baseAddress & 0xFF);
- entry->CommandSpecific[6] = static_cast<UInt32>(baseAddress);
-
- if (!provideIdentify)
- {
- entry->CommandSpecific[9] = identLoAndQueueSizeHi;
- entry->CommandSpecific[10] = flagsLoAndQueueComplIdHi;
- }
- else
- {
- entry->CommandSpecific[9] = identify;
-
- if (namespaceIdentify)
- {
- entry->CommandSpecific[0] = 1;
- }
- }
-
- // use (1 << 0) as contigunous is better supported.
-
- return true;
- }
-} // namespace Kernel
-
-#endif // ifndef __MODULE_NVME_HXX__
diff --git a/dev/Kernel/Modules/NVME/compile_flags.txt b/dev/Kernel/Modules/NVME/compile_flags.txt
deleted file mode 100644
index 1bc51142..00000000
--- a/dev/Kernel/Modules/NVME/compile_flags.txt
+++ /dev/null
@@ -1,4 +0,0 @@
--I./
--I../
--I../../
--std=c++20