summaryrefslogtreecommitdiffhomepage
path: root/src/kernel/StorageKit/AHCI.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-11-23 21:06:27 -0500
committerGitHub <noreply@github.com>2025-11-23 21:06:27 -0500
commit23040fad647634c08697451fc22ee2ca999629c8 (patch)
tree72888f88c7728c82f3f6df1f4f70591de15eab36 /src/kernel/StorageKit/AHCI.h
parente5cc7351f0577b54c528fb827a7c7e6306c3e843 (diff)
parent83d870e58457a1d335a1d9b9966a6a1887cc297b (diff)
Merge pull request #81 from nekernel-org/dev
feat! breaking changes on kernel sources.
Diffstat (limited to 'src/kernel/StorageKit/AHCI.h')
-rw-r--r--src/kernel/StorageKit/AHCI.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/kernel/StorageKit/AHCI.h b/src/kernel/StorageKit/AHCI.h
new file mode 100644
index 00000000..82bd9747
--- /dev/null
+++ b/src/kernel/StorageKit/AHCI.h
@@ -0,0 +1,49 @@
+/* ========================================
+
+ Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.
+
+======================================== */
+
+#pragma once
+
+#include <KernelKit/DeviceMgr.h>
+#include <KernelKit/DriveMgr.h>
+#include <NeKit/OwnPtr.h>
+
+namespace Kernel {
+/// @brief AHCIDeviceInterface class
+/// @details This class is used to send and receive data from the AHCI device.
+/// @note The class is derived from the DeviceInterface class.
+class AHCIDeviceInterface NE_DEVICE<IMountpoint*> {
+ public:
+ explicit AHCIDeviceInterface(void (*out)(DeviceInterface* self, IMountpoint* out),
+ void (*in)(DeviceInterface* self, IMountpoint* in));
+
+ virtual ~AHCIDeviceInterface() override;
+
+ public:
+ AHCIDeviceInterface& operator=(const AHCIDeviceInterface&) = default;
+ AHCIDeviceInterface(const AHCIDeviceInterface&) = default;
+
+ const Char* Name() const override;
+
+ const UInt16& GetPortsImplemented();
+
+ Void SetPortsImplemented(const UInt16& pi);
+
+ const UInt32& GetIndex();
+
+ Void SetIndex(const UInt32& drv);
+
+ public:
+ AHCIDeviceInterface& operator<<(IMountpoint* Data) override;
+ AHCIDeviceInterface& operator>>(IMountpoint* Data) override;
+
+ private:
+ UInt16 fPortsImplemented{0U};
+ UInt32 fDriveIndex{0U};
+};
+
+UInt16 sk_init_ahci_device(BOOL atapi);
+ErrorOr<AHCIDeviceInterface> sk_acquire_ahci_device(UInt32 drv_index);
+} // namespace Kernel