summaryrefslogtreecommitdiffhomepage
path: root/dev/ZKAKit/src/Storage
diff options
context:
space:
mode:
Diffstat (limited to 'dev/ZKAKit/src/Storage')
-rw-r--r--dev/ZKAKit/src/Storage/AHCIDeviceInterface.cc35
-rw-r--r--dev/ZKAKit/src/Storage/ATADeviceInterface.cc88
-rw-r--r--dev/ZKAKit/src/Storage/NVMEDeviceInterface.cc28
-rw-r--r--dev/ZKAKit/src/Storage/SCSIDeviceInterface.cc11
4 files changed, 162 insertions, 0 deletions
diff --git a/dev/ZKAKit/src/Storage/AHCIDeviceInterface.cc b/dev/ZKAKit/src/Storage/AHCIDeviceInterface.cc
new file mode 100644
index 00000000..a790236d
--- /dev/null
+++ b/dev/ZKAKit/src/Storage/AHCIDeviceInterface.cc
@@ -0,0 +1,35 @@
+/* -------------------------------------------
+
+ Copyright ZKA Web Services Co.
+
+------------------------------------------- */
+
+#include <StorageKit/AHCI.h>
+
+using namespace Kernel;
+
+/// @brief Class constructor
+/// @param Out Drive output
+/// @param In Drive input
+/// @param Cleanup Drive 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/ZKAKit/src/Storage/ATADeviceInterface.cc b/dev/ZKAKit/src/Storage/ATADeviceInterface.cc
new file mode 100644
index 00000000..2c027351
--- /dev/null
+++ b/dev/ZKAKit/src/Storage/ATADeviceInterface.cc
@@ -0,0 +1,88 @@
+/* -------------------------------------------
+
+ Copyright ZKA Web Services Co.
+
+------------------------------------------- */
+
+#include <StorageKit/ATA.h>
+
+using namespace Kernel;
+
+/// @brief Class constructor
+/// @param Out Drive output
+/// @param In Drive input
+/// @param Cleanup Drive 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 < kMaxDriveCountPerMountpoint; ++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 < kMaxDriveCountPerMountpoint; ++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/ZKAKit/src/Storage/NVMEDeviceInterface.cc b/dev/ZKAKit/src/Storage/NVMEDeviceInterface.cc
new file mode 100644
index 00000000..c2bd701f
--- /dev/null
+++ b/dev/ZKAKit/src/Storage/NVMEDeviceInterface.cc
@@ -0,0 +1,28 @@
+/* -------------------------------------------
+
+ Copyright ZKA Web Services Co.
+
+------------------------------------------- */
+
+#include <StorageKit/NVME.h>
+
+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/ZKAKit/src/Storage/SCSIDeviceInterface.cc b/dev/ZKAKit/src/Storage/SCSIDeviceInterface.cc
new file mode 100644
index 00000000..2cb397e7
--- /dev/null
+++ b/dev/ZKAKit/src/Storage/SCSIDeviceInterface.cc
@@ -0,0 +1,11 @@
+/* -------------------------------------------
+
+ Copyright ZKA Web Services Co.
+
+------------------------------------------- */
+
+#include <StorageKit/SCSI.h>
+
+///! @brief ATAPI SCSI packet.
+const scsi_packet_type<12> kCDRomPacketTemplate = {0x43, 0, 1, 0, 0, 0,
+ 0, 12, 0x40, 0, 0};