summaryrefslogtreecommitdiffhomepage
path: root/Private/NewBoot/BootKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-03 20:39:06 +0100
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-02-03 20:39:06 +0100
commitf99e383775fa43c5c1354067962b1590ff2abdae (patch)
treef83a9b232c0424963fc9989b517e53f903ee036f /Private/NewBoot/BootKit
parent0ca5d0d92ee326f3deda797403c27090bd0784ab (diff)
NewBoot: Will work on AHCI instead, ATA is not getting any further in
the future. Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/NewBoot/BootKit')
-rw-r--r--Private/NewBoot/BootKit/Arch/AHCI.hxx12
-rw-r--r--Private/NewBoot/BootKit/Arch/ATA.hxx11
-rw-r--r--Private/NewBoot/BootKit/BootKit.hxx22
3 files changed, 27 insertions, 18 deletions
diff --git a/Private/NewBoot/BootKit/Arch/AHCI.hxx b/Private/NewBoot/BootKit/Arch/AHCI.hxx
new file mode 100644
index 00000000..2e3739b5
--- /dev/null
+++ b/Private/NewBoot/BootKit/Arch/AHCI.hxx
@@ -0,0 +1,12 @@
+/*
+ * ========================================================
+ *
+ * NewBoot
+ * Copyright Mahrouss Logic, all rights reserved.
+ *
+ * ========================================================
+ */
+
+#pragma once
+
+#include <Drivers/AHCI/Defines.hxx>
diff --git a/Private/NewBoot/BootKit/Arch/ATA.hxx b/Private/NewBoot/BootKit/Arch/ATA.hxx
index 4042aaa9..4b4eb399 100644
--- a/Private/NewBoot/BootKit/Arch/ATA.hxx
+++ b/Private/NewBoot/BootKit/Arch/ATA.hxx
@@ -111,12 +111,6 @@ using namespace HCore;
#define ATA_ADDRESS3(x) (x + 5)
#define ATA_COMMAND(x) (x + 7)
-Boolean ATAInitDriver(UInt8 Bus, UInt8 Drv);
-Void ATAWait(UInt16 IO);
-Void ATAReadLba(UInt32 Lba, UInt8 Bus, Boolean Master, wchar_t* Buf,
- SizeT Offset);
-Void ATAWriteLba(UInt32 Lba, UInt8 Bus, Boolean Master, wchar_t* Buf,
- SizeT Offset);
Boolean ATAIsDetected(Void);
class BATADevice final {
@@ -134,7 +128,10 @@ class BATADevice final {
struct ATATraits final {
SizeT mBase{1024};
UInt16 mBus{kPrimary};
- Boolean mMaster{true};
+ UInt8 mMaster{0};
+ Boolean mErr{false};
+
+ operator bool() { return !mErr; }
};
operator bool() { return ATAIsDetected(); }
diff --git a/Private/NewBoot/BootKit/BootKit.hxx b/Private/NewBoot/BootKit/BootKit.hxx
index 6fdbacaf..d1584d8a 100644
--- a/Private/NewBoot/BootKit/BootKit.hxx
+++ b/Private/NewBoot/BootKit/BootKit.hxx
@@ -56,13 +56,13 @@ HCore::SizeT BSetMem(CharacterType *src, const CharacterType byte,
const HCore::SizeT len);
/**
- * @brief BootKit Image Reader class
- * Reads using the UEFI Simple File protocol.
+ * @brief BootKit File Reader class
+ * Reads using the New Filesystem Boot partition.
*/
-class BImageReader final {
+class BFileReader final {
public:
- explicit BImageReader(const CharacterType *path);
- ~BImageReader() = default;
+ explicit BFileReader(const CharacterType *path);
+ ~BFileReader() = default;
HCore::VoidPtr Fetch(SizeT &size);
@@ -78,8 +78,8 @@ class BImageReader final {
Int32 &Error() { return mErrorCode; }
public:
- BImageReader &operator=(const BImageReader &) = default;
- BImageReader(const BImageReader &) = default;
+ BFileReader &operator=(const BFileReader &) = default;
+ BFileReader(const BFileReader &) = default;
private:
Int32 mErrorCode{kOperationOkay};
@@ -115,21 +115,21 @@ inline void Out32(UInt16 port, UInt32 value) {
}
inline UInt8 In8(UInt16 port) {
- UInt8 value = 0UL;
+ UInt8 value;
asm volatile("inb %1, %%al" : "=a"(value) : "Nd"(port) : "memory");
return value;
}
inline UInt16 In16(UInt16 port) {
- UInt16 value = 0UL;
- asm volatile("in %%dx, %%ax" : "=a"(value) : "d"(port));
+ UInt16 value;
+ asm volatile("inw %%dx, %%ax" : "=a"(value) : "d"(port));
return value;
}
inline UInt32 In32(UInt16 port) {
- UInt32 value = 0UL;
+ UInt32 value;
asm volatile("inl %1, %%eax" : "=a"(value) : "Nd"(port) : "memory");
return value;