summaryrefslogtreecommitdiffhomepage
path: root/Private/StorageKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-04-03 09:20:28 +0200
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-04-03 09:20:28 +0200
commit3facc32b746a44b0e3a91cbe1897127194396d1b (patch)
tree0725ebbf35a18e6933596ea5c765ac81adf7834f /Private/StorageKit
parentefc6b5d169d2b6eaabe7384141cec6054ae622a0 (diff)
MHR-3: See main changes below.
Kernel: Improve Disk interfaces regarding the struct they're using (all of them are using MountpountInterface now) SystemLib: Start adding PowerPC code to the SystemLib to be cross compiled as a PEF FAT binary. Kernel: Adding new builtins to support a wide range of hardware. Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/StorageKit')
-rw-r--r--Private/StorageKit/AHCI.hpp20
-rw-r--r--Private/StorageKit/ATA.hpp26
-rw-r--r--Private/StorageKit/NVME.hpp19
-rw-r--r--Private/StorageKit/SCSI.hxx11
-rw-r--r--Private/StorageKit/Storage.hpp14
5 files changed, 34 insertions, 56 deletions
diff --git a/Private/StorageKit/AHCI.hpp b/Private/StorageKit/AHCI.hpp
index 6f5b5a90..08548a1c 100644
--- a/Private/StorageKit/AHCI.hpp
+++ b/Private/StorageKit/AHCI.hpp
@@ -7,15 +7,14 @@
#pragma once
#include <KernelKit/DeviceManager.hpp>
+#include <KernelKit/DriveManager.hxx>
#include <NewKit/OwnPtr.hpp>
namespace NewOS {
-class AHCIPacket;
-
-class AHCIDeviceInterface : public DeviceInterface<AHCIPacket> {
+class AHCIDeviceInterface : public DeviceInterface<MountpointInterface*> {
public:
- explicit AHCIDeviceInterface(void (*Out)(AHCIPacket outpacket),
- void (*In)(AHCIPacket inpacket),
+ explicit AHCIDeviceInterface(void (*Out)(MountpointInterface* outpacket),
+ void (*In)(MountpointInterface* inpacket),
void (*Cleanup)(void));
virtual ~AHCIDeviceInterface();
@@ -27,17 +26,6 @@ class AHCIDeviceInterface : public DeviceInterface<AHCIPacket> {
const char *Name() const override;
private:
- void (*fOut)(AHCIPacket);
- void (*fIn)(AHCIPacket);
void (*fCleanup)(void);
};
-
-class AHCIPacket final {
- UIntPtr DataPtr;
- SizeT DataSz;
- UInt8 PortId;
- UInt8 PortRdy;
- Lba BeginLba;
- Lba SectorCnt;
-};
} // namespace NewOS \ No newline at end of file
diff --git a/Private/StorageKit/ATA.hpp b/Private/StorageKit/ATA.hpp
index 5ad5a2d4..da3c8d23 100644
--- a/Private/StorageKit/ATA.hpp
+++ b/Private/StorageKit/ATA.hpp
@@ -7,19 +7,24 @@
#pragma once
#include <KernelKit/DeviceManager.hpp>
+#include <KernelKit/DriveManager.hxx>
#include <NewKit/OwnPtr.hpp>
+#include <NewKit/Utils.hpp>
namespace NewOS {
-class ATAPacket;
-
-class ATADeviceInterface : public DeviceInterface<ATAPacket> {
+/// @brief ATA device interface type.
+class ATADeviceInterface : public DeviceInterface<MountpointInterface*> {
public:
- explicit ATADeviceInterface(void (*Out)(ATAPacket outpacket),
- void (*In)(ATAPacket inpacket),
+ 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;
@@ -27,17 +32,6 @@ class ATADeviceInterface : public DeviceInterface<ATAPacket> {
const char *Name() const override;
private:
- void (*fOut)(ATAPacket);
- void (*fIn)(ATAPacket);
void (*fCleanup)(void);
};
-
-class ATAPacket final {
- UIntPtr DataPtr;
- SizeT DataSz;
- UInt8 PortId;
- UInt8 PortRdy;
- Lba BeginLba;
- Lba SectorCnt;
-};
} // namespace NewOS \ No newline at end of file
diff --git a/Private/StorageKit/NVME.hpp b/Private/StorageKit/NVME.hpp
index d2ed585f..dc7b37d8 100644
--- a/Private/StorageKit/NVME.hpp
+++ b/Private/StorageKit/NVME.hpp
@@ -7,15 +7,14 @@
#pragma once
#include <KernelKit/DeviceManager.hpp>
+#include <KernelKit/DriveManager.hxx>
#include <NewKit/OwnPtr.hpp>
namespace NewOS {
-class NVMEPacket;
-
-class NVMEDeviceInterface : public DeviceInterface<NVMEPacket> {
+class NVMEDeviceInterface : public DeviceInterface<MountpointInterface*> {
public:
- explicit NVMEDeviceInterface(void (*Out)(NVMEPacket outpacket),
- void (*In)(NVMEPacket inpacket), void (*Cleanup)(void))
+ explicit NVMEDeviceInterface(void (*Out)(MountpointInterface* outpacket),
+ void (*In)(MountpointInterface* inpacket), void (*Cleanup)(void))
: DeviceInterface(Out, In), fCleanup(Cleanup) {}
virtual ~NVMEDeviceInterface() {
@@ -29,17 +28,9 @@ class NVMEDeviceInterface : public DeviceInterface<NVMEPacket> {
const char *Name() const override;
public:
- OwnPtr<NVMEPacket> operator()(UInt32 dmaLow, UInt32 dmaHigh, SizeT sz);
+ OwnPtr<MountpointInterface*> operator()(UInt32 dmaLow, UInt32 dmaHigh, SizeT sz);
private:
void (*fCleanup)(void);
};
-
-class NVMEPacket final {
- UIntPtr DataPtr;
- SizeT DataSz;
- UInt8 Namespace;
- Lba Begin;
- Lba End;
-};
} // namespace NewOS
diff --git a/Private/StorageKit/SCSI.hxx b/Private/StorageKit/SCSI.hxx
new file mode 100644
index 00000000..eb207c9d
--- /dev/null
+++ b/Private/StorageKit/SCSI.hxx
@@ -0,0 +1,11 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#pragma once
+
+#include <Builtins/SAS/SCSI.hxx>
+
+extern const scsi_packet_type kCDRomPacketTemplate;
diff --git a/Private/StorageKit/Storage.hpp b/Private/StorageKit/Storage.hpp
index 8e7614e6..530e63bd 100644
--- a/Private/StorageKit/Storage.hpp
+++ b/Private/StorageKit/Storage.hpp
@@ -9,14 +9,8 @@
#include <NewKit/Defines.hpp>
#include <StorageKit/NVME.hpp>
#include <StorageKit/AHCI.hpp>
+#include <StorageKit/SCSI.hxx>
-typedef NewOS::UInt16 SKScsiPacket[12];
-
-extern const SKScsiPacket kCDRomPacketTemplate;
-
-#define f_kDriveSectorSizeHDD (512)
-#define f_kDriveSectorSizeSSD (4096)
-#define f_kDriveSectorSizeCDROM (2048)
-
-#define f_kDriveSize(LAST_LBA) ((LAST_LBA + 1) * f_kDriveSectorSize)
-
+#define kDriveSectorSizeHDD (512)
+#define kDriveSectorSizeSSD (4096)
+#define kDriveSectorSizeCDROM (2048)