diff options
Diffstat (limited to 'dev/boot/BootKit/HW')
| -rw-r--r-- | dev/boot/BootKit/HW/ATA.h | 63 | ||||
| -rw-r--r-- | dev/boot/BootKit/HW/SATA.h | 50 |
2 files changed, 50 insertions, 63 deletions
diff --git a/dev/boot/BootKit/HW/ATA.h b/dev/boot/BootKit/HW/ATA.h index cc5e1166..adb5c899 100644 --- a/dev/boot/BootKit/HW/ATA.h +++ b/dev/boot/BootKit/HW/ATA.h @@ -1,58 +1,47 @@ /* ------------------------------------------- - Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. + Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. ------------------------------------------- */ #pragma once -#include <modules/ATA/ATA.h> #include <BootKit/Device.h> +#include <modules/ATA/ATA.h> using namespace Kernel; -class BootDeviceATA final : public Device -{ -public: - enum - { - kPrimary = ATA_PRIMARY_IO, - kSecondary = ATA_SECONDARY_IO, - }; - - explicit BootDeviceATA() noexcept; - ~BootDeviceATA() = default; +class BootDeviceATA final : public Device { + public: + enum { + kPrimary = ATA_PRIMARY_IO, + kSecondary = ATA_SECONDARY_IO, + }; - NE_COPY_DELETE(BootDeviceATA) + explicit BootDeviceATA() noexcept; + ~BootDeviceATA() = default; - enum - { - kSectorSize = kATASectorSize - }; + enum { kSectorSize = kATASectorSize }; - struct ATATrait final : public Device::Trait - { - UInt16 mBus{kPrimary}; - UInt8 mMaster{0}; - Boolean mErr{false}; + struct ATATrait final : public Device::Trait { + UInt16 mBus{kPrimary}; + UInt8 mMaster{0}; + Boolean mErr{false}; - operator bool() - { - return !mErr; - } - }; + operator bool() { return !mErr; } + }; -public: - operator bool(); + public: + operator bool(); - SizeT GetSectorsCount() noexcept; - SizeT GetDiskSize() noexcept; + SizeT GetSectorsCount() noexcept; + SizeT GetDiskSize() noexcept; - BootDeviceATA& Read(Char* Buf, SizeT SecCount) override; - BootDeviceATA& Write(Char* Buf, SizeT SecCount) override; + BootDeviceATA& Read(Char* Buf, SizeT SecCount) override; + BootDeviceATA& Write(Char* Buf, SizeT SecCount) override; - ATATrait& Leak() override; + ATATrait& Leak() override; -private: - ATATrait mTrait; + private: + ATATrait mTrait; }; diff --git a/dev/boot/BootKit/HW/SATA.h b/dev/boot/BootKit/HW/SATA.h index 4073d959..8cf48ec7 100644 --- a/dev/boot/BootKit/HW/SATA.h +++ b/dev/boot/BootKit/HW/SATA.h @@ -1,46 +1,44 @@ /* ------------------------------------------- - Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. + Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. ------------------------------------------- */ #pragma once +#include <BootKit/BootKit.h> #include <CompilerKit/CompilerKit.h> #include <modules/AHCI/AHCI.h> -class BootDeviceSATA final -{ -public: - explicit BootDeviceSATA() noexcept; - ~BootDeviceSATA() = default; +class BootDeviceSATA final { + public: + explicit BootDeviceSATA() noexcept; + ~BootDeviceSATA() = default; - NE_COPY_DEFAULT(BootDeviceSATA) + NE_COPY_DEFAULT(BootDeviceSATA) - struct SATATrait final - { - Kernel::SizeT mBase{1024}; - Kernel::Boolean mErr{false}; - Kernel::Boolean mDetected{false}; + struct SATATrait final { + Kernel::SizeT mBase{1024}; + Kernel::Boolean mErr{false}; + Kernel::Boolean mDetected{false}; + Kernel::SizeT mSize{0}; - operator bool() - { - return !this->mErr; - } - }; + operator bool() { return !this->mErr; } + }; - operator bool() - { - return this->Leak().mDetected; - } + operator bool() { return this->Leak().mDetected; } - BootDeviceSATA& Read(Kernel::WideChar* Buf, const Kernel::SizeT SecCount); - BootDeviceSATA& Write(Kernel::WideChar* Buf, const Kernel::SizeT SecCount); + SizeT GetDiskSize() { return drv_std_get_size(); } - SATATrait& Leak(); + constexpr static auto kSectorSize = kAHCISectorSize; -private: - SATATrait mTrait; + BootDeviceSATA& Read(Boot::CharacterTypeUTF8* Buf, const Kernel::SizeT SecCount); + BootDeviceSATA& Write(Boot::CharacterTypeUTF8* Buf, const Kernel::SizeT SecCount); + + SATATrait& Leak(); + + private: + SATATrait mTrait; }; #define kAHCISectorSz 4096 |
