summaryrefslogtreecommitdiffhomepage
path: root/Private/Source/Storage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-29 18:17:47 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-29 18:18:59 +0100
commit65254486efff0fd1bb78a48ff90b7713a5ce539f (patch)
tree20ce02c12a74ba9e6cd382bf9c1f09a0c611cb4d /Private/Source/Storage
parentf03986937db0b927da4b10554801e18e4dc7c43f (diff)
Kernel: Update TODO.
Src: Refactorings according to clang-format. Meta: Update specification. Public: Remove useless UIKit. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/Source/Storage')
-rw-r--r--Private/Source/Storage/ATA.cxx114
-rw-r--r--Private/Source/Storage/NVME.cxx10
-rw-r--r--Private/Source/Storage/Storage.cxx3
3 files changed, 58 insertions, 69 deletions
diff --git a/Private/Source/Storage/ATA.cxx b/Private/Source/Storage/ATA.cxx
index 08fa43b3..f960907b 100644
--- a/Private/Source/Storage/ATA.cxx
+++ b/Private/Source/Storage/ATA.cxx
@@ -7,93 +7,85 @@
* ========================================================
*/
-#include <StorageKit/ATA.hpp>
#include <ArchKit/Arch.hpp>
+#include <StorageKit/ATA.hpp>
//! @brief Driver for ATA, listens to a specific address for data to come.
//! mapped by NewFirmware.
#define kATAError 2
-namespace hCore
-{
- Ref<PRDT*> kPrdt = nullptr;
+namespace hCore {
+Ref<PRDT*> kPrdt = nullptr;
- bool set_prdt_struct(Ref<PRDT*>& refCtrl)
- {
- if (!kPrdt)
- {
- kPrdt = refCtrl;
- kcout << "[set_prdt_struct] PRDT is set.";
+bool set_prdt_struct(Ref<PRDT*>& refCtrl) {
+ if (!kPrdt) {
+ kPrdt = refCtrl;
+ kcout << "[set_prdt_struct] PRDT is set.";
- return true;
- }
+ return true;
+ }
- kcout << "[set_prdt_struct] [WARNING] Tried to change PRDT.\n";
- return false;
- }
+ kcout << "[set_prdt_struct] [WARNING] Tried to change PRDT.\n";
+ return false;
+}
- enum
- {
- k28BitRead = 0xC8,
- k48BitRead = 0x25,
- k28BitWrite = 0xCA,
- k48BitWrite = 0x35,
- };
+enum {
+ k28BitRead = 0xC8,
+ k48BitRead = 0x25,
+ k28BitWrite = 0xCA,
+ k48BitWrite = 0x35,
+};
- const char* ata_read_28(ULong lba)
- {
- static char buffer[512];
+const char* ata_read_28(ULong lba) {
+ static char buffer[512];
- UIntPtr* packet = (UIntPtr*)kPrdt.Leak()->PhysicalAddress();
+ UIntPtr* packet = (UIntPtr*)kPrdt.Leak()->PhysicalAddress();
- packet[0] = k28BitRead;
- packet[1] = (UIntPtr)&buffer;
- packet[2] = lba;
+ packet[0] = k28BitRead;
+ packet[1] = (UIntPtr)&buffer;
+ packet[2] = lba;
- rt_wait_for_io();
+ rt_wait_for_io();
- return buffer;
- }
+ return buffer;
+}
- const char* ata_read_48(ULong lba)
- {
- static char buffer[512];
+const char* ata_read_48(ULong lba) {
+ static char buffer[512];
- UIntPtr* packet = (UIntPtr*)kPrdt.Leak()->PhysicalAddress();
+ UIntPtr* packet = (UIntPtr*)kPrdt.Leak()->PhysicalAddress();
- packet[0] = k48BitRead;
- packet[1] = (UIntPtr)&buffer;
- packet[4] = lba;
+ packet[0] = k48BitRead;
+ packet[1] = (UIntPtr)&buffer;
+ packet[4] = lba;
- rt_wait_for_io();
+ rt_wait_for_io();
- return buffer;
- }
+ return buffer;
+}
- Int32 ata_write_48(ULong lba, const char *text)
- {
- UIntPtr* packet = (UIntPtr*)kPrdt.Leak()->PhysicalAddress();
+Int32 ata_write_48(ULong lba, const char* text) {
+ UIntPtr* packet = (UIntPtr*)kPrdt.Leak()->PhysicalAddress();
- packet[0] = k48BitWrite;
- packet[1] = (UIntPtr)&text;
- packet[2] = lba;
+ packet[0] = k48BitWrite;
+ packet[1] = (UIntPtr)&text;
+ packet[2] = lba;
- rt_wait_for_io();
+ rt_wait_for_io();
- return packet[1] == 2 ? kATAError : 0;
- }
+ return packet[1] == 2 ? kATAError : 0;
+}
- Int32 ata_write_28(ULong lba, const char *text)
- {
- UIntPtr* packet = (UIntPtr*)kPrdt.Leak()->PhysicalAddress();
+Int32 ata_write_28(ULong lba, const char* text) {
+ UIntPtr* packet = (UIntPtr*)kPrdt.Leak()->PhysicalAddress();
- packet[0] = k28BitWrite;
- packet[1] = (UIntPtr)&text;
- packet[2] = lba;
+ packet[0] = k28BitWrite;
+ packet[1] = (UIntPtr)&text;
+ packet[2] = lba;
- rt_wait_for_io();
+ rt_wait_for_io();
- return packet[1] == 2 ? kATAError : 0;
- }
-} // namespace hCore
+ return packet[1] == 2 ? kATAError : 0;
+}
+} // namespace hCore
diff --git a/Private/Source/Storage/NVME.cxx b/Private/Source/Storage/NVME.cxx
index aa1d8ecc..9501b8fa 100644
--- a/Private/Source/Storage/NVME.cxx
+++ b/Private/Source/Storage/NVME.cxx
@@ -9,10 +9,6 @@
#include <StorageKit/NVME.hpp>
-namespace hCore
-{
- const char *NVMEDevice::Name() const
- {
- return ("NVMEDevice");
- }
-} // namespace hCore
+namespace hCore {
+const char *NVMEDevice::Name() const { return ("NVMEDevice"); }
+} // namespace hCore
diff --git a/Private/Source/Storage/Storage.cxx b/Private/Source/Storage/Storage.cxx
index 6384479a..2340763a 100644
--- a/Private/Source/Storage/Storage.cxx
+++ b/Private/Source/Storage/Storage.cxx
@@ -9,4 +9,5 @@
#include <StorageKit/Storage.hpp>
-const OSScsiPacket kCDRomPacketTemplate = { 0x43, 0, 1, 0, 0, 0, 0, 12, 0x40, 0, 0 };
+const OSScsiPacket kCDRomPacketTemplate = {0x43, 0, 1, 0, 0, 0,
+ 0, 12, 0x40, 0, 0};