summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Private/Source/Storage/ATAWrapper.cxx64
-rw-r--r--Private/StorageKit/ATA.hpp84
-rw-r--r--Private/StorageKit/Storage.hpp2
3 files changed, 1 insertions, 149 deletions
diff --git a/Private/Source/Storage/ATAWrapper.cxx b/Private/Source/Storage/ATAWrapper.cxx
deleted file mode 100644
index 22996d12..00000000
--- a/Private/Source/Storage/ATAWrapper.cxx
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -------------------------------------------
-
- Copyright Mahrouss Logic
-
-------------------------------------------- */
-
-#include <ArchKit/ArchKit.hpp>
-#include <Builtins/ATA/Defines.hxx>
-#include <StorageKit/ATA.hpp>
-
-#define kBufferLen 512
-#define kSectorCount 512
-
-//! @brief ATA DMA Driver
-//! The idea is to let a driver do the transfer.
-/// @author Amlal EL Mahrouss
-/// BUGS: 0
-
-#define kATAError 2
-
-namespace HCore {
-Ref<PRDT*> kPrdt = nullptr;
-
-bool set_prdt_struct(Ref<PRDT*>& refCtrl) {
- if (!kPrdt) {
- kPrdt = refCtrl;
- kcout << "[set_prdt_struct] PRDT is set.";
-
- return true;
- }
-
- kcout << "[set_prdt_struct] [WARNING] Trying to change PRDT.\n";
- return false;
-}
-
-enum {
- k28BitRead = 0xC8,
- k48BitRead = 0x25,
- k28BitWrite = 0xCA,
- k48BitWrite = 0x35,
-};
-
-const char* ata_read_28(ULong lba) {
- if (!kPrdt) return nullptr;
-
- Char* packet = reinterpret_cast<Char*>(kPrdt.Leak()->PhysicalAddress());
-
- drv_ata_read(lba, ATA_PRIMARY_IO, ATA_MASTER, packet, kSectorCount,
- kBufferLen);
-
- return packet;
-}
-
-const char* ata_read_48(ULong lba) { return nullptr; }
-
-Int32 ata_write_48(ULong lba, char* buffer) { return kATAError; }
-
-Int32 ata_write_28(ULong lba, char* buffer) {
- drv_ata_write(lba, ATA_PRIMARY_IO, ATA_MASTER, buffer, kSectorCount,
- kBufferLen);
-
- return kATAError;
-}
-} // namespace HCore
diff --git a/Private/StorageKit/ATA.hpp b/Private/StorageKit/ATA.hpp
deleted file mode 100644
index 30c325d5..00000000
--- a/Private/StorageKit/ATA.hpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -------------------------------------------
-
- Copyright Mahrouss Logic
-
-------------------------------------------- */
-
-#pragma once
-
-#include <KernelKit/DebugOutput.hpp>
-#include <KernelKit/PCI/Dma.hpp>
-#include <KernelKit/PCI/IO.hpp>
-#include <NewKit/Defines.hpp>
-#include <StorageKit/PRDT.hpp>
-
-namespace HCore {
-enum class PATAType { kRead28, kRead48, kWrite28, kWrite48, kATAUnknown };
-
-const char *ata_read_28(ULong lba);
-const char *ata_read_48(ULong lba);
-
-Int32 ata_write_48(ULong lba, char *text = nullptr);
-Int32 ata_write_28(ULong lba, char *text = nullptr);
-
-class PATACommandFactory final {
- public:
- explicit PATACommandFactory() = default;
- ~PATACommandFactory() = default;
-
- PATACommandFactory &operator=(const PATACommandFactory &) = default;
- PATACommandFactory(const PATACommandFactory &) = default;
-
- public:
- static Ref<PATACommandFactory> Shared() {
- static Ref<PATACommandFactory> manager;
- return manager;
- }
-
- public:
- template <PATAType Command>
- ErrorOr<const char *> operator()(ULong lba,
- const char *text = nullptr) noexcept {
- switch (Command) {
- case PATAType::kRead28:
- return ErrorOr<const char *>(ata_read_28(lba));
- case PATAType::kRead48:
- return ErrorOr<const char *>(ata_read_48(lba));
- case PATAType::kWrite28: {
- if (text) {
- ata_write_28(lba, text);
- kcout << "ErrorOr<CT> ata_read<CT, Command>: Write ATA Command... "
- "(Write28)\n";
-
- return {};
- }
-
- kcout << "ErrorOr<CT> ata_read<CT, Command>: Bad ATA Command... "
- "(Write28)\n";
-
- return {};
- }
- case PATAType::kWrite48: {
- if (text) {
- ata_write_48(lba, text);
- kcout << "ErrorOr<CT> ata_read<CT, Command>: Write ATA Command... "
- "(Write48)\n";
-
- return {};
- }
-
- kcout << "ErrorOr<CT> ata_read<CT, Command>: Bad ATA Command... "
- "(Write48)\n";
-
- return {};
- }
- case PATAType::kATAUnknown: {
- kcout << "ErrorOr<CT> ata_read<CT, Command>: Unknown ATA Command...\n";
- return {};
- }
- }
-
- return ErrorOr<const char *>(nullptr);
- }
-};
-} // namespace HCore
diff --git a/Private/StorageKit/Storage.hpp b/Private/StorageKit/Storage.hpp
index 51b2fdd6..1fe74094 100644
--- a/Private/StorageKit/Storage.hpp
+++ b/Private/StorageKit/Storage.hpp
@@ -7,8 +7,8 @@
#pragma once
#include <NewKit/Defines.hpp>
-#include <StorageKit/ATA.hpp>
#include <StorageKit/NVME.hpp>
+#include <StorageKit/AHCI.hpp>
typedef HCore::UInt16 SKScsiPacket[12];