summaryrefslogtreecommitdiffhomepage
path: root/dev/ZBA/Sources
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-08-22 23:03:29 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-08-22 23:04:42 +0200
commit8c9091c24fe976d358ae0209bc1a48e15b277d76 (patch)
treee19ac39ac70bb9cf5525fd3fb2d9f1b168e22568 /dev/ZBA/Sources
parent10099e99847307fae60aebdf2292002d359d45b4 (diff)
[FIX] NewFS and builtin PIO support have been fixed.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/ZBA/Sources')
-rw-r--r--dev/ZBA/Sources/HEL/AMD64/BootATA.cxx16
-rw-r--r--dev/ZBA/Sources/HEL/AMD64/BootMain.cxx3
-rw-r--r--dev/ZBA/Sources/HEL/AMD64/New+Delete.cxx4
3 files changed, 10 insertions, 13 deletions
diff --git a/dev/ZBA/Sources/HEL/AMD64/BootATA.cxx b/dev/ZBA/Sources/HEL/AMD64/BootATA.cxx
index 4beed241..0c2e557d 100644
--- a/dev/ZBA/Sources/HEL/AMD64/BootATA.cxx
+++ b/dev/ZBA/Sources/HEL/AMD64/BootATA.cxx
@@ -111,6 +111,8 @@ ATAInit_Retry:
Void boot_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf, SizeT SectorSz, SizeT Size)
{
+ Lba /= SectorSz;
+
UInt8 Command = ((!Master) ? 0xE0 : 0xF0);
boot_ata_wait_io(IO);
@@ -120,7 +122,7 @@ Void boot_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf,
Out8(IO + ATA_REG_SEC_COUNT0, 2);
- Out8(IO + ATA_REG_LBA0, (Lba));
+ Out8(IO + ATA_REG_LBA0, (Lba) & 0xFF);
Out8(IO + ATA_REG_LBA1, (Lba) >> 8);
Out8(IO + ATA_REG_LBA2, (Lba) >> 16);
Out8(IO + ATA_REG_LBA3, (Lba) >> 24);
@@ -139,6 +141,8 @@ Void boot_ata_read(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf,
Void boot_ata_write(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf, SizeT SectorSz, SizeT Size)
{
+ Lba /= SectorSz;
+
UInt8 Command = ((!Master) ? 0xE0 : 0xF0);
boot_ata_wait_io(IO);
@@ -148,7 +152,7 @@ Void boot_ata_write(UInt64 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf,
Out8(IO + ATA_REG_SEC_COUNT0, 2);
- Out8(IO + ATA_REG_LBA0, (Lba));
+ Out8(IO + ATA_REG_LBA0, (Lba) & 0xFF);
Out8(IO + ATA_REG_LBA1, (Lba) >> 8);
Out8(IO + ATA_REG_LBA2, (Lba) >> 16);
Out8(IO + ATA_REG_LBA3, (Lba) >> 24);
@@ -219,9 +223,7 @@ BootDeviceATA& BootDeviceATA::Read(CharacterTypeUTF8* Buf, const SizeT& SectorSz
if (!Buf || SectorSz < 1)
return *this;
- auto lba = this->Leak().mBase / SectorSz;
-
- boot_ata_read(lba, this->Leak().mBus, this->Leak().mMaster,
+ boot_ata_read(this->Leak().mBase, this->Leak().mBus, this->Leak().mMaster,
Buf, SectorSz, this->Leak().mSize);
return *this;
@@ -245,9 +247,7 @@ BootDeviceATA& BootDeviceATA::Write(CharacterTypeUTF8* Buf, const SizeT& SectorS
if (!Buf || SectorSz < 1)
return *this;
- auto lba = this->Leak().mBase / SectorSz;
-
- boot_ata_write(lba, this->Leak().mBus, this->Leak().mMaster,
+ boot_ata_write(this->Leak().mBase, this->Leak().mBus, this->Leak().mMaster,
Buf, SectorSz, this->Leak().mSize);
return *this;
diff --git a/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx b/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx
index f6438be8..1011ce10 100644
--- a/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx
+++ b/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx
@@ -216,9 +216,6 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle,
checkPart.Format("ZKA (A:)", &root, 1);
- cg_write_text("INSATLLED PARTITION WITH SUCCESS.", 40, 10, RGB(0xFF, 0xFF, 0xFF));
-
- rt_reset_hardware();
EFI::Stop();
}
diff --git a/dev/ZBA/Sources/HEL/AMD64/New+Delete.cxx b/dev/ZBA/Sources/HEL/AMD64/New+Delete.cxx
index 8b9a41fa..4a308f94 100644
--- a/dev/ZBA/Sources/HEL/AMD64/New+Delete.cxx
+++ b/dev/ZBA/Sources/HEL/AMD64/New+Delete.cxx
@@ -19,7 +19,7 @@ EXTERN EfiBootServices* BS;
void* operator new(size_t sz)
{
void* buf = nullptr;
-
+
while (BS->AllocatePool(EfiMemoryType::EfiLoaderData, sz, &buf) == kBufferTooSmall)
BS->FreePool(buf);
@@ -59,4 +59,4 @@ void operator delete(void* buf, size_t size)
BS->FreePool(buf);
}
-#endif // Inactive
+#endif // __STANDALONE__