diff options
| author | Amlal <amlal.elmahrouss@icloud.com> | 2025-02-24 18:06:23 +0100 |
|---|---|---|
| committer | Amlal <amlal.elmahrouss@icloud.com> | 2025-02-24 18:06:23 +0100 |
| commit | 462d618e9988b5172d544e177186bc89bfd303ac (patch) | |
| tree | 9d6e500a878c1d442421d4d2f92f6e1c0e30e421 | |
| parent | 5d9e1bb0c043ad183e635cbd8113224e13612866 (diff) | |
ADD: ARM64: MBCI 'FLSH' driver.
Signed-off-by: Amlal <amlal.elmahrouss@icloud.com>
| -rw-r--r-- | dev/Kernel/HALKit/AMD64/Storage/AHCI.cc | 4 | ||||
| -rw-r--r-- | dev/Kernel/HALKit/ARM64/HalApplicationProcessor.cc | 4 | ||||
| -rw-r--r-- | dev/Kernel/HALKit/ARM64/Storage/MFlash+IO.cc | 36 | ||||
| -rw-r--r-- | dev/Mod/MFlash/MFlash.h | 4 |
4 files changed, 42 insertions, 6 deletions
diff --git a/dev/Kernel/HALKit/AMD64/Storage/AHCI.cc b/dev/Kernel/HALKit/AMD64/Storage/AHCI.cc index cf5d1096..cb32cd56 100644 --- a/dev/Kernel/HALKit/AMD64/Storage/AHCI.cc +++ b/dev/Kernel/HALKit/AMD64/Storage/AHCI.cc @@ -1,6 +1,6 @@ /* ------------------------------------------- - Copyright (C) 2024-2025, DeVrije Corporation, all rights reserved. + Copyright (C) 2024-2025, DeVrije-Aker Corporation, all rights reserved. ------------------------------------------- */ @@ -11,7 +11,7 @@ * @version 0.1 * @date 2024-02-02 * - * @Copyright (C) 2024, DeVrije, all rights reserved. + * @Copyright (C) 2024, DeVrije-Aker, all rights reserved. * */ diff --git a/dev/Kernel/HALKit/ARM64/HalApplicationProcessor.cc b/dev/Kernel/HALKit/ARM64/HalApplicationProcessor.cc index 415ad5b1..12fb27ae 100644 --- a/dev/Kernel/HALKit/ARM64/HalApplicationProcessor.cc +++ b/dev/Kernel/HALKit/ARM64/HalApplicationProcessor.cc @@ -127,10 +127,8 @@ namespace NeOS {
Detail::kGICEnabled = YES;
Detail::mp_setup_gic_el0();
-
- return YES;
}
- return NO;
+ return Detail::kGICEnabled;
}
} // namespace NeOS
\ No newline at end of file diff --git a/dev/Kernel/HALKit/ARM64/Storage/MFlash+IO.cc b/dev/Kernel/HALKit/ARM64/Storage/MFlash+IO.cc index 18071fea..99200349 100644 --- a/dev/Kernel/HALKit/ARM64/Storage/MFlash+IO.cc +++ b/dev/Kernel/HALKit/ARM64/Storage/MFlash+IO.cc @@ -19,7 +19,7 @@ namespace NeOS { /// /Mount/Flash/n - constexpr auto kFlashBridgeMagic = "FLSH"; + constexpr auto kFlashBridgeMagic = 0x70768372; constexpr auto kFlashBridgeRevision = 1; STATIC BOOL kFlashEnabled = NO; @@ -28,6 +28,8 @@ namespace NeOS STATIC IMBCIHost* kFlashMetaPackets[kMaxFlashSlots] = {}; STATIC IMBCIHost* kFlashDataPackets[kMaxFlashSlots] = {}; + STATIC Void drv_std_io(Int32 slot, UInt64 lba, Char* buf, SizeT sector_sz, SizeT buf_sz); + /// @brief Enable flash memory builtin. STATIC Void drv_enable_flash(Int32 slot); @@ -79,6 +81,38 @@ namespace NeOS return YES; } + + STATIC Void drv_std_io(Int32 slot, UInt64 lba, Char* buf, SizeT sector_sz, SizeT buf_sz) + { + UInt64* packet_frame = (UInt64*)kFlashDataPackets[slot]->BaseAddressRegister; + + if (packet_frame[0] != (UInt64)kFlashBridgeMagic) + return; + + if (packet_frame[8] != (UInt64)kFlashBridgeRevision) + return; + + packet_frame[16+0] = lba; + packet_frame[16+4] = sector_sz; + packet_frame[16+8] = lba; + packet_frame[16+12] = buf_sz; + packet_frame[16+14] = (UIntPtr)HAL::hal_get_phys_address(buf); + + while (packet_frame[0] == lba); + } + + Void drv_std_read(Int32 slot, UInt64 lba, Char* buf, SizeT sector_sz, SizeT buf_sz) + { + rt_set_memory(buf, 0, buf_sz); + + drv_std_io(slot, lba, buf, sector_sz, buf_sz); + } + + Void drv_std_write(Int32 slot, UInt64 lba, Char* buf, SizeT sector_sz, SizeT buf_sz) + { + drv_std_io(slot, lba, buf, sector_sz, buf_sz); + } + } // namespace NeOS #endif // if NE_USE_MBCI_FLASH diff --git a/dev/Mod/MFlash/MFlash.h b/dev/Mod/MFlash/MFlash.h index 02a74666..a1846610 100644 --- a/dev/Mod/MFlash/MFlash.h +++ b/dev/Mod/MFlash/MFlash.h @@ -18,4 +18,8 @@ NeOS::Void drv_enable_at(NeOS::Int32 slot); NeOS::Void drv_disable_at(NeOS::Int32 slot); +NeOS::Void drv_std_write(NeOS::Int32 slot, NeOS::UInt64 lba, NeOS::Char* buf, NeOS::SizeT sector_sz, NeOS::SizeT buf_sz); + +NeOS::Void drv_std_read(NeOS::Int32 slot, NeOS::UInt64 lba, NeOS::Char* buf, NeOS::SizeT sector_sz, NeOS::SizeT buf_sz); + #endif // ifdef NE_USE_MBCI_FLASH |
