summaryrefslogtreecommitdiffhomepage
path: root/dev/ZKAKit/StorageKit
diff options
context:
space:
mode:
authorAmlal <amlal.elmahrouss@icloud.com>2024-10-28 07:01:58 +0100
committerAmlal <amlal.elmahrouss@icloud.com>2024-10-28 07:01:58 +0100
commite0024d9ea688ee91a77abc0e28c5ea24b13ca67d (patch)
treea4e29bd919cbeccf2689e81a5d52bfc02f2a8b77 /dev/ZKAKit/StorageKit
parent36a3600ff7fc65a63b7386b7a680dbe8e647bd8f (diff)
IMP: Refactor whole source code to make it even.
- That is because previously the source was both in lowercase and lettercase. Signed-off-by: Amlal <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZKAKit/StorageKit')
-rw-r--r--dev/ZKAKit/StorageKit/AHCI.h33
-rw-r--r--dev/ZKAKit/StorageKit/ATA.h39
-rw-r--r--dev/ZKAKit/StorageKit/NVME.h36
-rw-r--r--dev/ZKAKit/StorageKit/PRDT.h36
-rw-r--r--dev/ZKAKit/StorageKit/SCSI.h11
-rw-r--r--dev/ZKAKit/StorageKit/Storage.h22
6 files changed, 177 insertions, 0 deletions
diff --git a/dev/ZKAKit/StorageKit/AHCI.h b/dev/ZKAKit/StorageKit/AHCI.h
new file mode 100644
index 00000000..e89f5654
--- /dev/null
+++ b/dev/ZKAKit/StorageKit/AHCI.h
@@ -0,0 +1,33 @@
+/* -------------------------------------------
+
+ Copyright ZKA Web Services Co.
+
+------------------------------------------- */
+
+#pragma once
+
+#include <KernelKit/DeviceMgr.h>
+#include <KernelKit/DriveMgr.h>
+#include <NewKit/OwnPtr.h>
+
+namespace Kernel
+{
+ class AHCIDeviceInterface : public DeviceInterface<MountpointInterface*>
+ {
+ public:
+ explicit AHCIDeviceInterface(void (*Out)(MountpointInterface* outpacket),
+ void (*In)(MountpointInterface* inpacket),
+ void (*Cleanup)(void));
+
+ virtual ~AHCIDeviceInterface();
+
+ public:
+ AHCIDeviceInterface& operator=(const AHCIDeviceInterface&) = default;
+ AHCIDeviceInterface(const AHCIDeviceInterface&) = default;
+
+ const Char* Name() const override;
+
+ private:
+ void (*fCleanup)(void) = {nullptr};
+ };
+} // namespace Kernel
diff --git a/dev/ZKAKit/StorageKit/ATA.h b/dev/ZKAKit/StorageKit/ATA.h
new file mode 100644
index 00000000..d4efd15c
--- /dev/null
+++ b/dev/ZKAKit/StorageKit/ATA.h
@@ -0,0 +1,39 @@
+/* -------------------------------------------
+
+ Copyright ZKA Web Services Co.
+
+------------------------------------------- */
+
+#pragma once
+
+#include <KernelKit/DeviceMgr.h>
+#include <KernelKit/DriveMgr.h>
+#include <NewKit/OwnPtr.h>
+#include <NewKit/Utils.h>
+
+namespace Kernel
+{
+ /// @brief ATA device interface type.
+ class ATADeviceInterface : public DeviceInterface<MountpointInterface*>
+ {
+ public:
+ explicit ATADeviceInterface(void (*Out)(MountpointInterface* outpacket),
+ void (*In)(MountpointInterface* inpacket),
+ void (*Cleanup)(void));
+
+ virtual ~ATADeviceInterface();
+
+ public:
+ ATADeviceInterface& operator<<(MountpointInterface* Data) override;
+ ATADeviceInterface& operator>>(MountpointInterface* Data) override;
+
+ public:
+ ATADeviceInterface& operator=(const ATADeviceInterface&) = default;
+ ATADeviceInterface(const ATADeviceInterface&) = default;
+
+ const Char* Name() const override;
+
+ private:
+ void (*fCleanup)(void) = {nullptr};
+ };
+} // namespace Kernel
diff --git a/dev/ZKAKit/StorageKit/NVME.h b/dev/ZKAKit/StorageKit/NVME.h
new file mode 100644
index 00000000..04b3df7f
--- /dev/null
+++ b/dev/ZKAKit/StorageKit/NVME.h
@@ -0,0 +1,36 @@
+/* -------------------------------------------
+
+ Copyright ZKA Web Services Co.
+
+------------------------------------------- */
+
+#pragma once
+
+#include <KernelKit/DeviceMgr.h>
+#include <KernelKit/DriveMgr.h>
+#include <NewKit/OwnPtr.h>
+
+namespace Kernel
+{
+ class NVMEDeviceInterface final : public DeviceInterface<MountpointInterface*>
+ {
+ public:
+ explicit NVMEDeviceInterface(void (*Out)(MountpointInterface* outpacket),
+ void (*In)(MountpointInterface* inpacket),
+ void (*Cleanup)(void));
+
+ ~NVMEDeviceInterface() override;
+
+ public:
+ NVMEDeviceInterface& operator=(const NVMEDeviceInterface&) = default;
+ NVMEDeviceInterface(const NVMEDeviceInterface&) = default;
+
+ const Char* Name() const override;
+
+ public:
+ OwnPtr<MountpointInterface*> operator()(UInt32 dmaLow, UInt32 dmaHigh, SizeT sz);
+
+ private:
+ void (*fCleanup)(void) = {nullptr};
+ };
+} // namespace Kernel
diff --git a/dev/ZKAKit/StorageKit/PRDT.h b/dev/ZKAKit/StorageKit/PRDT.h
new file mode 100644
index 00000000..993782bf
--- /dev/null
+++ b/dev/ZKAKit/StorageKit/PRDT.h
@@ -0,0 +1,36 @@
+/* -------------------------------------------
+
+ Copyright ZKA Web Services Co.
+
+------------------------------------------- */
+
+#pragma once
+
+#include <KernelKit/PCI/DMA.h>
+#include <KernelKit/PCI/Iterator.h>
+#include <NewKit/Ref.h>
+
+#define kPrdtTransferSize (sizeof(Kernel::UShort))
+
+namespace Kernel
+{
+ /// @brief Tranfer information about PRD.
+ enum kPRDTTransfer
+ {
+ kPRDTTransferInProgress,
+ kPRDTTransferIsDone,
+ kPRDTTransferCount,
+ };
+
+ /// @brief Physical Region Descriptor Table.
+ struct PRDT
+ {
+ UInt32 fPhysAddress;
+ UInt32 fSectorCount;
+ UInt8 fEndBit;
+ };
+
+ void construct_prdt(Ref<PRDT>& prd);
+
+ EXTERN_C Int32 kPRDTTransferStatus;
+} // namespace Kernel
diff --git a/dev/ZKAKit/StorageKit/SCSI.h b/dev/ZKAKit/StorageKit/SCSI.h
new file mode 100644
index 00000000..2859e29a
--- /dev/null
+++ b/dev/ZKAKit/StorageKit/SCSI.h
@@ -0,0 +1,11 @@
+/* -------------------------------------------
+
+ Copyright ZKA Web Services Co.
+
+------------------------------------------- */
+
+#pragma once
+
+#include <Modules/SCSI/SCSI.h>
+
+extern const scsi_packet_type<12> kCDRomPacketTemplate;
diff --git a/dev/ZKAKit/StorageKit/Storage.h b/dev/ZKAKit/StorageKit/Storage.h
new file mode 100644
index 00000000..5d388c7e
--- /dev/null
+++ b/dev/ZKAKit/StorageKit/Storage.h
@@ -0,0 +1,22 @@
+/* -------------------------------------------
+
+ Copyright ZKA Web Services Co.
+
+------------------------------------------- */
+
+#pragma once
+
+#define kDriveSectorSizeHDD (512U)
+#define kDriveSectorSizeSSD (512U)
+#define kDriveSectorSizeOptical (2048)
+
+namespace Kernel
+{
+ template <typename T>
+ class DeviceInterface;
+
+ class NVMEDeviceInterface;
+ class AHCIDeviceInterface;
+ class ATADeviceInterface;
+ class SCSIDeviceInterface;
+} // namespace Kernel