summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/Sources/Storage
diff options
context:
space:
mode:
Diffstat (limited to 'dev/Kernel/Sources/Storage')
-rw-r--r--dev/Kernel/Sources/Storage/AHCIDeviceInterface.cxx35
-rw-r--r--dev/Kernel/Sources/Storage/ATADeviceInterface.cxx88
-rw-r--r--dev/Kernel/Sources/Storage/NVMEDeviceInterface.cxx28
-rw-r--r--dev/Kernel/Sources/Storage/SCSIDeviceInterface.cxx11
4 files changed, 162 insertions, 0 deletions
diff --git a/dev/Kernel/Sources/Storage/AHCIDeviceInterface.cxx b/dev/Kernel/Sources/Storage/AHCIDeviceInterface.cxx
new file mode 100644
index 00000000..dde33193
--- /dev/null
+++ b/dev/Kernel/Sources/Storage/AHCIDeviceInterface.cxx
@@ -0,0 +1,35 @@
+/* -------------------------------------------
+
+ Copyright ZKA Technologies.
+
+------------------------------------------- */
+
+#include <StorageKit/AHCI.hxx>
+
+using namespace Kernel;
+
+/// @brief Class constructor
+/// @param Out Disk output
+/// @param In Disk input
+/// @param Cleanup Disk cleanup.
+AHCIDeviceInterface::AHCIDeviceInterface(void (*Out)(MountpointInterface* outpacket),
+ void (*In)(MountpointInterface* inpacket),
+ void (*Cleanup)(void))
+ : DeviceInterface(Out, In), fCleanup(Cleanup)
+{
+}
+
+/// @brief Class desctructor
+AHCIDeviceInterface::~AHCIDeviceInterface()
+{
+ MUST_PASS(fCleanup);
+ if (fCleanup)
+ fCleanup();
+}
+
+/// @brief Returns the name of the device interface.
+/// @return it's name as a string.
+const char* AHCIDeviceInterface::Name() const
+{
+ return "AHCIDeviceInterface";
+}
diff --git a/dev/Kernel/Sources/Storage/ATADeviceInterface.cxx b/dev/Kernel/Sources/Storage/ATADeviceInterface.cxx
new file mode 100644
index 00000000..1611e790
--- /dev/null
+++ b/dev/Kernel/Sources/Storage/ATADeviceInterface.cxx
@@ -0,0 +1,88 @@
+/* -------------------------------------------
+
+ Copyright ZKA Technologies.
+
+------------------------------------------- */
+
+#include <StorageKit/ATA.hxx>
+
+using namespace Kernel;
+
+/// @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);
+}
diff --git a/dev/Kernel/Sources/Storage/NVMEDeviceInterface.cxx b/dev/Kernel/Sources/Storage/NVMEDeviceInterface.cxx
new file mode 100644
index 00000000..7d07bf4b
--- /dev/null
+++ b/dev/Kernel/Sources/Storage/NVMEDeviceInterface.cxx
@@ -0,0 +1,28 @@
+/* -------------------------------------------
+
+ Copyright ZKA Technologies.
+
+------------------------------------------- */
+
+#include <StorageKit/NVME.hxx>
+
+namespace Kernel
+{
+ NVMEDeviceInterface::NVMEDeviceInterface(void (*Out)(MountpointInterface* outpacket),
+ void (*In)(MountpointInterface* inpacket),
+ void (*Cleanup)(void))
+ : DeviceInterface(Out, In), fCleanup(Cleanup)
+ {
+ }
+
+ NVMEDeviceInterface::~NVMEDeviceInterface()
+ {
+ if (fCleanup)
+ fCleanup();
+ }
+
+ const char* NVMEDeviceInterface::Name() const
+ {
+ return ("NVMEDeviceInterface");
+ }
+} // namespace Kernel
diff --git a/dev/Kernel/Sources/Storage/SCSIDeviceInterface.cxx b/dev/Kernel/Sources/Storage/SCSIDeviceInterface.cxx
new file mode 100644
index 00000000..da75a181
--- /dev/null
+++ b/dev/Kernel/Sources/Storage/SCSIDeviceInterface.cxx
@@ -0,0 +1,11 @@
+/* -------------------------------------------
+
+ Copyright ZKA Technologies.
+
+------------------------------------------- */
+
+#include <StorageKit/SCSI.hxx>
+
+///! @brief ATAPI SCSI packet.
+const scsi_packet_type kCDRomPacketTemplate = {0x43, 0, 1, 0, 0, 0,
+ 0, 12, 0x40, 0, 0};