From 5df4daf0619b95131ea99110ee2e8913012b6134 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 22 Mar 2024 09:47:28 +0100 Subject: HCR-14: ATA Built-in driver. Signed-off-by: Amlal El Mahrouss --- Private/NewBoot/Source/HEL/AMD64/BootATA.cxx | 9 ++++----- Private/NewBoot/Source/HEL/AMD64/BootMain.cxx | 3 --- 2 files changed, 4 insertions(+), 8 deletions(-) (limited to 'Private/NewBoot/Source') diff --git a/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx b/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx index e55b2121..72340d01 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootATA.cxx @@ -154,6 +154,8 @@ Void boot_ata_read(UInt32 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf, Out8(IO + ATA_REG_COMMAND, ATA_CMD_READ_PIO); + boot_ata_wait_io(IO); + BTextWriter writer; writer.Write(L"NewBoot: Port: ").Write(IO).Write(L"\r\n"); @@ -162,8 +164,6 @@ Void boot_ata_read(UInt32 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf, WideChar chr = In16(IO + ATA_REG_DATA); Buf[IndexOff] = chr; - - boot_ata_wait_io(IO); } } @@ -180,12 +180,11 @@ Void boot_ata_write(UInt32 Lba, UInt16 IO, UInt8 Master, CharacterTypeUTF8* Buf, Out8(IO + ATA_REG_COMMAND, ATA_CMD_WRITE_PIO); + boot_ata_wait_io(IO); + for (SizeT IndexOff = 0; IndexOff < Size; ++IndexOff) { - // Send it two Out16(IO + ATA_REG_DATA, Buf[IndexOff]); - Out16(IO + ATA_REG_DATA, '\0'); - boot_ata_wait_io(IO); } } diff --git a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx index b90d9d60..5bff5929 100644 --- a/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx +++ b/Private/NewBoot/Source/HEL/AMD64/BootMain.cxx @@ -38,9 +38,6 @@ EFI_EXTERN_C EFI_API Int EfiMain(EfiHandlePtr ImageHandle, .Write(SystemTable->FirmwareVendor) .Write(L"\r\n"); - /// Init ATA driver. - BDeviceATA ataDrv; - /// Read Kernel blob. BFileReader kernelImg(L".HCORE", ImageHandle); -- cgit v1.2.3