diff options
| author | Amlal <amlal@el-mahrouss-logic.com> | 2024-09-22 17:46:11 +0200 |
|---|---|---|
| committer | Amlal <amlal@el-mahrouss-logic.com> | 2024-09-22 17:46:11 +0200 |
| commit | 8719b4570a2d10dd49a0d3a47e24f5c55bdda85e (patch) | |
| tree | ba095740888f3768e08b2ea058b0ea6da2d0403d /dev/zka/StorageKit | |
| parent | 45944b3d2dab04b763fcc6d10164fe8069e60b08 (diff) | |
:boom: A big refactor on the filesystem structure.
Signed-off-by: Amlal <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'dev/zka/StorageKit')
| -rw-r--r-- | dev/zka/StorageKit/AHCI.hxx | 33 | ||||
| -rw-r--r-- | dev/zka/StorageKit/ATA.hxx | 39 | ||||
| -rw-r--r-- | dev/zka/StorageKit/NVME.hxx | 36 | ||||
| -rw-r--r-- | dev/zka/StorageKit/PRDT.hxx | 36 | ||||
| -rw-r--r-- | dev/zka/StorageKit/SCSI.hxx | 11 | ||||
| -rw-r--r-- | dev/zka/StorageKit/Storage.hxx | 22 |
6 files changed, 177 insertions, 0 deletions
diff --git a/dev/zka/StorageKit/AHCI.hxx b/dev/zka/StorageKit/AHCI.hxx new file mode 100644 index 00000000..f3d771c9 --- /dev/null +++ b/dev/zka/StorageKit/AHCI.hxx @@ -0,0 +1,33 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + +------------------------------------------- */ + +#pragma once + +#include <KernelKit/DeviceMgr.hxx> +#include <KernelKit/DriveMgr.hxx> +#include <NewKit/OwnPtr.hxx> + +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/zka/StorageKit/ATA.hxx b/dev/zka/StorageKit/ATA.hxx new file mode 100644 index 00000000..e954b0e7 --- /dev/null +++ b/dev/zka/StorageKit/ATA.hxx @@ -0,0 +1,39 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + +------------------------------------------- */ + +#pragma once + +#include <KernelKit/DeviceMgr.hxx> +#include <KernelKit/DriveMgr.hxx> +#include <NewKit/OwnPtr.hxx> +#include <NewKit/Utils.hxx> + +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/zka/StorageKit/NVME.hxx b/dev/zka/StorageKit/NVME.hxx new file mode 100644 index 00000000..45d00c0c --- /dev/null +++ b/dev/zka/StorageKit/NVME.hxx @@ -0,0 +1,36 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + +------------------------------------------- */ + +#pragma once + +#include <KernelKit/DeviceMgr.hxx> +#include <KernelKit/DriveMgr.hxx> +#include <NewKit/OwnPtr.hxx> + +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/zka/StorageKit/PRDT.hxx b/dev/zka/StorageKit/PRDT.hxx new file mode 100644 index 00000000..6dec22c2 --- /dev/null +++ b/dev/zka/StorageKit/PRDT.hxx @@ -0,0 +1,36 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + +------------------------------------------- */ + +#pragma once + +#include <KernelKit/PCI/Dma.hxx> +#include <KernelKit/PCI/Iterator.hxx> +#include <NewKit/Ref.hxx> + +#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/zka/StorageKit/SCSI.hxx b/dev/zka/StorageKit/SCSI.hxx new file mode 100644 index 00000000..5a684052 --- /dev/null +++ b/dev/zka/StorageKit/SCSI.hxx @@ -0,0 +1,11 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + +------------------------------------------- */ + +#pragma once + +#include <Modules/SCSI/SCSI.hxx> + +extern const scsi_packet_type kCDRomPacketTemplate; diff --git a/dev/zka/StorageKit/Storage.hxx b/dev/zka/StorageKit/Storage.hxx new file mode 100644 index 00000000..70f22420 --- /dev/null +++ b/dev/zka/StorageKit/Storage.hxx @@ -0,0 +1,22 @@ +/* ------------------------------------------- + + Copyright ZKA Technologies. + +------------------------------------------- */ + +#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 |
