diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-03-14 22:26:42 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-03-14 22:26:42 +0100 |
| commit | 6bbf5ad2058db4020ae20d6aba8f5b099dadc85f (patch) | |
| tree | ad39f25f27938729261f733d2addf839e8a110b3 /dev/Kernel/HALKit/ARM64/Storage/MFlash+IO.cc | |
| parent | 1c4f8ae3804be72d947b0b96f90b9300515399bc (diff) | |
TQ-24 && TQ-16: Add build scripts for MBCI, MBCI+Flash, and UFS.
META: Along other tweaks and important ARM64 patches.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/HALKit/ARM64/Storage/MFlash+IO.cc')
| -rw-r--r-- | dev/Kernel/HALKit/ARM64/Storage/MFlash+IO.cc | 119 |
1 files changed, 0 insertions, 119 deletions
diff --git a/dev/Kernel/HALKit/ARM64/Storage/MFlash+IO.cc b/dev/Kernel/HALKit/ARM64/Storage/MFlash+IO.cc deleted file mode 100644 index 1335a9e4..00000000 --- a/dev/Kernel/HALKit/ARM64/Storage/MFlash+IO.cc +++ /dev/null @@ -1,119 +0,0 @@ -/* ------------------------------------------- - - Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved. - -------------------------------------------- */ - -#ifdef NE_USE_MBCI_FLASH - -#include <NewKit/Defines.h> -#include <ArchKit/ArchKit.h> -#include <Mod/MFlash/MFlash.h> -#include <Mod/MBCI/MBCI.h> - -/// @file MFlash.cc -/// @brief MBCI Flash support. - -#define kMaxFlashSlots (8U) - -namespace NeOS -{ - /// /Mount/Flash/n - constexpr auto kFlashBridgeMagic = 0x70768372; - constexpr auto kFlashBridgeRevision = 1; - - STATIC BOOL kFlashEnabled = NO; - STATIC SizeT kFlashSize[kMaxFlashSlots] = {}; - STATIC SizeT kFlashSectorSz[kMaxFlashSlots] = {}; - 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); - - /// @brief Disable flash memory builtin. - STATIC Void drv_disable_flash(Int32 slot); - - /// @brief get slot sector count. - /// @return slot sector count. - SizeT drv_get_sector_count(Int32 slot) - { - if (slot > kMaxFlashSlots) - return 0; - - return kFlashSectorSz[slot]; - } - - /// @brief get slot full size (in bytes). - /// @return drive slot size - SizeT drv_get_size(Int32 slot) - { - if (slot > kMaxFlashSlots) - return 0; - - return kFlashSize[slot]; - } - - /// @brief Enable flash memory at slot. - BOOL drv_enable_at(Int32 slot) - { - if (slot > kMaxFlashSlots) - return NO; - - kFlashMetaPackets[slot]->InterruptEnable = YES; - - kout << "Enabled hardware slot at: " << number(slot) << kendl; - - return YES; - } - - /// @brief Disable flash memory at slot. - BOOL drv_disable_at(Int32 slot) - { - if (slot > kMaxFlashSlots) - return NO; - - kFlashMetaPackets[slot]->InterruptEnable = NO; - - kout << "Disabled hardware slot at: " << number(slot) << kendl; - - 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 |
