summaryrefslogtreecommitdiffhomepage
path: root/Private/NewBoot/BootKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-02 08:37:13 +0100
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-02 08:37:13 +0100
commit95a887d120b7955bb02f582339d0536696a4cc79 (patch)
tree1a240736a98566fce758b57108a1e623a378c89f /Private/NewBoot/BootKit
parent7ceadad6f8d24e98098a00531b24fa2c89fb76ad (diff)
Kernel & Bootloader: Improvements and Fix ATA Read and Write problem.
Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/NewBoot/BootKit')
-rw-r--r--Private/NewBoot/BootKit/Arch/ATA.hxx18
-rw-r--r--Private/NewBoot/BootKit/BootKit.hxx16
2 files changed, 25 insertions, 9 deletions
diff --git a/Private/NewBoot/BootKit/Arch/ATA.hxx b/Private/NewBoot/BootKit/Arch/ATA.hxx
index 6e692c3d..db92e290 100644
--- a/Private/NewBoot/BootKit/Arch/ATA.hxx
+++ b/Private/NewBoot/BootKit/Arch/ATA.hxx
@@ -113,8 +113,10 @@ using namespace HCore;
Boolean ATAInitDriver(UInt8 Bus, UInt8 Drv);
Void ATAWait(UInt16 IO);
-UInt16 ATAReadLba(UInt32 Lba, UInt8 Bus, Boolean Master);
-Void ATAWriteLba(UInt16 Byte, UInt32 Lba, UInt8 Bus, Boolean Master);
+Void ATAReadLba(UInt32 Lba, UInt8 Bus, Boolean Master, wchar_t* Buf,
+ SizeT Offset);
+Void ATAWriteLba(UInt16 Byte, UInt32 Lba, UInt8 Bus, Boolean Master,
+ wchar_t* Buf, SizeT Offset);
Boolean ATAIsDetected(Void);
class BATADevice final {
@@ -134,11 +136,21 @@ class BATADevice final {
Boolean mMaster{false};
};
+ operator bool() { return ATAIsDetected(); }
+
BATADevice& Read(WideChar*, const SizeT&);
BATADevice& Write(WideChar*, const SizeT&);
- ATATraits& Traits();
+ ATATraits& Leak();
private:
ATATraits mTraits;
};
+
+enum {
+ kATADevicePATA,
+ kATADeviceSATA,
+ kATADevicePATA_PI,
+ kATADeviceSATA_PI,
+ kATADeviceCount,
+};
diff --git a/Private/NewBoot/BootKit/BootKit.hxx b/Private/NewBoot/BootKit/BootKit.hxx
index edd8015b..2b57ec56 100644
--- a/Private/NewBoot/BootKit/BootKit.hxx
+++ b/Private/NewBoot/BootKit/BootKit.hxx
@@ -93,35 +93,39 @@ class BFileReader final {
#include <BootKit/Platform.hxx>
#include <BootKit/Protocol.hxx>
+/***********************************************************************************/
+/// Provide some useful processor features.
+/***********************************************************************************/
+
#ifdef __EFI_x86_64__
-inline void out8(UInt16 port, UInt8 value) {
+inline void Out8(UInt16 port, UInt8 value) {
asm volatile("outb %%al, %1" : : "a"(value), "Nd"(port) : "memory");
}
-inline void out16(UInt16 port, UInt16 value) {
+inline void Out16(UInt16 port, UInt16 value) {
asm volatile("outw %%ax, %1" : : "a"(value), "Nd"(port) : "memory");
}
-inline void out32(UInt16 port, UInt32 value) {
+inline void Out32(UInt16 port, UInt32 value) {
asm volatile("outl %%eax, %1" : : "a"(value), "Nd"(port) : "memory");
}
-inline UInt8 in8(UInt16 port) {
+inline UInt8 In8(UInt16 port) {
UInt8 value = 0UL;
asm volatile("inb %1, %%al" : "=a"(value) : "Nd"(port) : "memory");
return value;
}
-inline UInt16 in16(UInt16 port) {
+inline UInt16 In16(UInt16 port) {
UInt16 value = 0UL;
asm volatile("inw %1, %%ax" : "=a"(value) : "Nd"(port) : "memory");
return value;
}
-inline UInt32 in32(UInt16 port) {
+inline UInt32 In32(UInt16 port) {
UInt32 value = 0UL;
asm volatile("inl %1, %%eax" : "=a"(value) : "Nd"(port) : "memory");