summaryrefslogtreecommitdiffhomepage
path: root/dev/boot/src/HEL/AMD64
diff options
context:
space:
mode:
authorAmlal <amlal@nekernel.org>2025-04-27 17:30:36 +0200
committerAmlal <amlal@nekernel.org>2025-04-27 17:30:36 +0200
commitcb2f383f45dda8d1cdcef0b87fe4c70243659701 (patch)
treef109c3c44fa3f142d34f8ca61cfa69672e556614 /dev/boot/src/HEL/AMD64
parent14d5ee9e0cfededddfceec73d5dfa8a2fcda6c5d (diff)
dev, kernel: AHCI, HeFS filesystem, SysChk, and BootSATA improvements.
what? - AHCI now writes to disk, forgot to do it. - Codebase's architecutre has been used to reuse the Generic+AHCI driver in SysChk for AHCI. (tradeoff is 256K in size instead of 36K) - DriveMgr now detects EPM. - And HeFS is still being worked on. Signed-off-by: Amlal <amlal@nekernel.org>
Diffstat (limited to 'dev/boot/src/HEL/AMD64')
-rw-r--r--dev/boot/src/HEL/AMD64/BootATA.cc4
-rw-r--r--dev/boot/src/HEL/AMD64/BootPlatform.cc10
-rw-r--r--dev/boot/src/HEL/AMD64/BootSATA.cc62
3 files changed, 65 insertions, 11 deletions
diff --git a/dev/boot/src/HEL/AMD64/BootATA.cc b/dev/boot/src/HEL/AMD64/BootATA.cc
index 693513e0..7557f941 100644
--- a/dev/boot/src/HEL/AMD64/BootATA.cc
+++ b/dev/boot/src/HEL/AMD64/BootATA.cc
@@ -19,12 +19,12 @@
#include <BootKit/HW/ATA.h>
#include <FirmwareKit/EFI.h>
+#define kATADataLen (256)
+
/// bugs: 0
using namespace Boot;
-#define kATADataLen (256)
-
static Boolean kATADetected = false;
static UInt16 kATAData[kATADataLen] = {0};
diff --git a/dev/boot/src/HEL/AMD64/BootPlatform.cc b/dev/boot/src/HEL/AMD64/BootPlatform.cc
index 8b4d57c4..4cc783d6 100644
--- a/dev/boot/src/HEL/AMD64/BootPlatform.cc
+++ b/dev/boot/src/HEL/AMD64/BootPlatform.cc
@@ -13,7 +13,7 @@
using namespace Boot;
-EXTERN_C void rt_hlt() {
+EXTERN_C void rt_halt() {
asm volatile("hlt");
}
@@ -33,12 +33,4 @@ EXTERN_C void rt_std() {
asm volatile("std");
}
-#else
-
-#include <HALKit/AMD64/Processor.h>
-
-void rt_hlt() {
- Kernel::HAL::rt_halt();
-}
-
#endif // __BOOTZ_STANDALONE__
diff --git a/dev/boot/src/HEL/AMD64/BootSATA.cc b/dev/boot/src/HEL/AMD64/BootSATA.cc
index ef5d2096..783acb4c 100644
--- a/dev/boot/src/HEL/AMD64/BootSATA.cc
+++ b/dev/boot/src/HEL/AMD64/BootSATA.cc
@@ -18,3 +18,65 @@
#include <BootKit/HW/SATA.h>
#include <BootKit/Platform.h>
#include <BootKit/Protocol.h>
+
+#include <BootKit/BootKit.h>
+#include <FirmwareKit/EFI.h>
+
+#if defined(__AHCI__) && defined(__SYSCHK__)
+
+using namespace Boot;
+
+/***
+ *
+ *
+ * @brief SATA Device class.
+ *
+ *
+ */
+
+/**
+ * @brief ATA Device constructor.
+ * @param void none.
+ */
+BootDeviceSATA::BootDeviceSATA() noexcept {
+ UInt16 pi = 0u;
+ drv_std_init(pi);
+}
+
+/**
+ @brief Read Buf from disk
+ @param Sz Sector size
+ @param Buf buffer
+*/
+BootDeviceSATA& BootDeviceSATA::Read(CharacterTypeUTF8* Buf, SizeT SectorSz) {
+ NE_UNUSED(Buf);
+ NE_UNUSED(SectorSz);
+
+ drv_std_read(mTrait.mBase, Buf, SectorSz, mTrait.mSize);
+
+ return *this;
+}
+
+/**
+ @brief Write Buf into disk
+ @param Sz Sector size
+ @param Buf buffer
+*/
+BootDeviceSATA& BootDeviceSATA::Write(CharacterTypeUTF8* Buf, SizeT SectorSz) {
+ NE_UNUSED(Buf);
+ NE_UNUSED(SectorSz);
+
+ drv_std_write(mTrait.mBase, Buf, SectorSz, mTrait.mSize);
+
+ return *this;
+}
+
+/**
+ * @brief ATA trait getter.
+ * @return BootDeviceSATA::ATATrait& the drive config.
+ */
+BootDeviceSATA::SATATrait& BootDeviceSATA::Leak() {
+ return mTrait;
+}
+
+#endif \ No newline at end of file