blob: 57040857988848f713d2b0e0cb843e59d034a9cd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
/* -------------------------------------------
Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.
------------------------------------------- */
#pragma once
#include <BootKit/BootKit.h>
#include <CompilerKit/CompilerKit.h>
#include <modules/AHCI/AHCI.h>
#define kAHCISectorSz (512)
class BootDeviceSATA final {
public:
explicit BootDeviceSATA() noexcept;
~BootDeviceSATA() = default;
NE_COPY_DEFAULT(BootDeviceSATA)
struct SATATrait final : public Device::Trait {
Kernel::Boolean mErr{false};
Kernel::Boolean mDetected{false};
operator bool() { return !this->mErr; }
};
operator bool() { return this->Leak().mDetected; }
SizeT GetDiskSize() { return drv_std_get_size(); }
constexpr static auto kSectorSize = kAHCISectorSize;
BootDeviceSATA& Read(Boot::CharacterTypeASCII* Buf, const Kernel::SizeT SecCount);
BootDeviceSATA& Write(Boot::CharacterTypeASCII* Buf, const Kernel::SizeT SecCount);
SATATrait& Leak();
private:
SATATrait mTrait;
};
|