From 65254486efff0fd1bb78a48ff90b7713a5ce539f Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 29 Jan 2024 18:17:47 +0100 Subject: Kernel: Update TODO. Src: Refactorings according to clang-format. Meta: Update specification. Public: Remove useless UIKit. Signed-off-by: Amlal El Mahrouss --- Private/Source/Storage/ATA.cxx | 114 +++++++++++++++++-------------------- Private/Source/Storage/NVME.cxx | 10 +--- Private/Source/Storage/Storage.cxx | 3 +- 3 files changed, 58 insertions(+), 69 deletions(-) (limited to 'Private/Source/Storage') 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 #include +#include //! @brief Driver for ATA, listens to a specific address for data to come. //! mapped by NewFirmware. #define kATAError 2 -namespace hCore -{ - Ref kPrdt = nullptr; +namespace hCore { +Ref kPrdt = nullptr; - bool set_prdt_struct(Ref& refCtrl) - { - if (!kPrdt) - { - kPrdt = refCtrl; - kcout << "[set_prdt_struct] PRDT is set."; +bool set_prdt_struct(Ref& 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 -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 -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}; -- cgit v1.2.3