summaryrefslogtreecommitdiffhomepage
path: root/Private/Source/Storage
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/Source/Storage
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/Source/Storage')
-rw-r--r--Private/Source/Storage/AHCIDeviceInterface.cxx4
-rw-r--r--Private/Source/Storage/ATADeviceInterface.cxx68
-rw-r--r--Private/Source/Storage/SCSIDeviceInterface.cxx (renamed from Private/Source/Storage/StorageBase.cxx)4
3 files changed, 72 insertions, 4 deletions
diff --git a/Private/Source/Storage/AHCIDeviceInterface.cxx b/Private/Source/Storage/AHCIDeviceInterface.cxx
index c6a4a4be..c7a99cb0 100644
--- a/Private/Source/Storage/AHCIDeviceInterface.cxx
+++ b/Private/Source/Storage/AHCIDeviceInterface.cxx
@@ -12,8 +12,8 @@ using namespace NewOS;
/// @param Out Disk output
/// @param In Disk input
/// @param Cleanup Disk cleanup.
-AHCIDeviceInterface::AHCIDeviceInterface(void (*Out)(AHCIPacket outpacket),
- void (*In)(AHCIPacket inpacket), void (*Cleanup)(void))
+AHCIDeviceInterface::AHCIDeviceInterface(void (*Out)(MountpointInterface* outpacket),
+ void (*In)(MountpointInterface* inpacket), void (*Cleanup)(void))
: DeviceInterface(Out, In), fCleanup(Cleanup) {}
/// @brief Class desctructor
diff --git a/Private/Source/Storage/ATADeviceInterface.cxx b/Private/Source/Storage/ATADeviceInterface.cxx
new file mode 100644
index 00000000..89f11f5d
--- /dev/null
+++ b/Private/Source/Storage/ATADeviceInterface.cxx
@@ -0,0 +1,68 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#include <StorageKit/ATA.hpp>
+
+using namespace NewOS;
+
+/// @brief Class constructor
+/// @param Out Disk output
+/// @param In Disk input
+/// @param Cleanup Disk cleanup.
+ATADeviceInterface::ATADeviceInterface(
+ void (*Out)(MountpointInterface* outpacket),
+ void (*In)(MountpointInterface* inpacket), void (*Cleanup)(void))
+ : DeviceInterface(Out, In), fCleanup(Cleanup) {}
+
+/// @brief Class desctructor
+ATADeviceInterface::~ATADeviceInterface() {
+ MUST_PASS(fCleanup);
+ if (fCleanup) fCleanup();
+}
+
+/// @brief Returns the name of the device interface.
+/// @return it's name as a string.
+const char* ATADeviceInterface::Name() const { return "ATADeviceInterface"; }
+
+/// @brief Output operator.
+/// @param Data
+/// @return
+ATADeviceInterface& ATADeviceInterface::operator<<(MountpointInterface* Data) {
+ if (!Data) return *this;
+
+ for (SizeT driveCount = 0; driveCount < kDriveManagerCount; ++driveCount) {
+ auto interface = Data->GetAddressOf(driveCount);
+ if ((*interface) && rt_string_cmp((*interface)->fDriveKind(), "ATA-", 5) == 0) {
+ continue;
+ } else if ((*interface) &&
+ rt_string_cmp((*interface)->fDriveKind(), "ATA-", 5) != 0) {
+ return *this;
+ }
+ }
+
+ return (ATADeviceInterface&)DeviceInterface<MountpointInterface*>::operator<<(
+ Data);
+}
+
+/// @brief Input operator.
+/// @param Data
+/// @return
+ATADeviceInterface& ATADeviceInterface::operator>>(MountpointInterface* Data) {
+ if (!Data) return *this;
+
+ for (SizeT driveCount = 0; driveCount < kDriveManagerCount; ++driveCount) {
+ auto interface = Data->GetAddressOf(driveCount);
+ if ((*interface) && rt_string_cmp((*interface)->fDriveKind(), "ATA-", 5) == 0) {
+ continue;
+ } else if ((*interface) &&
+ rt_string_cmp((*interface)->fDriveKind(), "ATA-", 5) != 0) {
+ return *this;
+ }
+ }
+
+ return (ATADeviceInterface&)DeviceInterface<MountpointInterface*>::operator>>(
+ Data);
+} \ No newline at end of file
diff --git a/Private/Source/Storage/StorageBase.cxx b/Private/Source/Storage/SCSIDeviceInterface.cxx
index bba4be1f..7625a279 100644
--- a/Private/Source/Storage/StorageBase.cxx
+++ b/Private/Source/Storage/SCSIDeviceInterface.cxx
@@ -4,8 +4,8 @@
------------------------------------------- */
-#include <StorageKit/Storage.hpp>
+#include <StorageKit/SCSI.hxx>
///! @brief ATAPI SCSI packet.
-const SKScsiPacket kCDRomPacketTemplate = {0x43, 0, 1, 0, 0, 0,
+const scsi_packet_type kCDRomPacketTemplate = {0x43, 0, 1, 0, 0, 0,
0, 12, 0x40, 0, 0};