/*
* Copyright (c) 2008-2009 Apple Inc. All rights reserved.
*
* This document is the property of Apple Inc.
* It is considered confidential and proprietary.
*
* This document may not be reproduced or transmitted in any form,
* in whole or in part, without the express written permission of
* Apple Inc.
*/
#define TIME_TREE 0
#define AND_TRACE_LAYER FTL
#include "yaFTL_whoami.h"
#include "WMRConfig.h"
#include "ANDTypes.h"
#include "WMROAM.h"
#include "WMRBuf.h"
#include "VFLBuffer.h"
#include "VFL.h"
#include "yaFTLTypes.h"
#include "FTL.h"
#include "yaFTL_Defines.h"
#include "yaFTL_gc.h"
#include "yaFTL_BTOC.h"
#include "L2V/L2V_Extern.h"
#if TIME_TREE
#include <kern/clock.h>
#endif
#include "WMRFeatures.h"
#ifndef ENABLE_L2V_TREE
#error ENABLE_L2V_TREE must be set to 0 or 1 in WMRFeatures.h
#endif
#define kYaftlMinorVersion (1)
#if !NAND_RAW && !NAND_PPN
#error PPN or raw?
#endif
#ifdef AND_COLLECT_STATISTICS
FTLStatistics stFTLStatistics;
#endif /* AND_COLLECT_STATISTICS */
#define CXT_VER "CX01"
FTLWMRDeviceInfo yaFTL_FTLDeviceInfo;
VFLFunctions yaFTL_VFLFunctions;
yaFTL_t yaFTL;
static BOOL32 yaftl_init_done = FALSE32;
/* static functions declaration section */
static void YAFTL_FreeMemory(void);
static Int32 YAFTL_Init(VFLFunctions *pVFLFunctions);
static Int32 YAFTL_Open(UInt32 *pTotalScts,
UInt32 * pdwSectorSize,
BOOL32 nandFullRestore,
BOOL32 justFormatted,
UInt32 dwMinorVer,
UInt32 dwOptions);
static Int32 YAFTL_Read(UInt32 nLpn, UInt32 nNumOfScts,
UInt8 *pBuf);
static void YAFTL_Close(void);
static BOOL32 YAFTL_GetStruct(UInt32 dwStructType,
void * pvoidStructBuffer,
UInt32 * pdwStructSize);
Int32 _readPage(UInt32 vpn, UInt8 *pageData,
PageMeta_t *pMeta,
BOOL32 bInternalOp, BOOL32 boolCleanCheck, BOOL32 scrubOnUECC);
BOOL32 _readMultiPages(UInt32 * padwVpn,
UInt16 wNumPagesToRead, UInt8 * pbaData,
UInt8 * pbaSpare,
BOOL32 bInternalOp, BOOL32 scrubOnUECC);
#if ENABLE_L2V_TREE
static void PopulateFromIndexCache(UInt32 indexPageNo, UInt32 *indexPageData);
#endif //ENABLE_L2V_TREE
static void PopulateTreesOnBoot_Fast(void);
#ifndef AND_READONLY
static Int32 YAFTL_Write(UInt32 nLpn, UInt32 nNumOfScts,
UInt8 *pBuf, BOOL32 isStatic);
static Int32 YAFTL_Format(UInt32 dwOptions);
static Int32 YAFTL_WearLevel(void);
static BOOL32 YAFTL_GarbageCollect(void);
static BOOL32 YAFTL_ShutdownNotify(BOOL32 boolMergeLogs);
Int32 _writePage(UInt32 vpn, UInt8 *pageData,
PageMeta_t *,
BOOL32 bInternalOp);
static ANDStatus writeIndexPage(UInt8 *pageBuffer, PageMeta_t *mdPtr,
UInt8 flag);
UInt32 _allocateBlock(UInt32 blockNo, UInt8 flag, UInt8 type);
BOOL32 _writeMultiPages(UInt16 vbn, UInt16 pageOffset,
UInt16 wNumPagesToWrite, UInt8 *pageData,
PageMeta_t *mdPtr,
BOOL32 bInternalOp);
UInt32* IndexLoadDirty(UInt32 lba, UInt32 *indexOfs);
UInt32* IndexLoadClean(UInt32 lba, UInt32 *indexOfs, UInt32 *d_tocEntry);
void IndexMarkDirty(UInt32 tocEntry);
ANDStatus invalidateCXT(void);
BOOL32 isBlockInEraseNowList(UInt16 blockNo);
BOOL32 removeBlockFromEraseNowList(UInt16 blockNo);
BOOL32 addBlockToEraseNowList(UInt16 blockNo);
#endif // ! AND_READONLY
/*
static variables/structures declaration section
*/
typedef struct blockList
{
WeaveSeq_t weaveSeq;
UInt16 blockNo;
struct blockList *next;
struct blockList *prev;
} BlockListType;
typedef struct BlockRange
{
UInt32 start;
UInt32 end;
} BlockRangeType;
#if NAND_PPN
typedef struct YAFTLControlInfo
{
UInt32 versionNo;
UInt32 indexSize; /* index size in blocks */
UInt32 logicalPartitionSize; /* partititon size in pages exposed to file system */
UInt32 wrState_data_block; /* current physical block being used for updates */
UInt32 wrState_data_weaveSeq_Lo;
UInt32 wrState_data_weaveSeq_Hi;
UInt32 wrState_index_block; /* current physical block being used for updates */
UInt32 wrState_index_weaveSeq_Lo;
UInt32 wrState_index_weaveSeq_Hi;
UInt32 seaState_data_freeBlocks; /* number of free ( erased ) blocks */
UInt32 seaState_index_freeBlocks; /* number of free ( erased ) blocks */
UInt32 seaState_data_allocdBlocks;
UInt32 seaState_index_allocdBlocks;
UInt32 indexCacheSize;
UInt32 FTLRestoreCnt;
UInt32 reserved32[10];
UInt16 TOCtableEntriesNo; /* number of entries in index TOC table */
UInt16 controlPageNo;
UInt16 indexPageRatio; /* TOC of each block contains Lpa for each page written to block */
UInt16 freeCachePages;
UInt16 nextFreeCachePage;
UInt16 wrState_data_nextPage; /* offset in current block of next free page */
UInt16 wrState_index_nextPage; /* offset in current block of next free page */
UInt32 reserved16[10];
UInt8 exportedRatio;
UInt8 cxtEraseCounter;
UInt8 reserved8[10];
} YAFTLControlInfoType;
#elif NAND_RAW
typedef struct YAFTLControlInfo
{
UInt32 versionNo;
UInt32 indexSize; /* index size in blocks */
UInt32 logicalPartitionSize; /* partititon size in pages exposed to file system */
UInt32 wrState_data_block; /* current physical block being used for updates */
UInt32 wrState_data_weaveSeq;
UInt32 wrState_index_block; /* current physical block being used for updates */
UInt32 wrState_index_weaveSeq;
UInt32 seaState_data_freeBlocks; /* number of free ( erased ) blocks */
UInt32 seaState_index_freeBlocks; /* number of free ( erased ) blocks */
UInt32 seaState_data_allocdBlocks;
UInt32 seaState_index_allocdBlocks;
UInt32 indexCacheSize;
UInt32 FTLRestoreCnt;
UInt32 reserved32[10];
UInt16 TOCtableEntriesNo; /* number of entries in index TOC table */
UInt16 controlPageNo;
UInt16 indexPageRatio; /* TOC of each block contains Lpa for each page written to block */
UInt16 freeCachePages;
UInt16 nextFreeCachePage;
UInt16 wrState_data_nextPage; /* offset in current block of next free page */
UInt16 wrState_index_nextPage; /* offset in current block of next free page */
UInt32 reserved16[10];
UInt8 exportedRatio;
UInt8 cxtEraseCounter;
UInt8 reserved8[10];
} YAFTLControlInfoType;
#else
#error PPN or raw?
#endif
static BOOL32 _allocateRestoreIndexBuffers(BlockRangeType **blockRangeBuffer, UInt32 **indexTable, UInt32 *indexTableSize);
#ifdef AND_COLLECT_STATISTICS
#ifndef AND_READONLY
static BOOL32 _FTLGetStatisticsToCxt(UInt8 * pabData);
#endif //ifndef AND_READONLY
static BOOL32 _FTLSetStatisticsFromCxt(UInt8 * pabData);
#endif
#ifndef AND_READONLY
static BOOL32 YAFTL_WriteStats(void);
#define CXT_ERASE_GAP 50
#define MOVE_CXT_TRESHOLD 1000
#define ERASE_CXT_UPDATE_THRESHOLD (FTL_AREA_SIZE>>4)
#define WRITE_CXT_UPDATE_THRESHOLD (USER_PAGES_TOTAL>>4)
#endif
static UInt32 tempIndexBufferSize = 0;
/*****************************************************************************/
/* Code Implementation */
/*****************************************************************************/
void freeBlockList(BlockListType * listHead)
{
BlockListType * tmpPtr = listHead;
while(tmpPtr != NULL)
{
listHea
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
iBoot source code (2612个子文件)
format-headerfile.awk 1KB
mib_gen_def.awk 1KB
mib_gen_hdr.awk 1KB
formatter.awk 938B
lister.awk 423B
mib.base 2KB
rom_test.bin 28B
rom_test.bin 24B
yaFTL.c 228KB
yaFTL.c 227KB
dcs_calibration_v2.c 207KB
dcs_calibration.c 203KB
PPNVFLInterface.c 171KB
FTLInterface.c 171KB
VSVFLInterface.c 156KB
s_vfl.c 152KB
debug.c 135KB
amp_v3_calibration.c 128KB
pmgr.c 126KB
nand_part_core.c 125KB
amp_v2.c 114KB
H2fmi.c 97KB
pmgr.c 92KB
H2fmi_ppn.c 91KB
VFLInterface.c 90KB
pinconfig.c 89KB
pinconfig_proto2.c 87KB
process_edid.c 80KB
process_edid.c 80KB
FPart.c 77KB
hdmi_static_config.c 75KB
pmgr.c 72KB
pinconfig-mesa.c 66KB
nvme.c 63KB
displayport.c 62KB
pmgr.c 62KB
PPNFPart.c 57KB
power.c 56KB
effaceable_storage_core.c 56KB
apcie_v2.c 55KB
pmgr.c 55KB
yaFTL_gc.c 55KB
yaFTL_gc.c 55KB
displayport.c 54KB
hdmi.c 54KB
pinconfig.c 52KB
H2fmi_read.c 51KB
init.c 51KB
pinconfig_evt2.c 51KB
pinconfig_proto3.c 51KB
pinconfig_proto2.c 51KB
pinconfig_evt.c 50KB
init.c 49KB
nand_nvram_core.c 49KB
fmiss_ppn.c 49KB
debug.c 48KB
pinconfig.c 47KB
hdqgauge.c 47KB
pmgr.c 47KB
pmgr.c 46KB
power.c 46KB
paint.c 46KB
pmgr.c 46KB
synopsys_otg.c 45KB
init.c 45KB
pinconfig.c 43KB
image4_wrapper.c 42KB
pci.c 42KB
charger.c 40KB
dcs_init_lib_s8001.c 39KB
image3_wrapper.c 39KB
usb_core.c 39KB
hfs.c 39KB
pinconfig.c 39KB
H2fmi_write.c 39KB
pmgr.c 39KB
Image3.c 38KB
init.c 38KB
init.c 37KB
dcs_init_lib_s8003.c 36KB
WMRExam.c 36KB
L2V_Update.c 35KB
pinconfig.c 35KB
main.c 34KB
L2V_Update.c 34KB
L2V_Update.c 34KB
init_product.c 34KB
dcs_init_lib_s8000.c 34KB
dcs_init_lib_t8002.c 34KB
pinconfig.c 34KB
common_util.c 34KB
H2fmi_iop.c 34KB
pinconfig.c 33KB
pmgr.c 33KB
WhimoryBoot.c 33KB
FILTest.c 33KB
dcs_init_lib_t8010.c 32KB
init.c 32KB
H2fmi_bootrom.c 32KB
H2fmi_ppn_fil.c 32KB
共 2612 条
- 1
- 2
- 3
- 4
- 5
- 6
- 27
资源评论
- ijunjay2018-02-16是真代码,不过好像缺少了不少文件
ziziji0909
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功