first and last commit
This commit is contained in:
commit
1bf4efd552
2612 files changed
+636500
No files matched your search
@@ -0,0 +1,541 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef _AND_TYPES_H_
|
||||
#define _AND_TYPES_H_
|
||||
|
||||
#include "WMRTypes.h"
|
||||
|
||||
typedef Int32 ANDStatus;
|
||||
|
||||
#define ANDErrorCodeOk (Int32)0
|
||||
#define ANDErrorCodeCleanOk (Int32)1
|
||||
#define ANDErrorCodeHwErr (Int32)0x80000001
|
||||
#define ANDErrorCodeUserDataErr (Int32)0x80000002
|
||||
#define ANDErrorCodeOutOfRangeErr (Int32)0x80000003
|
||||
#define ANDErrorCodeAlignmentErr (Int32)0x80000004
|
||||
#define ANDErrorWriteFailureErr (Int32)0x80000005
|
||||
#define ANDErrorCodeAllocFailErr (Int32)0x80000006
|
||||
#define ANDErrorCodeNotSupportedErr (Int32)0x80000007
|
||||
|
||||
#define NAND_UID_RAW_PAGE_BYTES_TO_READ (256)
|
||||
#define NAND_UID_PPN_BYTES_TO_READ (16)
|
||||
#define NAND_UID_LEN_RAW (16)
|
||||
#define NAND_UID_LEN_PPN (16)
|
||||
//Length of PPN Firmware Version, Package Assembly Code, Controller UID, Controller HW ID
|
||||
#define NAND_DEV_PARAM_LEN_PPN (16)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UInt8 ce;
|
||||
UInt8 cmdSize;
|
||||
UInt8 addrSize;
|
||||
UInt8 confirmCmdSize;
|
||||
UInt8 arrCmd[10];
|
||||
UInt8 arrAddr[10];
|
||||
UInt8 arrConfirmCmd[10];
|
||||
UInt8 buf[NAND_UID_RAW_PAGE_BYTES_TO_READ];
|
||||
UInt32 bytesToRead;
|
||||
} GenericReadRequest;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UInt8 ce;
|
||||
UInt8 die;
|
||||
UInt8 buf[NAND_UID_PPN_BYTES_TO_READ];
|
||||
} PpnUIDReadRequest;
|
||||
|
||||
typedef union
|
||||
{
|
||||
struct {
|
||||
UInt8 DCCYCLE;
|
||||
UInt8 tRP;
|
||||
UInt8 tREH;
|
||||
UInt8 tWP;
|
||||
UInt8 tWH;
|
||||
}sdrTimings;
|
||||
UInt8 ddr_tHALFCYCLE;
|
||||
}NandTimingParams;
|
||||
|
||||
// ANDAddressStruct - is used to translate logical and virtual
|
||||
// addresses to physical addresses
|
||||
typedef struct
|
||||
{
|
||||
UInt32 dwLpn;
|
||||
UInt32 dwVpn;
|
||||
UInt32 dwCS;
|
||||
UInt32 dwPpn;
|
||||
UInt32 dwColumn;
|
||||
UInt16 dwCau;
|
||||
} ANDAddressStruct;
|
||||
|
||||
// Describe the sections of a NAND page that contain data
|
||||
typedef struct
|
||||
{
|
||||
UInt32 dwNumSegments;
|
||||
UInt32 dwMetaSegmentIndex;
|
||||
struct {
|
||||
UInt32 dwOffset;
|
||||
UInt32 dwLength;
|
||||
} pastrSegments[32];
|
||||
|
||||
} ANDNandLayoutStruct;
|
||||
|
||||
// use this structure to export all the information from the AND driver in a single buffer / file.
|
||||
typedef struct
|
||||
{
|
||||
UInt32 dwStructID;
|
||||
UInt32 dwStructureVersion;
|
||||
UInt32 dwDataSize;
|
||||
UInt32 dwIndex;
|
||||
} ANDExportStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UInt16 bank;
|
||||
UInt16 block;
|
||||
} SpecialBlockAddress;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UInt32 dwPhysicalCE;
|
||||
UInt32 dwPhysicalBlock;
|
||||
UInt16 wType;
|
||||
} BorrowBlockAddress;
|
||||
|
||||
#define VFL_VALUE_UNKNOWN (~0)
|
||||
typedef enum
|
||||
{
|
||||
VFLFailNone,
|
||||
VFLFailUECC,
|
||||
VFLFailErase,
|
||||
VFLFailWrite,
|
||||
VFLFailEraseTimeOut,
|
||||
VFLFailWriteTimeOut,
|
||||
VFLFailRefresh,
|
||||
VFLFailEnd = 0x7FFFFFFF
|
||||
} VFLFailureMode;
|
||||
|
||||
#define VFL_MAX_FAILURE_REGIONS (16)
|
||||
typedef struct
|
||||
{
|
||||
VFLFailureMode mode;
|
||||
UInt16 wCE[VFL_MAX_FAILURE_REGIONS];
|
||||
UInt16 wPhysicalBlock[VFL_MAX_FAILURE_REGIONS];
|
||||
UInt32 dwPhysicalPage;
|
||||
} VFLFailureDetails;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UInt64 ddwPagesWrittenCnt;
|
||||
UInt64 ddwPagesReadCnt;
|
||||
UInt64 ddwBlocksErasedCnt;
|
||||
UInt64 ddwSingleWriteCallCnt;
|
||||
UInt64 ddwSingleReadCallCnt;
|
||||
UInt64 ddwSequetialReadCallCnt;
|
||||
UInt64 ddwScatteredReadCallCnt;
|
||||
UInt64 ddwMultipleWriteCallCnt;
|
||||
UInt64 ddwEraseCallCnt;
|
||||
} genVFLStatistics;
|
||||
|
||||
#define TL_BLOCK_FREE 0x1
|
||||
#define TL_BLOCK_DATA 0x2
|
||||
#define TL_BLOCK_INDEX 0x4
|
||||
#define TL_BLOCK_CXT 0x8
|
||||
#define TL_BLOCK_DEAD 0x10
|
||||
#define TL_BLOCK_DATA_STATIC 0x20
|
||||
#define TL_BLOCK_UNKNOWN 0x80
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UInt8 blockType;
|
||||
UInt32 blockSizeInLbas;
|
||||
UInt32 validLbas;
|
||||
} ANDFTLBlockStruct;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Global Structure Types which should be shared by FTL, VFL, FIL */
|
||||
/*****************************************************************************/
|
||||
|
||||
#define FTL_TYPE_FTL 1
|
||||
#define FTL_TYPE_YAFTL 2
|
||||
#define FTL_TYPE_SFTL 3
|
||||
|
||||
#define VFL_TYPE_VFL 1
|
||||
#define VFL_TYPE_VSVFL 2
|
||||
#define VFL_TYPE_PPNVFL 3
|
||||
#define VFL_TYPE_SWISSPPNVFL 4
|
||||
|
||||
|
||||
#define AND_EXPORT_STRUCTURE_VERSION 0x00020001
|
||||
#define AND_EXPORT_STRUCTURE_MAJVER(v) (((v) >> 16) & 0xFFFF)
|
||||
#define AND_EXPORT_STRUCTURE_MINVER(v) (((v) >> 0) & 0xFFFF)
|
||||
#define AND_EXPORT_STRUCTURE_IS_1_X(v) (1 == AND_EXPORT_STRUCTURE_MAJVER(v))
|
||||
#define AND_EXPORT_STRUCTURE_IS_2_X(v) (2 == AND_EXPORT_STRUCTURE_MAJVER(v))
|
||||
|
||||
#define AND_STATISTICS_SIZE_PER_LAYER (0x200)
|
||||
|
||||
#define LOCKDOWN_EXTRACT_ALL (0xFE000000 | 0x00000100)
|
||||
#define LOCKDOWN_GET_ALL_SIZE (0xFE000000 | 0x00000200)
|
||||
|
||||
// CtrlIO defines and structures
|
||||
// defines for data structues queries from user applications
|
||||
#define AND_STRUCT_SIZE_MASK (0x80000000) // MSb indicates we're requesting the size
|
||||
#define AND_STRUCT_LAYER_MASK (0x3F000000) // use with & to get the layer struct type
|
||||
#define AND_STRUCT_INDEX_MASK (0xFFFFFF00) // use with & to clear the index (LSB)
|
||||
#define AND_STRUCT_CS_MASK (0x000000FF) // use with & to clear the CS
|
||||
#define AND_STRUCT_SET (0x40000000) // Use this bit to indicate a set operation
|
||||
#define AND_STRUCT_LAYER_OS (0x0A000000)
|
||||
|
||||
#define AND_STRUCT_LAYER_FTL (0x01000000)
|
||||
#define AND_STRUCT_LAYER_VFL (0x02000000)
|
||||
#define AND_STRUCT_LAYER_FIL (0x03000000)
|
||||
#define AND_STRUCT_LAYER_WMR (0x04000000)
|
||||
#define AND_STRUCT_LAYER_FUNCTIONAL (0x10000000)
|
||||
// Operations
|
||||
#define _AND_FUNCTION_COMPLETE_EPOCH_UPDATE (AND_STRUCT_LAYER_FUNCTIONAL | 0x00000001) // deprecated
|
||||
#define AND_FUNCTION_INDEX_CACHE_UPDATE (AND_STRUCT_LAYER_FUNCTIONAL | 0x00000200)
|
||||
#define AND_FUNCTION_CHANGE_FTL_TYPE (AND_STRUCT_LAYER_FUNCTIONAL | 0x00000300)
|
||||
#define AND_FUNCTION_CHANGE_NUM_OF_SUBLKS (AND_STRUCT_LAYER_FUNCTIONAL | 0x00000400)
|
||||
#define AND_FUNCTION_SET_BURNIN_CODE (AND_STRUCT_LAYER_FUNCTIONAL | 0x00000500)
|
||||
#define AND_FUNCTION_ERASE_SIGNATURE (AND_STRUCT_LAYER_FUNCTIONAL | 0x00000600)
|
||||
#define AND_FUNCTION_SET_POWER_MODE (AND_STRUCT_LAYER_FUNCTIONAL | 0x00000700)
|
||||
#define AND_FUNCTION_NEURALIZE (AND_STRUCT_LAYER_FUNCTIONAL | 0x00000800)
|
||||
#define AND_FUNCTION_SET_TIMINGS (AND_STRUCT_LAYER_FUNCTIONAL | 0x00000900)
|
||||
#define AND_FUNCTION_SAVE_STATS (AND_STRUCT_LAYER_FUNCTIONAL | 0x00000A00)
|
||||
|
||||
// the below is defined in ANDExport.h
|
||||
#define AND_STRUCT_LAYER_GETALL (0x30000000)
|
||||
|
||||
#define AND_STRUCT_WMR_EXPORT_ALL (AND_STRUCT_LAYER_GETALL | 0x00000100)
|
||||
#define AND_STRUCT_WMR_EXPORT_ALL_GET_SIZE (AND_STRUCT_LAYER_GETALL | 0x00000200)
|
||||
#define AND_STRUCT_WMR_EXPORT_ALL_END (AND_STRUCT_LAYER_GETALL | 0x0000FF00)
|
||||
|
||||
// use the LSB for indexing (do not use it for the identifiers)
|
||||
// OS structures
|
||||
#define AND_STRUCT_OS_GET_IOS (AND_STRUCT_LAYER_OS | 0x00000100)
|
||||
#define AND_STRUCT_OS_GET_HIST (AND_STRUCT_LAYER_OS | 0x00000200)
|
||||
#define AND_STRUCT_OS_SET_LOG_TAG (AND_STRUCT_LAYER_OS | 0x00000300)
|
||||
#define AND_STRUCT_OS_SET_GMT_TAG (AND_STRUCT_LAYER_OS | 0x00000400)
|
||||
|
||||
// FTL structures
|
||||
#define AND_STRUCT_FTL_STATISTICS (AND_STRUCT_LAYER_FTL | 0x00000200)
|
||||
#define AND_STRUCT_FTL_FTLCXT (AND_STRUCT_LAYER_FTL | 0x00000300)
|
||||
#define AND_STRUCT_FTL_MAPTABLE (AND_STRUCT_LAYER_FTL | 0x00000400)
|
||||
#define AND_STRUCT_FTL_LOGCXTTABLE (AND_STRUCT_LAYER_FTL | 0x00000500)
|
||||
#define AND_STRUCT_FTL_ECTABLE (AND_STRUCT_LAYER_FTL | 0x00000600)
|
||||
#define AND_STRUCT_FTL_RCTABLE (AND_STRUCT_LAYER_FTL | 0x00000700)
|
||||
#define AND_STRUCT_FTL_GETADDRESS (AND_STRUCT_LAYER_FTL | 0x00000800)
|
||||
#define AND_STRUCT_FTL_GET_TYPE (AND_STRUCT_LAYER_FTL | 0x00000900)
|
||||
#define AND_STRUCT_FTL_GET_FTL_STATS_SIZE (AND_STRUCT_LAYER_FTL | 0x00000A00)
|
||||
#define AND_STRUCT_FTL_GET_FTL_DEVICEINFO_SIZE (AND_STRUCT_LAYER_FTL | 0x00000B00)
|
||||
#define AND_STRUCT_FTL_GET_FTL_DEVICEINFO (AND_STRUCT_LAYER_FTL | 0x00000C00)
|
||||
#define AND_STRUCT_FTL_GET_FTL_EC_BINS (AND_STRUCT_LAYER_FTL | 0x00000D00)
|
||||
#define AND_STRUCT_FTL_GET_FTL_RC_BINS (AND_STRUCT_LAYER_FTL | 0x00000E00)
|
||||
#define AND_STRUCT_FTL_RECOMMEND_CONTENT_DELETION (AND_STRUCT_LAYER_FTL | 0x00000F00)
|
||||
#define AND_STRUCT_FTL_IDEAL_SIZE_1K (AND_STRUCT_LAYER_FTL | 0x00001000)
|
||||
#define AND_STRUCT_FTL_GET_FTL_BLOCK_COUNT (AND_STRUCT_LAYER_FTL | 0x00001100)
|
||||
#define AND_STRUCT_FTL_GET_FTL_BLOCK_STAT (AND_STRUCT_LAYER_FTL | 0x00001200)
|
||||
#define AND_STRUCT_FTL_L2V_STRUCT (AND_STRUCT_LAYER_FTL | 0x00001300)
|
||||
#define AND_STRUCT_FTL_L2V_ROOTS (AND_STRUCT_LAYER_FTL | 0x00001400)
|
||||
#define AND_STRUCT_FTL_L2V_POOL (AND_STRUCT_LAYER_FTL | 0x00001500)
|
||||
#define AND_STRUCT_FTL_SB_CYCLES (AND_STRUCT_LAYER_FTL | 0x00001600)
|
||||
#define AND_STRUCT_FTL_SB_READ_CYCLES (AND_STRUCT_LAYER_FTL | 0x00001700)
|
||||
|
||||
// VFL structures
|
||||
#define AND_STRUCT_VFL_MASK (AND_STRUCT_LAYER_VFL | 0x0000FF00)
|
||||
#define AND_STRUCT_VFL_STATISTICS (AND_STRUCT_LAYER_VFL | 0x00000200)
|
||||
#define AND_STRUCT_VFL_VFLMETA (AND_STRUCT_LAYER_VFL | 0x00000300)
|
||||
#define AND_STRUCT_VFL_BBT (AND_STRUCT_LAYER_VFL | 0x00000400)
|
||||
#define AND_STRUCT_VFL_FILSTATISTICS (AND_STRUCT_LAYER_VFL | 0x00000500)
|
||||
#define AND_STRUCT_VFL_GETADDRESS (AND_STRUCT_LAYER_VFL | 0x00000600)
|
||||
#define AND_STRUCT_VFL_GROWNBBT (AND_STRUCT_LAYER_VFL | 0x00000700)
|
||||
#define AND_STRUCT_VFL_GET_TYPE (AND_STRUCT_LAYER_VFL | 0x00000800)
|
||||
#define AND_STRUCT_VFL_STATISTICS_SIZE (AND_STRUCT_LAYER_VFL | 0x00000900)
|
||||
#define AND_STRUCT_VFL_DEVICEINFO_SIZE (AND_STRUCT_LAYER_VFL | 0x00000A00)
|
||||
#define AND_STRUCT_VFL_DEVICEINFO (AND_STRUCT_LAYER_VFL | 0x00000B00)
|
||||
#define AND_STRUCT_VFL_FTLTYPE (AND_STRUCT_LAYER_VFL | 0x00000C00)
|
||||
#define AND_STRUCT_VFL_NUM_OF_FTL_SUBLKS (AND_STRUCT_LAYER_VFL | 0x00000D00)
|
||||
#define AND_STRUCT_VFL_BYTES_PER_PAGE (AND_STRUCT_LAYER_VFL | 0x00000E00)
|
||||
#define AND_STRUCT_VFL_PAGES_PER_SUBLK (AND_STRUCT_LAYER_VFL | 0x00000F00)
|
||||
#define AND_STRUCT_VFL_BYTES_PER_META (AND_STRUCT_LAYER_VFL | 0x00001000)
|
||||
#define AND_STRUCT_VFL_CORRECTABLE_BITS (AND_STRUCT_LAYER_VFL | 0x00001100)
|
||||
#define AND_STRUCT_VFL_CORRECTABLE_SIZE (AND_STRUCT_LAYER_VFL | 0x00001200)
|
||||
#define AND_STRUCT_VFL_NUM_OF_SUBLKS (AND_STRUCT_LAYER_VFL | 0x00001300)
|
||||
#define AND_STRUCT_VFL_NEW_FTLTYPE (AND_STRUCT_LAYER_VFL | 0x00001400)
|
||||
#define AND_STRUCT_VFL_NEW_NUM_OF_FTL_SUBLKS (AND_STRUCT_LAYER_VFL | 0x00001500)
|
||||
#define AND_STRUCT_VFL_BURNIN_CODE (AND_STRUCT_LAYER_VFL | 0x00001600)
|
||||
#define AND_STRUCT_VFL_FACTORY_BBT (AND_STRUCT_LAYER_VFL | 0x00001700)
|
||||
#define AND_STRUCT_VFL_SIGNATURE_LOCATION (AND_STRUCT_LAYER_VFL | 0x00001800)
|
||||
#define AND_STRUCT_VFL_PAGES_PER_BLOCK (AND_STRUCT_LAYER_VFL | 0x00001900)
|
||||
#define AND_STRUCT_VFL_LAST_ERROR (AND_STRUCT_LAYER_VFL | 0x00001A00)
|
||||
#define AND_STRUCT_VFL_NAND_TYPE (AND_STRUCT_LAYER_VFL | 0x00001B00)
|
||||
#define AND_STRUCT_VFL_VALID_BYTES_PER_META (AND_STRUCT_LAYER_VFL | 0x00001C00)
|
||||
#define AND_STRUCT_VFL_FIND_BORROWED_BLOCKS (AND_STRUCT_LAYER_VFL | 0x00001D00)
|
||||
#define AND_STRUCT_VFL_EXPORTED_LBA_NO (AND_STRUCT_LAYER_VFL | 0x00001E00)
|
||||
#define AND_STRUCT_VFL_EXPORTED_L2V_POOL (AND_STRUCT_LAYER_VFL | 0x00001F00)
|
||||
#define AND_STRUCT_VFL_PUBLIC_FBBT (AND_STRUCT_LAYER_VFL | 0x00002000)
|
||||
#define AND_STRUCT_VFL_NUM_CHANNELS (AND_STRUCT_LAYER_VFL | 0x00002100)
|
||||
#define AND_STRUCT_VFL_CES_PER_CHANNEL (AND_STRUCT_LAYER_VFL | 0x00002200)
|
||||
#define AND_STRUCT_VFL_CAUS_PER_CE (AND_STRUCT_LAYER_VFL | 0x00002300)
|
||||
#define AND_STRUCT_VFL_MAX_TRANS_IN_PAGES (AND_STRUCT_LAYER_VFL | 0x00002400)
|
||||
|
||||
// FIL structures
|
||||
#define AND_STRUCT_FIL_MASK (AND_STRUCT_LAYER_FIL | 0x0000FF00) // LSB used for bank info
|
||||
#define AND_STRUCT_FIL_STATISTICS (AND_STRUCT_LAYER_FIL | 0x00000200) // LSB used for bank info
|
||||
#define AND_STRUCT_FIL_READPAGE (AND_STRUCT_LAYER_FIL | 0x00000300) // LSB used for bank info
|
||||
#define AND_STRUCT_FIL_STATISTICS_SIZE (AND_STRUCT_LAYER_FIL | 0x00000400) // LSB used for bank info
|
||||
#define AND_STRUCT_FIL_READTIMING (AND_STRUCT_LAYER_FIL | 0x00000500)
|
||||
#define AND_STRUCT_FIL_WRITETIMING (AND_STRUCT_LAYER_FIL | 0x00000600)
|
||||
#define AND_STRUCT_FIL_CHIPID (AND_STRUCT_LAYER_FIL | 0x00000700)
|
||||
#define AND_STRUCT_FIL_CHANNEL_BITMAP (AND_STRUCT_LAYER_FIL | 0x00000800)
|
||||
#define AND_STRUCT_FIL_UNIQUEID (AND_STRUCT_LAYER_FIL | 0x00000900)
|
||||
#define AND_STRUCT_FIL_HYNIX_BBT (AND_STRUCT_LAYER_FIL | 0x00000A00)
|
||||
#define AND_STRUCT_FIL_POWER_MODE (AND_STRUCT_LAYER_FIL | 0x00000B00)
|
||||
#define AND_STRUCT_FIL_NAND_LAYOUT (AND_STRUCT_LAYER_FIL | 0x00000C00)
|
||||
#define AND_STRUCT_FIL_SPARE_SIZE (AND_STRUCT_LAYER_FIL | 0x00000D00)
|
||||
#define AND_STRUCT_FIL_BITS_PER_CELL (AND_STRUCT_LAYER_FIL | 0x00000E00)
|
||||
#define AND_STRUCT_FIL_DEVICE_INFO (AND_STRUCT_LAYER_FIL | 0x00000F00)
|
||||
#define AND_STRUCT_FIL_DIES_PER_CE (AND_STRUCT_LAYER_FIL | 0x00001000)
|
||||
#define AND_STRUCT_FIL_BLOCKS_PER_CE (AND_STRUCT_LAYER_FIL | 0x00001100)
|
||||
#define AND_STRUCT_FIL_SET_TIMINGS (AND_STRUCT_LAYER_FIL | 0x00001200)
|
||||
#define AND_STRUCT_FIL_GET_TIMINGS (AND_STRUCT_LAYER_FIL | 0x00001300)
|
||||
#define AND_STRUCT_FIL_GET_CE_INFO (AND_STRUCT_LAYER_FIL | 0x00001400)
|
||||
#define AND_STRUCT_FIL_MFG_ID (AND_STRUCT_LAYER_FIL | 0x00001500)
|
||||
#define AND_STRUCT_FIL_FW_VERSION (AND_STRUCT_LAYER_FIL | 0x00001600)
|
||||
#define AND_STRUCT_FIL_PKG_ASSEMBLY_CODE (AND_STRUCT_LAYER_FIL | 0x00001700)
|
||||
#define AND_STRUCT_FIL_CONTROLLER_UID (AND_STRUCT_LAYER_FIL | 0x00001800)
|
||||
#define AND_STRUCT_FIL_CONTROLLER_HW_ID (AND_STRUCT_LAYER_FIL | 0x00001900)
|
||||
#define AND_STRUCT_FIL_LBAS_PER_PAGE (AND_STRUCT_LAYER_FIL | 0x00001A00)
|
||||
|
||||
// WMR structures
|
||||
#define AND_STRUCT_WMR_VERSION (AND_STRUCT_LAYER_WMR | 0x00000100)
|
||||
#define AND_STRUCT_WMR_DEVICEINFO (AND_STRUCT_LAYER_WMR | 0x00000200)
|
||||
#define AND_STRUCT_WMR_LAYOUT (AND_STRUCT_LAYER_WMR | 0x00000300)
|
||||
|
||||
// defines for device info types, these might move to an h file shared by all layers
|
||||
#define AND_DEVINFO_PAGES_PER_BLOCK (100)
|
||||
#define AND_DEVINFO_NUM_OF_CS (101)
|
||||
#define AND_DEVINFO_BBT_TYPE (102)
|
||||
#define AND_DEVINFO_BLOCKS_PER_CS (103)
|
||||
#define AND_DEVINFO_BYTES_PER_PAGE (104)
|
||||
#define AND_DEVINFO_BYTES_PER_SPARE (105)
|
||||
#define AND_DEVINFO_USER_BLOCKS_PER_CS (106)
|
||||
#define AND_DEVINFO_VENDOR_SPECIFIC_TYPE (107)
|
||||
#define AND_DEVINFO_REFRESH_THRESHOLD (108)
|
||||
#define AND_DEVINFO_BANKS_PER_CS (109)
|
||||
#define AND_DEVINFO_PAGES_PER_SUBLK (110)
|
||||
#define AND_DEVINFO_NUM_OF_BANKS (111)
|
||||
#define AND_DEVINFO_NUM_OF_USER_SUBLK (112)
|
||||
#define AND_DEVINFO_FTL_TYPE (113)
|
||||
#define AND_DEVINFO_BYTES_PER_BL_PAGE (114)
|
||||
#define AND_DEVINFO_CORRECTABLE_BITS (115)
|
||||
#define AND_DEVINFO_CORRECTABLE_SIZE (116)
|
||||
#define AND_DEVINFO_FTL_NEED_FORMAT (117)
|
||||
#define AND_DEVINFO_DIES_PER_CS (118)
|
||||
#define AND_DEVINFO_BLOCKS_PER_DIE (119)
|
||||
#define AND_DEVINFO_DIE_STRIDE (120)
|
||||
#define AND_DEVINFO_BLOCK_STRIDE (121)
|
||||
#define AND_DEVINFO_LAST_BLOCK (122)
|
||||
#define AND_DEVINFO_BLOCKS_PER_CAU (123)
|
||||
#define AND_DEVINFO_CAUS_PER_CE (124)
|
||||
#define AND_DEVINFO_SLC_PAGES_PER_BLOCK (125)
|
||||
#define AND_DEVINFO_MLC_PAGES_PER_BLOCK (126)
|
||||
#define AND_DEVINFO_MATCH_ODDEVEN_CAUS (127)
|
||||
#define AND_DEVINFO_BITS_PER_CAU_ADDRESS (128)
|
||||
#define AND_DEVINFO_BITS_PER_PAGE_ADDRESS (130)
|
||||
#define AND_DEVINFO_BITS_PER_BLOCK_ADDRESS (131)
|
||||
#define AND_DEVINFO_NUM_OF_CHANNELS (132)
|
||||
#define AND_DEVINFO_NUM_OF_CES_PER_CHANNEL (133)
|
||||
#define AND_DEVINFO_PPN_DEVICE (134)
|
||||
#define AND_DEVINFO_FIL_LBAS_PER_PAGE (135)
|
||||
#define AND_DEVINFO_FIL_META_VALID_BYTES (136)
|
||||
#define AND_DEVINFO_FIL_META_BUFFER_BYTES (137)
|
||||
#define AND_DEVINFO_FIL_MATCH_ODD_EVEN_BLKS (138)
|
||||
#define AND_DEVINFO_FIL_PREP_BUFFER_ENTRIES (139)
|
||||
#define AND_DEVINFO_VFL_AVAILABLE_VBAS (140)
|
||||
#define AND_DEVINFO_ADDR_BITS_BITS_PER_CELL (141)
|
||||
#define AND_DEVINFO_TOGGLE_DEVICE (142)
|
||||
#define AND_DEVINFO_L2V_POOL_SIZE (143)
|
||||
#define AND_DEVINFO_STREAM_BUFFER_MAX (144)
|
||||
|
||||
|
||||
// format params
|
||||
#define WMR_INIT_DISABLE_FORMAT (0x00000000) // default init value
|
||||
#define WMR_INIT_ALLOW_FORMAT (0x00000001) // allow normal unit format
|
||||
#define WMR_INIT_RUN_PRODUCTION_FORMAT (0x00000002) // call production format
|
||||
#define WMR_INIT_ALLOW_VSVFL (0x00000004) // allow VSVFL in case we format
|
||||
#define WMR_INIT_ALLOW_YAFTL (0x00000008) // allow VSVFL in case we format
|
||||
#define WMR_INIT_RUN_FTL_FORMAT (0x00000010) // call ftl format and change the FTL size
|
||||
#define WMR_INIT_SIGNATURE_IN_BLOCKZERO (0x00000020) // signature in block zero
|
||||
#define WMR_INIT_LOW_POWER_MODE (0x00000040) // driver should use minimum power until notified
|
||||
#define WMR_INIT_NAND_RESTORE (0x00000080) // force full nand restore during power up
|
||||
#define WMR_INIT_USE_DEV_UNIQUE_INFO (0x00000100) // allocate a partition for device unique info
|
||||
#define WMR_INIT_USE_DIAG_CTRL_INFO (0x00000200) // allocate a partition for diag control bits
|
||||
#define WMR_INIT_METADATA_WHITENING (0x00000400) // device should be formatted with metadata whitening
|
||||
#define WMR_INIT_METADATA_WHITENING_CHECK (0x00000800) // device should be formatted with metadata whitening if it already isn't
|
||||
#define _WMR_INIT_ALLOW_ANY_EPOCH (0x00001000) // driver will not fail security epoch check (deprecated)
|
||||
#define WMR_INIT_DISABLE_GC_IN_TRIM (0x00002000) // disable empty GC in trim
|
||||
#define WMR_INIT_SET_INDEX_CACHE_SIZE (0x00004000) // disable empty GC in trim
|
||||
#define WMR_INIT__USE_NEW_DUAL_CHANNEL_ADDRESS (0x00008000) // rdar://9159270
|
||||
#define WMR_INIT_OPEN_READONLY (0x00010000) // Disable writes/erase during open rdar://9407663
|
||||
#define WMR_INIT_USE_KEEPOUT_AS_BORROW (0x00020000)
|
||||
#ifdef AND_SIMULATOR
|
||||
#define WMR_INIT_IGNORE_ERASE_GAP (0x00040000)
|
||||
#endif
|
||||
|
||||
// flags for external VFL calls
|
||||
#define AND_EXTERNAL_VFL_TEST_PARTITION (0x00000000)
|
||||
#define AND_EXTERNAL_VFL_FTL_PARTITION (0x00000001)
|
||||
#define AND_EXTERNAL_VFL_FULL (0x00000002)
|
||||
|
||||
// factory test conditions
|
||||
#define VFL_BONFIRE_UNTESTED_CODE (0)
|
||||
#define VFL_BONFIRE_RMA_CODE (306)
|
||||
|
||||
// FIL defines
|
||||
typedef enum
|
||||
{
|
||||
INIT_BBT_TOSHIBA_MLC = 1,
|
||||
INIT_BBT_SAMSUNG_MLC = 2,
|
||||
INIT_BBT_HYNIX_MLC = 3,
|
||||
INIT_BBT_SAMSUNG_SLC = 4,
|
||||
INIT_BBT_INTEL_ONFI = 5,
|
||||
INIT_BBT_ONFI = 6,
|
||||
INIT_BBT_MICRON_ONFI = 7,
|
||||
INIT_BBT_SAMSUNG_MLC_8K = 8,
|
||||
INIT_BBT_SANDISK_MLC = 9,
|
||||
INIT_BBT_PPN = 10,
|
||||
INIT_BBT_BOGUS = 0x0FFFFFFF, // Force 4-byte enum field
|
||||
} CheckInitialBadType;
|
||||
|
||||
// format definitions
|
||||
#define VS_FMT_UNKNOWN 0x0000
|
||||
#define VS_FMT_SIMPLE 0x0001
|
||||
#define VS_FMT_TOSHIBA_TWO_DISTRICT 0x0010
|
||||
#define VS_FMT_TOSHIBA_TWO_DISTRICT_EXT 0x0011
|
||||
#define VS_FMT_2BANKS_MSB 0x0012
|
||||
#define VS_FMT_4BANKS_LSB_MSB 0x0013
|
||||
#define VS_FMT_2BANKS_LSB 0x0014
|
||||
#define VS_FMT_TOSHIBA_TWO_DIE 0x0015
|
||||
#define VS_FMT_4BANKS_LSB_MSB_NOPWR2 0x0016
|
||||
|
||||
// command definitions
|
||||
#define VS_CMD_UNKNOWN 0x0000
|
||||
#define VS_CMD_SIMPLE 0x0001
|
||||
#define VS_CMD_SAMSUNG_2P 0x0010
|
||||
#define VS_CMD_ONFI_2D 0x0011
|
||||
#define VS_CMD_ONFI_2P 0x0012
|
||||
#define VS_CMD_ONFI_2D_CACHE 0x0013
|
||||
#define VS_CMD_ONFI_2P_CACHE 0x0014
|
||||
#define VS_CMD_TOSHIBA_2P 0x0015
|
||||
#define VS_CMD_TOSHIBA_2P_CACHE 0x0016
|
||||
#define VS_CMD_TOSHIBA_2D 0x0017
|
||||
|
||||
typedef UInt32 VendorSpecificType;
|
||||
|
||||
#define VS_TYPE(cmd, fmt) (UInt32)(((UInt32)(cmd) << 16) | ((UInt32)(fmt) & 0x0000FFFF))
|
||||
#define VS_GET_CMD(vs) (((UInt32)(vs) >> 16))
|
||||
#define VS_GET_FMT(vs) (((UInt32)(vs) & 0x0000FFFF))
|
||||
|
||||
#define FIL_VS_UNKNOWN VS_TYPE(VS_CMD_UNKNOWN, VS_FMT_UNKNOWN)
|
||||
#define FIL_VS_SIMPLE VS_TYPE(VS_CMD_SIMPLE, VS_FMT_SIMPLE)
|
||||
// this is to make the current tables work...
|
||||
#define FIL_VS_HYNIX_2P VS_TYPE(VS_CMD_SAMSUNG_2P, VS_FMT_2BANKS_LSB)
|
||||
#define FIL_VS_ONFI_2D VS_TYPE(VS_CMD_ONFI_2D, VS_FMT_2BANKS_MSB)
|
||||
#define FIL_VS_ONFI_2P VS_TYPE(VS_CMD_ONFI_2P, VS_FMT_2BANKS_LSB)
|
||||
#define FIL_VS_ONFI_2P_2D VS_TYPE(VS_CMD_ONFI_2P, VS_FMT_4BANKS_LSB_MSB)
|
||||
#define FIL_VS_ONFI_2D_CACHE VS_TYPE(VS_CMD_ONFI_2D_CACHE, VS_FMT_2BANKS_MSB)
|
||||
#define FIL_VS_ONFI_2P_CACHE VS_TYPE(VS_CMD_ONFI_2P_CACHE, VS_FMT_2BANKS_LSB)
|
||||
#define FIL_VS_ONFI_2P_2D_CACHE VS_TYPE(VS_CMD_ONFI_2P_CACHE, VS_FMT_4BANKS_LSB_MSB)
|
||||
#define FIL_VS_SAMSUNG_2D VS_TYPE(VS_CMD_SIMPLE, VS_FMT_2BANKS_MSB)
|
||||
#define FIL_VS_SAMSUNG_2P_2D VS_TYPE(VS_CMD_SIMPLE, VS_FMT_4BANKS_LSB_MSB)
|
||||
#define FIL_VS_SAMSUNG_2P_2D_EXT VS_TYPE(VS_CMD_SIMPLE, VS_FMT_4BANKS_LSB_MSB_NOPWR2)
|
||||
#define FIL_VS_TOSHIBA_2P VS_TYPE(VS_CMD_TOSHIBA_2P, VS_FMT_TOSHIBA_TWO_DISTRICT)
|
||||
#define FIL_VS_TOSHIBA_2P_EXT VS_TYPE(VS_CMD_TOSHIBA_2P, VS_FMT_TOSHIBA_TWO_DISTRICT_EXT)
|
||||
#define FIL_VS_TOSHIBA_2P_CACHE VS_TYPE(VS_CMD_TOSHIBA_2P_CACHE, VS_FMT_TOSHIBA_TWO_DISTRICT)
|
||||
#define FIL_VS_TOSHIBA_2P_EXT_CACHE VS_TYPE(VS_CMD_TOSHIBA_2P_CACHE, VS_FMT_TOSHIBA_TWO_DISTRICT_EXT)
|
||||
#define FIL_VS_TOSHIBA_2D VS_TYPE(VS_CMD_TOSHIBA_2D, VS_FMT_TOSHIBA_TWO_DIE)
|
||||
|
||||
//CE status report definitions
|
||||
#define CE_STATUS_UNINITIALIZED ((UInt16)~0)
|
||||
#define PAGE_STATUS_UNINITIALIZED ((UInt32)~0)
|
||||
|
||||
//Enumeration for blocks that have failed erase
|
||||
#define BLOCK_STATUS_UNINITIALIZED ((UInt32)0xFFFFFFFF)
|
||||
|
||||
// =============================================================================
|
||||
// Power Mode
|
||||
// To be used with AND_FUNCTION_SET_POWER_MODE & AND_STRUCT_FIL_POWER_MODE
|
||||
#define NAND_POWER_MODE_UNKNOWN ((UInt32) 0)
|
||||
#define NAND_POWER_MODE_FULL_SPEED ((UInt32) 1)
|
||||
#define NAND_POWER_MODE_SINGLE_CE ((UInt32) 2)
|
||||
#define NAND_POWER_MODE_STANDBY ((UInt32) 3)
|
||||
|
||||
|
||||
#define NAND_DATA_REGION_SYSCFG ((UInt32)1)
|
||||
#define NAND_DATA_REGION_DIAG_CONTROL ((UInt32)0)
|
||||
|
||||
// Special Blcok Types - PPN VFL / FPart
|
||||
// Bit allocations:
|
||||
// [0-7] - code (uniquue per special block type - valid range is 0x00 - 0xEF
|
||||
// leaving the top to VFL Context
|
||||
// [8-13] - handler (how the special block shold be procesed - handler can be either supported
|
||||
// by FPart or other layers. handler handled by other layers can not be persistent.
|
||||
// [14] - persistent flag (1 - persistent, 0 - not persistent)
|
||||
// [15] - special bit flag (1 - special block, 0 - block is allocated to virtual block exported by vfl)
|
||||
|
||||
#define AND_SB_BIT_SPEICAL_FLAG (1 << 15) // if this bit is set the block is
|
||||
// NOT allocated to VBN
|
||||
// It is either a special block or
|
||||
// VFL context block
|
||||
|
||||
#define AND_SB_BIT_PERSISTENT_FLAG (1 << 14) // persistent type (need to survive loosing the signature)
|
||||
|
||||
#define andSBGetHandler(_x) ((UInt16)(((_x) & 0x3F00) >> 8))
|
||||
#define andSBSetHandler(_x) ((UInt16)(((_x) & 0x3F) << 8))
|
||||
|
||||
#define AND_SB_HANDLER_SINGLE_VERSION (1)
|
||||
#define AND_SB_HANDLER_MULTI_VERSION (2)
|
||||
#define AND_SB_HANDLER_NAND_BOOT (0x30)
|
||||
#define AND_SB_HANDLER_VFL_CXT (0x3F)
|
||||
|
||||
|
||||
#define andSBGetCode(_x) ((UInt16)((_x) & 0x00FF))
|
||||
#define andSBSetCode(_x) ((UInt16)((_x) & 0x00FF))
|
||||
|
||||
|
||||
#define AND_SB_CODE_DRIVER_SIGNATURE (0x01)
|
||||
#define AND_SB_CODE_BLOCK_ZERO (0x02)
|
||||
#define AND_SB_CODE_NAND_BOOT (0x03)
|
||||
#define AND_SB_CODE_DIAGNOSTICS (0x04)
|
||||
#define AND_SB_CODE_UNIQUE_INFO (0x05)
|
||||
#define AND_SB_CODE_KEEPOUT (0x06)
|
||||
|
||||
#define AND_SB_TYPE_DRIVER_SIGNATURE (AND_SB_BIT_SPEICAL_FLAG | AND_SB_BIT_PERSISTENT_FLAG | andSBSetHandler(AND_SB_HANDLER_SINGLE_VERSION) | andSBSetCode(AND_SB_CODE_DRIVER_SIGNATURE))
|
||||
#define AND_SB_TYPE_BLOCK_ZERO (AND_SB_BIT_SPEICAL_FLAG | andSBSetHandler(AND_SB_HANDLER_NAND_BOOT) | andSBSetCode(AND_SB_CODE_BLOCK_ZERO))
|
||||
#define AND_SB_TYPE_NAND_BOOT (AND_SB_BIT_SPEICAL_FLAG | andSBSetHandler(AND_SB_HANDLER_NAND_BOOT) | andSBSetCode(AND_SB_CODE_NAND_BOOT))
|
||||
#define AND_SB_TYPE_DIAGNOSTICS (AND_SB_BIT_SPEICAL_FLAG | AND_SB_BIT_PERSISTENT_FLAG | andSBSetHandler(AND_SB_HANDLER_SINGLE_VERSION) | andSBSetCode(AND_SB_CODE_DIAGNOSTICS))
|
||||
#define AND_SB_TYPE_UNIQUE_INFO (AND_SB_BIT_SPEICAL_FLAG | AND_SB_BIT_PERSISTENT_FLAG | andSBSetHandler(AND_SB_HANDLER_SINGLE_VERSION) | andSBSetCode(AND_SB_CODE_UNIQUE_INFO))
|
||||
#define AND_SB_TYPE_KEEPOUT_BOOT (AND_SB_BIT_SPEICAL_FLAG | andSBSetHandler(AND_SB_HANDLER_NAND_BOOT) | andSBSetCode(AND_SB_CODE_KEEPOUT))
|
||||
|
||||
#define NAND_TYPE_RAW (0)
|
||||
#define NAND_TYPE_PPN (1)
|
||||
|
||||
#define AND_SPARE_TYPE_REGION_FTL (0x00) // allowing FTL to use 5 bits for types
|
||||
#define AND_SPARE_TYPE_REGION_VFL (0x20) // allowing VFL to use 4 bits for types
|
||||
#define AND_SPARE_TYPE_REGION_FPART (0x30) // allowing FPART to use 4 bits for types
|
||||
#define AND_SPARE_TYPE_REGION_BFN (0x40) // allowing BFN to use 4 bits for types
|
||||
|
||||
// Get address special cases definitions
|
||||
#define AND_GET_ADDRESS_SPECIAL (0xFFFFFF80)
|
||||
#define AND_GET_ADDRESS_TRIMMED (AND_GET_ADDRESS_SPECIAL + 1)
|
||||
#define AND_GET_ADDRESS_OUT_OF_RANGE (AND_GET_ADDRESS_SPECIAL + 2)
|
||||
#define AND_GET_ADDRESS_CACHED_WRITE (AND_GET_ADDRESS_SPECIAL + 3)
|
||||
#define AND_GET_ADDRESS_UNINITIALIZED (0xFFFFFFFF)
|
||||
|
||||
#define AND_L2V_POOL_SIZE_UNSPECIFIED (0XFFFFFFFF)
|
||||
|
||||
#endif /* _AND_TYPES_H_ */
|
||||
|
||||
@@ -0,0 +1,212 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT : Rainbow */
|
||||
/* MODULE : FIL */
|
||||
/* NAME : Flash Interface Layer header file */
|
||||
/* FILE : FIL.h */
|
||||
/* PURPOSE : This file contains the definition and protypes of exported */
|
||||
/* functions for FIL of Whimory. */
|
||||
/* */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* COPYRIGHT 2003-2005 SAMSUNG ELECTRONICS CO., LTD. */
|
||||
/* ALL RIGHTS RESERVED */
|
||||
/* */
|
||||
/* Permission is hereby granted to licensees of Samsung Electronics */
|
||||
/* Co., Ltd. products to use or abstract this computer program for the */
|
||||
/* sole purpose of implementing a product based on Samsung */
|
||||
/* Electronics Co., Ltd. products. No other rights to reproduce, use, */
|
||||
/* or disseminate this computer program, whether in part or in whole, */
|
||||
/* are granted. */
|
||||
/* */
|
||||
/* Samsung Electronics Co., Ltd. makes no representation or warranties */
|
||||
/* with respect to the performance of this computer program, and */
|
||||
/* specifically disclaims any responsibility for any damages, */
|
||||
/* special or consequential, connected with the use of this program. */
|
||||
/* */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* REVISION HISTORY */
|
||||
/* */
|
||||
/* 19-JUL-2005 [Jaesung Jung] : first writing */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef _FIL_H_
|
||||
#define _FIL_H_
|
||||
|
||||
#include "ANDTypes.h"
|
||||
#include "WMRFeatures.h"
|
||||
#include "PPN_FIL.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Return value of FIL_XXX() & physical interface function pointer */
|
||||
/*****************************************************************************/
|
||||
#define FIL_SUCCESS ANDErrorCodeOk
|
||||
#define FIL_SUCCESS_CLEAN ANDErrorCodeCleanOk
|
||||
#define FIL_CRITICAL_ERROR ANDErrorCodeHwErr
|
||||
#define FIL_U_ECC_ERROR ANDErrorCodeUserDataErr
|
||||
#define FIL_WRITE_FAIL_ERROR ANDErrorWriteFailureErr
|
||||
#define FIL_UNSUPPORTED_ERROR ANDErrorCodeNotSupportedErr
|
||||
|
||||
/*****************************************************************************/
|
||||
/* FIL Function Table Data Structures */
|
||||
/*****************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
void (*Reset)(void);
|
||||
Int32 (*ReadWithECC)(UInt16 wBank, UInt32 nPpn, UInt8 *pDBuf, UInt8 *pSBuf, UInt8 * pbCorrectedBits, UInt8 * pdwaSectorStats, BOOL32 bDisableWhitening);
|
||||
Int32 (*ReadNoECC)(UInt16 wBank, UInt32 nPpn, UInt8 *pDBuf, UInt8 *pSBuf);
|
||||
Int32 (*ReadMultiplePages)(UInt32 * padwPpn, UInt8* pDBuf, UInt8* pSBuf, UInt16 wNumOfPagesToRead, UInt8 * pbCorrectedBits, UInt8 * pdwaSectorStats, BOOL32 bDisableWhitening);
|
||||
Int32 (*ReadScatteredPages)(UInt16 * pawBank, UInt32 * padwPpn, UInt8* pDBuf, UInt8* pSBuf, UInt16 wNumOfPagesToRead, UInt8 * pbCorrectedBits, UInt8 * pdwaSectorStats, BOOL32 bDisableWhitening);
|
||||
Int32 (*ReadMaxECC)(UInt16 wBank, UInt32 nPpn, UInt8 *pDBuf);
|
||||
Int32 (*ReadBLPage)(UInt16 wCS, UInt32 dwPpn, UInt8 *pabData);
|
||||
Int32 (*WriteBLPage)(UInt16 wCS, UInt32 dwPpn, UInt8 *pabData);
|
||||
BOOL32 (*Write2ndBootLoader)(UInt8* padw2ndBootLoader, UInt32 dwBLPageCount, UInt32 dwBLOffsetPage);
|
||||
BOOL32 (*Read2ndBootLoader)(UInt8* padw2ndBootLoader, UInt32 dwBLPageCount);
|
||||
Int32 (*Erase)(UInt16 wBank, UInt32 wPbn);
|
||||
Int32 (*Write)(UInt16 wBank, UInt32 nPpn, UInt8 *pDBuf, UInt8 *pSBuf, BOOL32 bDisableWhitening);
|
||||
Int32 (*WriteScatteredPages)(UInt16 * pawBanks, UInt32 * padwPpn, UInt8 * pabDataBuf, UInt8 * pabMetaBuf, UInt16 wNumOfPagesToWrite, UInt16 * pwFailingCE, BOOL32 bDisableWhitening, UInt32 *pwFailingPageNum);
|
||||
Int32 (*WriteMultiplePages)(UInt32 * padwPpn, UInt8* pDBuf, UInt8* pSBuf, UInt16 wNumOfPagesToWrite, BOOL32 boolAligned, BOOL32 boolCorrectBank, UInt16 * pwFailingCE, BOOL32 bDisableWhitening, UInt32 *pwFailingPageNum);
|
||||
Int32 (*EraseMultiple)(UInt16 *pawPbn, BOOL32 boolAligned, BOOL32 boolCorrectBank, UInt16 *failingCE, UInt32 *failingBlock);
|
||||
Int32 (*WriteNoECC)(UInt16 wBank, UInt32 nPpn, UInt8 *pDBuf, UInt8 *pSBuf);
|
||||
Int32 (*WriteMaxECC)(UInt16 wBank, UInt32 nPpn, UInt8 *pDBuf);
|
||||
void (*CalcCurrentTiming)(void);
|
||||
void (*Notify)(UInt32 notifyCode);
|
||||
BOOL32 (*Get2ndBootLoaderInfo)(UInt32 * pdwMax2ndLoaderSize, UInt32 * pdw2ndLoaderPageSize);
|
||||
UInt32 (*GetDeviceInfo)(UInt32 dwParamType);
|
||||
void (*SetDeviceInfo)(UInt32 dwParamType, UInt32 dwVal);
|
||||
void (*SetWhiteningState)(BOOL32 enable);
|
||||
void (*SetWhiteningMetadataState)(BOOL32 enable);
|
||||
void (*RegisterCurrentTransaction)(UInt64 ddwLba, UInt32 dwNum, void * pDest);
|
||||
Int32 (*UpdateFirmware)(UInt16 wCS, UInt8 *pDBuf, UInt32 length);
|
||||
void (*PerformCommandList)(PPNCommandStruct **commands, UInt32 num_commands);
|
||||
} LowFuncTbl;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Notification values */
|
||||
/*****************************************************************************/
|
||||
#define AND_NOTIFY_REFORMAT 1
|
||||
#define AND_NOTIFY_RECOVER 2
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Statistics gathering definitions */
|
||||
/*****************************************************************************/
|
||||
typedef struct _FILStatistics
|
||||
{
|
||||
UInt64 ddwPagesWrittenCnt;
|
||||
UInt64 ddwPagesReadCnt;
|
||||
UInt64 ddwBlocksErasedCnt;
|
||||
UInt64 ddwResetCallCnt;
|
||||
UInt64 ddwReadWithECCCallCnt;
|
||||
UInt64 ddwReadMaxECCCallCnt;
|
||||
UInt64 ddwReadNoECCCallCnt;
|
||||
UInt64 ddwReadMultipleCallCnt;
|
||||
UInt64 ddwReadScatteredCallCnt;
|
||||
UInt64 ddwWriteSingleCallCnt;
|
||||
UInt64 ddwWriteMaxECCCallCnt;
|
||||
UInt64 ddwWriteMultipleCallCnt;
|
||||
UInt64 ddwWriteScatteredCallCnt;
|
||||
UInt64 ddwSingleEraseCallCnt;
|
||||
UInt64 ddwMultipleEraseCallCnt;
|
||||
UInt64 ddwReadCleanCnt;
|
||||
UInt64 ddwReadECCErrorCnt;
|
||||
UInt64 ddwReadHWErrorCnt;
|
||||
UInt64 ddwWriteHWErrCnt;
|
||||
UInt64 ddwWriteNANDErrCnt;
|
||||
UInt64 ddwEraseHWErrCnt;
|
||||
UInt64 ddwEraseNANDErrCnt;
|
||||
UInt64 addwReadBitFlipsCnt[FIL_MAX_ECC_CORRECTION + 1]; // 0 to max number of corrected bits
|
||||
UInt64 ddwTimeoutCnt;
|
||||
UInt64 ddwPartialUECCCnt;
|
||||
UInt64 ddwPartialCleanCnt;
|
||||
UInt64 ddwReadRefreshCnt;
|
||||
UInt64 ddwReadRetireCnt;
|
||||
} FILStatistics;
|
||||
|
||||
#define FIL_STATISTICS_DESCREPTION { \
|
||||
"ddwPagesWrittenCnt", \
|
||||
"ddwPagesReadCnt", \
|
||||
"ddwBlocksErasedCnt", \
|
||||
"ddwResetCallCnt", \
|
||||
"ddwReadWithECCCallCnt", \
|
||||
"ddwReadMaxECCCallCnt", \
|
||||
"ddwReadNoECCCallCnt", \
|
||||
"ddwReadMultipleCallCnt", \
|
||||
"ddwReadScatteredCallCnt", \
|
||||
"ddwWriteSingleCallCnt", \
|
||||
"ddwWriteMaxECCCallCnt", \
|
||||
"ddwWriteMultipleCallCnt", \
|
||||
"ddwWriteScatteredCallCnt", \
|
||||
"ddwSingleEraseCallCnt", \
|
||||
"ddwMultipleEraseCallCnt", \
|
||||
"ddwReadCleanCnt", \
|
||||
"ddwReadECCErrorCnt", \
|
||||
"ddwReadHWErrorCnt", \
|
||||
"ddwWriteHWErrCnt", \
|
||||
"ddwWriteNANDErrCnt", \
|
||||
"ddwEraseHWErrCnt", \
|
||||
"ddwEraseNANDErrCnt", \
|
||||
"addwReadBitFlipsCnt[0]", \
|
||||
"addwReadBitFlipsCnt[1]", \
|
||||
"addwReadBitFlipsCnt[2]", \
|
||||
"addwReadBitFlipsCnt[3]", \
|
||||
"addwReadBitFlipsCnt[4]", \
|
||||
"addwReadBitFlipsCnt[5]", \
|
||||
"addwReadBitFlipsCnt[6]", \
|
||||
"addwReadBitFlipsCnt[7]", \
|
||||
"addwReadBitFlipsCnt[8]", \
|
||||
"addwReadBitFlipsCnt[9]", \
|
||||
"addwReadBitFlipsCnt[10]", \
|
||||
"addwReadBitFlipsCnt[11]", \
|
||||
"addwReadBitFlipsCnt[12]", \
|
||||
"addwReadBitFlipsCnt[13]", \
|
||||
"addwReadBitFlipsCnt[14]", \
|
||||
"addwReadBitFlipsCnt[15]", \
|
||||
"addwReadBitFlipsCnt[16]", \
|
||||
"addwReadBitFlipsCnt[17]", \
|
||||
"addwReadBitFlipsCnt[18]", \
|
||||
"addwReadBitFlipsCnt[19]", \
|
||||
"addwReadBitFlipsCnt[20]", \
|
||||
"addwReadBitFlipsCnt[21]", \
|
||||
"addwReadBitFlipsCnt[22]", \
|
||||
"addwReadBitFlipsCnt[23]", \
|
||||
"addwReadBitFlipsCnt[24]", \
|
||||
"addwReadBitFlipsCnt[25]", \
|
||||
"addwReadBitFlipsCnt[26]", \
|
||||
"addwReadBitFlipsCnt[27]", \
|
||||
"addwReadBitFlipsCnt[28]", \
|
||||
"addwReadBitFlipsCnt[29]", \
|
||||
"addwReadBitFlipsCnt[30]", \
|
||||
"ddwTimeoutCnt", \
|
||||
"ddwPartialUECCCnt", \
|
||||
"ddwPartialCleanCnt", \
|
||||
"ddwReadRefreshCnt", \
|
||||
"ddwReadRetireCnt", \
|
||||
}
|
||||
|
||||
// Presented to the FMSS as an 18 word array
|
||||
typedef struct
|
||||
{
|
||||
UInt32 dwReadNoECCCorrection;
|
||||
UInt32 adwReadBitFlipsCnt[FIL_MAX_ECC_CORRECTION];
|
||||
UInt32 dwReadUncorrectableECCError;
|
||||
} CSStatistics;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Exported Function Prototype of FIL */
|
||||
/*****************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
Int32 FIL_Init(void);
|
||||
void FIL_Close(void);
|
||||
LowFuncTbl *FIL_GetFuncTbl(void);
|
||||
BOOL32 FIL_GetStruct(UInt32 dwStructType, void * pvoidStructBuffer, UInt32 * pdwStructSize);
|
||||
BOOL32 FIL_SetStruct(UInt32 dwStructType, void * pvoidStructBuffer, UInt32 dwStructSize);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _FIL_H_ */
|
||||
@@ -0,0 +1,62 @@
|
||||
#ifndef _FIL_TYPES_H_
|
||||
#define _FIL_TYPES_H_
|
||||
|
||||
#include "ANDTypes.h"
|
||||
|
||||
// physical device info (replacing stDeviceInfo)
|
||||
typedef struct
|
||||
{
|
||||
UInt32 dwDevID; /* Device ID */
|
||||
UInt16 wNumOfCS; /* number of CS */
|
||||
UInt16 wBlocksPerCS; /* Number of Blocks */
|
||||
UInt16 wPagesPerBlock; /* Pages per block */
|
||||
UInt16 wSectorsPerPage; /* Sectors per page */
|
||||
UInt16 wSpareBytesPerPage; /* Spare bytes per page */
|
||||
UInt16 wBanksPerCS;
|
||||
UInt16 wDiesPerCS;
|
||||
UInt16 wBlocksPerDie;
|
||||
UInt16 wDieStride;
|
||||
UInt16 wBlockStride;
|
||||
UInt16 wLastBlock;
|
||||
UInt16 wUserBlocksPerCS;
|
||||
|
||||
CheckInitialBadType checkInitialBadType;
|
||||
VendorSpecificType vendorSpecificType;
|
||||
UInt8 bECCThresholdBits;
|
||||
UInt8 bECCCorrectableBits;
|
||||
|
||||
// timing
|
||||
UInt8 bWriteCycleNanosecs;
|
||||
UInt8 bWriteSetupNanosecs;
|
||||
UInt8 bWriteHoldNanosecs;
|
||||
|
||||
// read cycle
|
||||
UInt8 bReadCycleNanosecs;
|
||||
UInt8 bReadSetupNanosecs;
|
||||
UInt8 bReadHoldNanosecs;
|
||||
|
||||
// read window
|
||||
UInt8 bReadDelayNanosecs;
|
||||
UInt8 bReadValidNanosecs;
|
||||
|
||||
// Additions, to keep above footprint the same
|
||||
UInt32 wNumOfBusses; /* number of busses */
|
||||
UInt32 dwBlocksPerCAU;
|
||||
UInt32 dwCAUsPerCE;
|
||||
UInt32 dwSLCPagesPerBlock;
|
||||
UInt32 dwMLCPagesPerBlock;
|
||||
UInt32 dwMatchOddEvenCAUs;
|
||||
UInt32 dwBitsPerCAUAddress;
|
||||
UInt32 dwBitsPerPageAddress;
|
||||
UInt32 dwBitsPerBlockAddress;
|
||||
UInt32 ppn;
|
||||
UInt32 dwPpnVersion;
|
||||
UInt32 toggle;
|
||||
UInt32 dwValidMetaPerLogicalPage;
|
||||
UInt32 dwTotalMetaPerLogicalPage;
|
||||
UInt32 dwLogicalPageSize;
|
||||
UInt32 dwMaxTransactionSize;
|
||||
UInt8 bAddrBitsForBitsPerCell;
|
||||
} FILDeviceInfo;
|
||||
|
||||
#endif /* _FIL_TYPES_H_ */
|
||||
@@ -0,0 +1,155 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT : Rainbow */
|
||||
/* MODULE : Virtual Flash Layer */
|
||||
/* NAME : VFL header file */
|
||||
/* FILE : VFL.h */
|
||||
/* PURPOSE : This file contains the definition and protypes of exported */
|
||||
/* functions for VFL. */
|
||||
/* */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* COPYRIGHT 2003-2005 SAMSUNG ELECTRONICS CO., LTD. */
|
||||
/* ALL RIGHTS RESERVED */
|
||||
/* */
|
||||
/* Permission is hereby granted to licensees of Samsung Electronics */
|
||||
/* Co., Ltd. products to use or abstract this computer program for the */
|
||||
/* sole purpose of implementing a product based on Samsung */
|
||||
/* Electronics Co., Ltd. products. No other rights to reproduce, use, */
|
||||
/* or disseminate this computer program, whether in part or in whole, */
|
||||
/* are granted. */
|
||||
/* */
|
||||
/* Samsung Electronics Co., Ltd. makes no representation or warranties */
|
||||
/* with respect to the performance of this computer program, and */
|
||||
/* specifically disclaims any responsibility for any damages, */
|
||||
/* special or consequential, connected with the use of this program. */
|
||||
/* */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* REVISION HISTORY */
|
||||
/* */
|
||||
/* 18-JUL-2005 [Jaesung Jung] : first writing */
|
||||
/* 31-MAR-2006 [Yangsup Lee ] : support ftl meta block wear leveling */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef _UNDER_VFL_H_
|
||||
#define _UNDER_VFL_H_
|
||||
#include "FIL.h"
|
||||
/*****************************************************************************/
|
||||
/* Type definition of checksum (confirm) state */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/* exported function prototype of VFL */
|
||||
/*****************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SIGNATURE_STYLE_BLOCKZERO_NOHEADER = 100,
|
||||
SIGNATURE_STYLE_RESERVEDBLOCK_HEADER = 101,
|
||||
SIGNATURE_STYLE_NOTSET = 250,
|
||||
} FPartSignatureStyle;
|
||||
|
||||
// Forward declare VFL
|
||||
//typedef struct _VFLFunctions VFLFunctions;
|
||||
struct _VFLFunctions;
|
||||
|
||||
#define FPART_INIT_OPTION_DEV_UNIQUE (1 << 0)
|
||||
#define FPART_INIT_OPTION_DIAG_CTRL (1 << 1)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#ifndef AND_READONLY
|
||||
BOOL32 (*WriteInitialBBT)(void);
|
||||
Int32 (*FactoryReformat)(BOOL32 Force, BOOL32 boolEraseBlockZero, UInt32 dwBootAreaSize);
|
||||
BOOL32 (*WriteDeviceUniqueInfo)(UInt8 * pabData, UInt32 dwDataBufferSize);
|
||||
BOOL32 (*WriteDiagnosticInfo)(UInt8 * pabData, UInt32 dwDataBufferSize);
|
||||
BOOL32 (*WriteSignature)(void * pvoidSignature, UInt32 dwSignatureSize);
|
||||
BOOL32 (*WriteSpecialBlock)(void * data, UInt32 data_size, UInt16 type);
|
||||
#endif // ! AND_READONLY
|
||||
BOOL32 (*Neuralize)(void);
|
||||
BOOL32 (*ReadDeviceUniqueInfo)(UInt8 * pabData, UInt32 dwDataBufferSize);
|
||||
BOOL32 (*ReadDiagnosticInfo)(UInt8 * pabData, UInt32 dwDataBufferSize);
|
||||
BOOL32 (*VerifyProductionFormat)(void);
|
||||
BOOL32 (*ReadSignature)(void * pvoidSignature, UInt32 dwSignatureSize);
|
||||
BOOL32 (*Init)(LowFuncTbl *pFILFunctions, UInt32 dwOptions);
|
||||
void (*SetSignatureStyle)(void * pvoidFPartFunctions,
|
||||
FPartSignatureStyle fpartSignatureStyle);
|
||||
BOOL32 (*validateSignatureLocation)(void * signLocationPtr );
|
||||
LowFuncTbl* (*GetLowFuncTbl)(void);
|
||||
UInt32 (*GetMinorVersion)(void);
|
||||
BOOL32 (*Format)(struct _VFLFunctions *pVFL, UInt32 dwOptions);
|
||||
BOOL32 (*AllocateSpecialBlockType)(SpecialBlockAddress *blocks, UInt16 count, UInt16 type);
|
||||
BOOL32 (*IsSpecialBlockTypeAllocated)(UInt16 type);
|
||||
BOOL32 (*MapSpecialBlocks)(SpecialBlockAddress *blocks, UInt16 *types, UInt16 *count);
|
||||
BOOL32 (*ReadSpecialBlock)(void *data, UInt32 data_size, UInt16 type);
|
||||
void (*ChangeCacheState)(BOOL32 validate);
|
||||
void* (*GetSingleCommandStruct)(void); // allow vfl and fpart to share single operation struct
|
||||
void (*Close)(void);
|
||||
} FPartFunctions;
|
||||
|
||||
void FPart_Register(FPartFunctions * pFPartFunctions);
|
||||
void PPNFPart_Register(FPartFunctions * pFPartFunctions);
|
||||
|
||||
#define PPN_FPart_MAJOR_VER (0)
|
||||
FPartFunctions *PPN_FPart_GetFunctions(void);
|
||||
|
||||
BOOL32 VFL_ReadBBT(UInt16 wCS, UInt8 * pBBT);
|
||||
BOOL32 VFL_ReadBBTWithoutSpecial(UInt16 wCS, UInt8 * pBBT);
|
||||
|
||||
/*
|
||||
|
||||
NAME
|
||||
_MarkBlockAsBadInBBT
|
||||
DESCRIPTION
|
||||
This define marks block as bad in the bbt.
|
||||
PARAMETERS
|
||||
pBBT [IN] bbt buffer
|
||||
idx [IN] block index
|
||||
RETURN VALUES
|
||||
none
|
||||
NOTES
|
||||
|
||||
*/
|
||||
|
||||
#define _MarkBlockAsBadInBBT(pBBT, idx) \
|
||||
{ \
|
||||
UInt16 dByteLocation; \
|
||||
UInt8 bBit; \
|
||||
dByteLocation = ((UInt16)(idx)) >> 3; \
|
||||
bBit = (UInt8)(~(1 << (((UInt8)(idx)) & 0x07))); \
|
||||
((UInt8 *)(pBBT))[dByteLocation] &= bBit; \
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
NAME
|
||||
_MarkBlockAsGoodInBBT
|
||||
DESCRIPTION
|
||||
This define marks block as good in the bbt.
|
||||
PARAMETERS
|
||||
pBBT [IN] bbt buffer
|
||||
idx [IN] block index
|
||||
RETURN VALUES
|
||||
none
|
||||
NOTES
|
||||
|
||||
*/
|
||||
#define _MarkBlockAsGoodInBBT(pBBT, idx) \
|
||||
{ \
|
||||
UInt16 dByteLocation; \
|
||||
UInt8 bBit; \
|
||||
dByteLocation = ((UInt16)(idx)) >> 3; \
|
||||
bBit = (1 << (((UInt8)(idx)) & 0x07)); \
|
||||
((UInt8 *)(pBBT))[dByteLocation] |= bBit; \
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _UNDER_VFL_H_ */
|
||||
@@ -0,0 +1,265 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT : Rainbow */
|
||||
/* MODULE : FTL */
|
||||
/* NAME : FTL header file */
|
||||
/* FILE : FTL.h */
|
||||
/* PURPOSE : This file contains the definition and protypes of exported */
|
||||
/* functions for FTL. */
|
||||
/* */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* COPYRIGHT 2003-2005 SAMSUNG ELECTRONICS CO., LTD. */
|
||||
/* ALL RIGHTS RESERVED */
|
||||
/* */
|
||||
/* Permission is hereby granted to licensees of Samsung Electronics */
|
||||
/* Co., Ltd. products to use or abstract this computer program for the */
|
||||
/* sole purpose of implementing a product based on Samsung */
|
||||
/* Electronics Co., Ltd. products. No other rights to reproduce, use, */
|
||||
/* or disseminate this computer program, whether in part or in whole, */
|
||||
/* are granted. */
|
||||
/* */
|
||||
/* Samsung Electronics Co., Ltd. makes no representation or warranties */
|
||||
/* with respect to the performance of this computer program, and */
|
||||
/* specifically disclaims any responsibility for any damages, */
|
||||
/* special or consequential, connected with the use of this program. */
|
||||
/* */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* REVISION HISTORY */
|
||||
/* */
|
||||
/* 19-JUL-2005 [Jaesung Jung] : first writing */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
#include "VFL.h"
|
||||
#ifndef _FTL_H_
|
||||
#define _FTL_H_
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Return value of FTL_XXX() */
|
||||
/*****************************************************************************/
|
||||
#define FTL_SUCCESS ANDErrorCodeOk
|
||||
#define FTL_CRITICAL_ERROR ANDErrorCodeHwErr
|
||||
#define FTL_USERDATA_ERROR ANDErrorCodeUserDataErr
|
||||
#define FTL_OUT_OF_RANGE_ERROR ANDErrorCodeOutOfRangeErr
|
||||
#define FTL_ALIGNMENT_ERROR ANDErrorCodeAlignmentErr
|
||||
|
||||
/*****************************************************************************/
|
||||
/* exported function prototype of FTL */
|
||||
/*****************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UInt64 lba;
|
||||
UInt64 span;
|
||||
} FTLExtent_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Int32 (*Init)(VFLFunctions *pVFLFunctions);
|
||||
Int32 (*Open)(UInt32 *pTotalScts, UInt32 * pdwSectorSize, BOOL32 nandFullFormat, BOOL32 justFormatted, UInt32 minor_ver, UInt32 dwOptions);
|
||||
|
||||
Int32 (*Read)(UInt32 nLpn, UInt32 nNumOfScts, UInt8 *pBuf);
|
||||
Int32 (*ReadSpans)(FTLExtent_t *extents, UInt32 numExtents, UInt8 *pBuf);
|
||||
void (*Close)(void);
|
||||
BOOL32 (*GetStruct)(UInt32 dwStructType, void * pvoidStructBuffer, UInt32 * pdwStructSize);
|
||||
|
||||
#ifndef AND_READONLY
|
||||
UInt32 (*ConvertUserMBtoFTLSuperblocks)(VFLFunctions *pVFLFunctions, UInt32 dwUserMBs);
|
||||
Int32 (*Write)(UInt32 nLpn, UInt32 nNumOfScts, UInt8 *pBuf, BOOL32 isStatic);
|
||||
Int32 (*Format)(UInt32 dwOptions);
|
||||
Int32 (*WearLevel)(void);
|
||||
Int32 (*IdleGC)();
|
||||
Int32 (*Unmap)(FTLExtent_t *extents, UInt32 numExtents);
|
||||
BOOL32 (*GarbageCollect)(void);
|
||||
BOOL32 (*ShutdownNotify)(BOOL32 boolMergeLogs);
|
||||
BOOL32 (*Drain)(void);
|
||||
BOOL32 (*WriteStats)(void);
|
||||
#endif
|
||||
|
||||
UInt32 (*GetMinorVersion)(void);
|
||||
} FTLFunctions;
|
||||
|
||||
void FTL_Register(FTLFunctions * pFTLFunctions);
|
||||
#if (defined (AND_SUPPORT_YAFTL) && AND_SUPPORT_YAFTL)
|
||||
void YAFTL_Register(FTLFunctions * pFTLFunctions);
|
||||
#define YAFTL_PPN_MAJOR_VER (0)
|
||||
FTLFunctions *YAFTL_PPN_Register(void);
|
||||
#define SFTL_PPN_MAJOR_VER (1)
|
||||
FTLFunctions *SFTL_PPN_Register(void);
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/* statistics gathering constants */
|
||||
/*****************************************************************************/
|
||||
|
||||
#define FTL_RC_BIN_SIZE(l) ((l)/FTL_NUM_RC_BINS)
|
||||
#define FTL_NUM_RC_BINS (100)
|
||||
|
||||
#define FTL_EC_BIN_SIZE (FTL_MAX_EC_BIN_VAL/FTL_NUM_EC_BINS)
|
||||
#define FTL_MAX_EC_BIN_VAL (5000)
|
||||
#define FTL_NUM_EC_BINS (100)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UInt32 maxValue;
|
||||
UInt32 binCount;
|
||||
UInt16 usage[0];
|
||||
} FTLBinsStruct;
|
||||
|
||||
// FTL statistics X-macro:
|
||||
// this defines all of the stats currently known to SFTL in key name / serialized
|
||||
// key number form. Stats users (parsers, savers, etc) define X_FTL_doStat to do
|
||||
// something meaningful.
|
||||
// The trivial case is the construction of s_statkey_e enum, which provides to C
|
||||
// code an enumeration of the key name to the key number.
|
||||
// A stat saver, for instance, compare a key from a blob to the key macro which
|
||||
// is currently being expanded; if they match, put into a variable inside a struct
|
||||
// that matches the name of the stat.
|
||||
// A parser, on the other hand, would convert the symbol into a C string using
|
||||
// the # preprocessor operator. It then has a string representation of the key
|
||||
// name that it can print or add to internal data structures for future use.
|
||||
//
|
||||
// Let's dissect the enum creation:
|
||||
// #undef X_FTL_doStat
|
||||
// -- this undefines the X macro, in case it was previously defined
|
||||
// #define X_FTL_doStat(_part, _val) S_STATKEY_ ## _part = (_val),
|
||||
// -- Each time X_FTL_doStat is invoked below, it will take the token, paste
|
||||
// -- S_STATKEY_ in front, and assign it the value. For instance, this:
|
||||
// -- X_FTL_doStat(lbas_read, 1)
|
||||
// -- becomes:
|
||||
// -- S_STATKEY_ ## lbas_read = (1),
|
||||
// -- which is interpreted by the preprocessor to mean:
|
||||
// -- S_STATKEY_lbas_read = (1),
|
||||
// -- Thus, we've created an enumeration without repeating the origial content.
|
||||
// typedef enum {
|
||||
// FTL_doAllStats
|
||||
// -- this invokes the X macro for all of the ones in the doAllStats list
|
||||
// S_STATKEY_VFL = 255,
|
||||
// S_STATKEY_FIL = 254,
|
||||
// -- these are special cases
|
||||
// } s_statkey_e;
|
||||
// -- and we're done! We now have something that looks like:
|
||||
// typedef enum {
|
||||
// S_STATKEY_lbas_read = (1),
|
||||
// S_STATKEY_lbas_written = (2),
|
||||
// ...
|
||||
// S_STATKEY_VFL = 255,
|
||||
// S_STATKEY_VFL = 254,
|
||||
// } s_statkey_e;
|
||||
// The neat part is the knowledge of key name/key number is centralized;
|
||||
// no repetition is required.
|
||||
|
||||
#undef X_FTL_doStat
|
||||
#define FTL_doAllStats \
|
||||
X_FTL_doStat(lbas_read, 1) \
|
||||
X_FTL_doStat(lbas_written, 2) \
|
||||
X_FTL_doStat(lbas_gc, 3) \
|
||||
X_FTL_doStat(lbas_flatten, 4) \
|
||||
X_FTL_doStat(xacts_read, 5) \
|
||||
X_FTL_doStat(xacts_write, 6) \
|
||||
X_FTL_doStat(data_gc, 7) \
|
||||
X_FTL_doStat(zero_valid_cross, 8) \
|
||||
X_FTL_doStat(valid_lbas, 9) \
|
||||
X_FTL_doStat(free_sb, 10) \
|
||||
X_FTL_doStat(data_sb, 11) \
|
||||
X_FTL_doStat(cxt_sb, 12) \
|
||||
X_FTL_doStat(dead_sb, 13) \
|
||||
X_FTL_doStat(boot_count, 14) \
|
||||
X_FTL_doStat(refresh_gcs, 15) \
|
||||
X_FTL_doStat(readCount_gcs, 16) \
|
||||
X_FTL_doStat(wearLev_gcs, 17) \
|
||||
X_FTL_doStat(shutdowns, 18) \
|
||||
X_FTL_doStat(lbas_read_1, 19) \
|
||||
X_FTL_doStat(lbas_read_2, 20) \
|
||||
X_FTL_doStat(lbas_read_3, 21) \
|
||||
X_FTL_doStat(lbas_read_4, 22) \
|
||||
X_FTL_doStat(lbas_read_5, 23) \
|
||||
X_FTL_doStat(lbas_read_6, 24) \
|
||||
X_FTL_doStat(lbas_read_7, 25) \
|
||||
X_FTL_doStat(lbas_read_8, 26) \
|
||||
X_FTL_doStat(lbas_read_over_8, 27) \
|
||||
X_FTL_doStat(lbas_write_1, 28) \
|
||||
X_FTL_doStat(lbas_write_2, 29) \
|
||||
X_FTL_doStat(lbas_write_3, 30) \
|
||||
X_FTL_doStat(lbas_write_4, 31) \
|
||||
X_FTL_doStat(lbas_write_5, 32) \
|
||||
X_FTL_doStat(lbas_write_6, 33) \
|
||||
X_FTL_doStat(lbas_write_7, 34) \
|
||||
X_FTL_doStat(lbas_write_8, 35) \
|
||||
X_FTL_doStat(lbas_write_over_8, 36) \
|
||||
X_FTL_doStat(L2V_pool_free, 37) \
|
||||
X_FTL_doStat(L2V_pool_count, 38) \
|
||||
X_FTL_doStat(lbas_written_static, 39) \
|
||||
X_FTL_doStat(lbas_written_dynamic, 40) \
|
||||
X_FTL_doStat(unclean_boot_count, 41) \
|
||||
X_FTL_doStat(span_xacts_read, 42) \
|
||||
X_FTL_doStat(span_freebies_read, 43) \
|
||||
// blank
|
||||
|
||||
#undef X_FTL_doStat
|
||||
#define X_FTL_doStat(_part, _val) S_STATKEY_ ## _part = (_val),
|
||||
typedef enum {
|
||||
FTL_doAllStats
|
||||
S_STATKEY_VFL = 255,
|
||||
S_STATKEY_FIL = 254,
|
||||
} s_statkey_e;
|
||||
#undef X_FTL_doStat
|
||||
|
||||
#define FTL_makeStatParser(_fname, _VFLFunc, _FILFunc) \
|
||||
void (_fname)(const UInt8 *buf, UInt32 bufSize) \
|
||||
{ \
|
||||
UInt32 len; \
|
||||
UInt32 key, size; \
|
||||
UInt32 *buf32; \
|
||||
UInt64 val64; \
|
||||
\
|
||||
if (bufSize < sizeof(len)) \
|
||||
return; \
|
||||
\
|
||||
len = *(UInt32*)buf; \
|
||||
buf += sizeof(len); \
|
||||
bufSize -= sizeof(len); \
|
||||
\
|
||||
size = (UInt32)(-2); \
|
||||
while (len--) { \
|
||||
buf += (size + 2) * sizeof(UInt32); /* for prior round */ \
|
||||
bufSize -= (size + 2) * sizeof(UInt32); \
|
||||
if (bufSize < ((2 * sizeof(UInt32)) + sizeof(UInt64))) \
|
||||
break; \
|
||||
/* Load key/size/val */ \
|
||||
buf32 = (UInt32*)buf; \
|
||||
key = buf32[0]; \
|
||||
size = buf32[1]; \
|
||||
val64 = *(UInt64*)(&buf32[2]); \
|
||||
\
|
||||
FTL_doAllStats \
|
||||
\
|
||||
if ((bufSize - (2 * sizeof(UInt32))) < size) \
|
||||
break; \
|
||||
\
|
||||
/* Got here--wasn't caught be easy filter above, so must be some other blob */ \
|
||||
if (0 == key) { \
|
||||
buf += sizeof(UInt32); \
|
||||
continue; \
|
||||
} \
|
||||
if (S_STATKEY_VFL == key) { \
|
||||
(_VFLFunc)(AND_STRUCT_VFL_STATISTICS, &buf32[2], size*sizeof(UInt32)); \
|
||||
continue; \
|
||||
} \
|
||||
if (S_STATKEY_FIL == key) { \
|
||||
(_FILFunc)(AND_STRUCT_VFL_FILSTATISTICS, &buf32[2], size*sizeof(UInt32)); \
|
||||
continue; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _FTL_H_ */
|
||||
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
* Copyright (c) 2010 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.
|
||||
*/
|
||||
|
||||
#ifndef _PPN_FIL_H_
|
||||
#define _PPN_FIL_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "FILTypes.h"
|
||||
|
||||
typedef UInt8 PPNStatusType;
|
||||
#define PPN_READ_STATUS_INVALID_DATA (((PPNStatusType)1) << 0)
|
||||
#define PPN_READ_STATUS_REFRESH (((PPNStatusType)1) << 1)
|
||||
#define PPN_READ_STATUS_RETIRE (((PPNStatusType)1) << 2)
|
||||
#define PPN_READ_STATUS_CLEAN (((PPNStatusType)1) << 3)
|
||||
#define PPN_READ_STATUS_GEB (((PPNStatusType)1) << 4)
|
||||
#define PPN_READ_STATUS_VALID (((PPNStatusType)1) << 6)
|
||||
#define PPN_READ_STATUS_WRONG_BITS_PER_CELL (((PPNStatusType)1) << 7)
|
||||
|
||||
#define PPN_OTHERS_STATUS_OP_FAILED (((PPNStatusType)1) << 0)
|
||||
#define PPN_OTHERS_STATUS_NOT_SUPPORTED (((PPNStatusType)1) << 2)
|
||||
#define PPN_OTHERS_STATUS_GEB (((PPNStatusType)1) << 4)
|
||||
#define PPN_OTHERS_STATUS_VALID (((PPNStatusType)1) << 6)
|
||||
|
||||
#if !(defined(AND_READONLY)) || AND_SUPPORT_NVRAM
|
||||
#define PPN_PROGRAM_STATUS_FAIL (((PPNStatusType)1) << 0)
|
||||
#define PPN_PROGRAM_STATUS_NOT_PROGRAMMED (((PPNStatusType)1) << 2)
|
||||
|
||||
#define PPN_PROGRAM_STATUS_GEB (((PPNStatusType)1) << 4)
|
||||
|
||||
#define PPN_ERASE_STATUS_FAIL (((PPNStatusType)1) << 0)
|
||||
#define PPN_ERASE_STATUS_RETIRE (((PPNStatusType)1) << 2)
|
||||
#define PPN_ERASE_STATUS_GEB (((PPNStatusType)1) << 4)
|
||||
#endif // !(defined(AND_READONLY)) || AND_SUPPORT_NVRAM
|
||||
|
||||
typedef UInt32 PPNOptions;
|
||||
#define PPN_OPTIONS_REPORT_HEALTH (((UInt32)1) << 0)
|
||||
#define PPN_OPTIONS_GET_PAGE_RMA_INFO (((UInt32)1) << 1)
|
||||
|
||||
// simulator debug options (allocate from the end)
|
||||
#if (defined (AND_SIMULATOR) && AND_SIMULATOR)
|
||||
#define PPN_OPTIONS_IGNORE_BAD_BLOCK (((UInt32)1) << 31)
|
||||
#define PPN_OPTIONS_GENERATE_BAD_BLOCK (((UInt32)1) << 30)
|
||||
#define PPN_OPTIONS_TAKE_SNAPSHOT (((UInt32)1) << 29)
|
||||
#else
|
||||
#define PPN_OPTIONS_IGNORE_BAD_BLOCK (0) // do not set any bits if we are running outside the simulator
|
||||
#define PPN_OPTIONS_GENERATE_BAD_BLOCK (0) // do not set any bits if we are running outside the simulator
|
||||
#define PPN_OPTIONS_TAKE_SNAPSHOT (0) // do not set any bits if we are running outside the simulator
|
||||
#endif
|
||||
|
||||
#define PPN_NO_OPTIONS (0)
|
||||
|
||||
typedef UInt32 PPNCommand;
|
||||
#define PPN_COMMAND_NONE (0UL)
|
||||
#define PPN_COMMAND_READ (1UL)
|
||||
#if !(defined(AND_READONLY)) || AND_SUPPORT_NVRAM || WMR_IBOOT_WRITE_ENABLE
|
||||
#define PPN_COMMAND_PROGRAM (2UL)
|
||||
#define PPN_COMMAND_ERASE (3UL)
|
||||
#endif // !(defined(AND_READONLY)) || AND_SUPPORT_NVRAM
|
||||
#define PPN_COMMAND_CAUBBT (4UL)
|
||||
|
||||
#define PPN_MAX_CES_PER_BUS 2
|
||||
#define PPN_MAX_PAGES_PER_CE 128
|
||||
#define PPN_MAX_PAGES 128
|
||||
|
||||
#define PPN_MAX_MEM_BUFFERS 256
|
||||
|
||||
#define PPN_VERSION_1_0_0 (0x00010000)
|
||||
#define PPN_VERSION_1_0_3 (0x00010003)
|
||||
#define PPN_VERSION_1_5_0 (0x00010500)
|
||||
#define PPN_VERSION_2_0_0 (0x00020000)
|
||||
#define PPN_VERSION_ERROR (0x00FEFEFE)
|
||||
#define PPN_VERSION_BAD_FW (0x00FFFFFF)
|
||||
#define PPN_VERSION_UNSUPPORTED PPN_VERSION_2_0_0
|
||||
|
||||
typedef UInt16 ChipEnableType;
|
||||
typedef UInt8 ChipEnableIndexType;
|
||||
typedef UInt32 PageAddressType;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UInt16 length;
|
||||
UInt16 column;
|
||||
PageAddressType row;
|
||||
} RowColLenAddressType;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
FILDeviceInfo *device_info;
|
||||
void *handle; //opaque to caller
|
||||
// at least for now, i am adding a bus identifier
|
||||
UInt16 bus_num;
|
||||
} BusContext;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UInt16 offset; // offset inside the mem_entry
|
||||
UInt8 idx; // what mem entry this is in
|
||||
} PPNMemoryIndex;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *data;
|
||||
void *meta;
|
||||
UInt16 num_of_lbas; // lba is a 4KB chunk - limited to 255 entries
|
||||
} PPNMemoryEntry;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
ChipEnableType ce;
|
||||
UInt16 pages;
|
||||
UInt16 offset;
|
||||
} PPNCommandCeInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
RowColLenAddressType addr;
|
||||
ChipEnableIndexType ceIdx;
|
||||
UInt8 lbas;
|
||||
PPNStatusType status;
|
||||
} PPNCommandEntry;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// This section is shared between the A8/A9 and the IOP.
|
||||
|
||||
PPNCommand command;
|
||||
PPNOptions options;
|
||||
UInt16 num_pages;
|
||||
UInt16 lbas;
|
||||
PPNStatusType page_status_summary; // logical OR of all page statuses
|
||||
|
||||
PPNCommandCeInfo ceInfo[PPN_MAX_CES_PER_BUS];
|
||||
PPNCommandEntry entry[PPN_MAX_PAGES];
|
||||
|
||||
// This section is used by the A8/A9 only
|
||||
|
||||
BusContext context;
|
||||
|
||||
PPNMemoryIndex mem_index[PPN_MAX_PAGES];
|
||||
PPNMemoryEntry mem_buffers[PPN_MAX_MEM_BUFFERS];
|
||||
UInt16 mem_buffers_count;
|
||||
} PPNCommandStruct;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
UInt16 channel;
|
||||
ChipEnableIndexType chip_enable_idx;
|
||||
ChipEnableType physical_chip_enable;
|
||||
} PPNChipEnableStruct;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _PPN_FIL_H_ */
|
||||
@@ -0,0 +1,171 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* COMPONENT : Rainbow */
|
||||
/* MODULE : Virtual Flash Layer */
|
||||
/* NAME : VFL header file */
|
||||
/* FILE : VFL.h */
|
||||
/* PURPOSE : This file contains the definition and protypes of exported */
|
||||
/* functions for VFL. */
|
||||
/* */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* COPYRIGHT 2003-2005 SAMSUNG ELECTRONICS CO., LTD. */
|
||||
/* ALL RIGHTS RESERVED */
|
||||
/* */
|
||||
/* Permission is hereby granted to licensees of Samsung Electronics */
|
||||
/* Co., Ltd. products to use or abstract this computer program for the */
|
||||
/* sole purpose of implementing a product based on Samsung */
|
||||
/* Electronics Co., Ltd. products. No other rights to reproduce, use, */
|
||||
/* or disseminate this computer program, whether in part or in whole, */
|
||||
/* are granted. */
|
||||
/* */
|
||||
/* Samsung Electronics Co., Ltd. makes no representation or warranties */
|
||||
/* with respect to the performance of this computer program, and */
|
||||
/* specifically disclaims any responsibility for any damages, */
|
||||
/* special or consequential, connected with the use of this program. */
|
||||
/* */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* REVISION HISTORY */
|
||||
/* */
|
||||
/* 18-JUL-2005 [Jaesung Jung] : first writing */
|
||||
/* 31-MAR-2006 [Yangsup Lee ] : support ftl meta block wear leveling */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef _VFL_H_
|
||||
#define _VFL_H_
|
||||
#include "FPart.h"
|
||||
#include "VFLBuffer.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Return value of VFL_XXX() */
|
||||
/*****************************************************************************/
|
||||
#define VFL_SUCCESS ANDErrorCodeOk
|
||||
#define VFL_SUCCESS_CLEAN ANDErrorCodeCleanOk
|
||||
#define VFL_CRITICAL_ERROR ANDErrorCodeHwErr
|
||||
#define VFL_U_ECC_ERROR ANDErrorCodeUserDataErr
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Type definition of checksum (confirm) state */
|
||||
/*****************************************************************************/
|
||||
|
||||
/*****************************************************************************/
|
||||
/* exported function prototype of VFL */
|
||||
/*****************************************************************************/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
#define VFL_SPANS_MAX (128)
|
||||
|
||||
// read result flags - 32 Bit
|
||||
#define VFL_READ_STATUS_REFRESH (1 << 0)
|
||||
#define VFL_READ_STATUS_RETIRE (1 << 1)
|
||||
#define VFL_READ_STATUS_UECC (1 << 2) // UECC = invalid data TRUE and clean FALSE
|
||||
#define VFL_READ_STATUS_CLEAN (1 << 3) // UECC = invalid data TRUE and clean TRUE
|
||||
#define VFL_READ_STATUS_VALID_DATA (1 << 4) // at least one of the pages had valid data
|
||||
#define VFL_READ_STATUS_UNIDENTIFIED (1 << 5) // at least one status was something we do not expect
|
||||
#define VFL_READ_STATUS_ERRS (VFL_READ_STATUS_UECC | VFL_READ_STATUS_RETIRE | VFL_READ_STATUS_REFRESH)
|
||||
#define VFL_READ_STATUS_ALL (0xFFFFFFFF)
|
||||
|
||||
typedef UInt32 VFLReadStatusType;
|
||||
|
||||
typedef void (*VFL_ReadSpansCB_t)(UInt32 vba, VFLReadStatusType status, UInt8 *meta);
|
||||
typedef struct
|
||||
{
|
||||
BOOL32 bDisableWhitening;
|
||||
BOOL32 bMarkECCForScrub;
|
||||
UInt32 vba[VFL_SPANS_MAX];
|
||||
UInt32 count[VFL_SPANS_MAX];
|
||||
UInt8 *data[VFL_SPANS_MAX];
|
||||
UInt8 *meta[VFL_SPANS_MAX];
|
||||
UInt32 len;
|
||||
VFL_ReadSpansCB_t cb;
|
||||
UInt32 cbOpt;
|
||||
VFLReadStatusType op_status;
|
||||
} VFL_ReadSpans_t;
|
||||
|
||||
typedef struct _VFLFunctions
|
||||
{
|
||||
#ifndef AND_READONLY
|
||||
Int32 (*Format)(UInt32 dwBootAreaSize, UInt32 dwOptions);
|
||||
BOOL32 (*AllocateSpecialBlock)(SpecialBlockAddress *allocated_block, UInt16 type);
|
||||
Int32 (*WriteSinglePage)(UInt32 nVpn, Buffer *pBuf, BOOL32 boolReplaceBlockOnFail, BOOL32 bDisableWhitening);
|
||||
Int32 (*Erase)(UInt16 wVbn, BOOL32 bReplaceOnFail);
|
||||
Int32 (*ChangeFTLCxtVbn)(UInt16 *aFTLCxtVbn);
|
||||
BOOL32 (*WriteMultiplePagesInVb)
|
||||
(UInt32 dwVpn, UInt16 wNumPagesToWrite,
|
||||
UInt8 * pbaData, UInt8 * pbaSpare, BOOL32 boolReplaceBlockOnFail, BOOL32 bDisableWhitening);
|
||||
BOOL32 (*MarkBlockAsGrownBad)(SpecialBlockAddress *allocated_block);
|
||||
|
||||
#if AND_SUPPORT_BLOCK_BORROWING
|
||||
BOOL32 (*BorrowSpareBlock)(UInt32 *pdwPhysicalCE, UInt32 *pdwPhysicalBlock, UInt16 wType);
|
||||
#endif //AND_SUPPORT_BLOCK_BORROWING
|
||||
|
||||
BOOL32 (*ProgramMultipleVbas)(UInt32 vba, UInt16 count, UInt8 *data, UInt8 *meta,
|
||||
BOOL32 replaceOnPfail, BOOL32 disableWhitening);
|
||||
#endif // ! AND_READONLY
|
||||
|
||||
Int32 (*Init)(FPartFunctions * pFPartFunctions);
|
||||
Int32 (*Open)(UInt32 dwBootAreaSize, UInt32 minor_ver, UInt32 dwOptions);
|
||||
void (*Close)(void);
|
||||
BOOL32 (*ReadMultiplePagesInVb)
|
||||
(UInt16 wVbn, UInt16 wStartPOffset,
|
||||
UInt16 wNumPagesToRead,
|
||||
UInt8 * pbaData,
|
||||
UInt8 * pbaSpare,
|
||||
BOOL32 * pboolNeedRefresh,
|
||||
UInt8 * pabSectorStats,
|
||||
BOOL32 bDisableWhitening);
|
||||
BOOL32 (*ReadScatteredPagesInVb)
|
||||
(UInt32 * padwVpn,
|
||||
UInt16 wNumPagesToRead,
|
||||
UInt8 * pbaData, UInt8 * pbaSpare,
|
||||
BOOL32 * pboolNeedRefresh,
|
||||
UInt8 * pabSectorStats,
|
||||
BOOL32 bDisableWhitening, Int32 *actualStatus);
|
||||
Int32 (*ReadSinglePage)(UInt32 nVpn, Buffer *pBuf,
|
||||
BOOL32 bCleanCheck,
|
||||
BOOL32 bMarkECCForScrub,
|
||||
BOOL32 * pboolNeedRefresh,
|
||||
UInt8 * pabSectorStats,
|
||||
BOOL32 bDisableWhitening);
|
||||
UInt16* (*GetFTLCxtVbn)(void);
|
||||
BOOL32 (*GetStruct)(UInt32 dwStructType,
|
||||
void * pvoidStructBuffer,
|
||||
UInt32 * pdwStructSize);
|
||||
BOOL32 (*SetStruct)(UInt32 dwStructType,
|
||||
void * pvoidStructBuffer,
|
||||
UInt32 dwStructSize);
|
||||
|
||||
UInt32 (*GetDeviceInfo)(UInt32 dwParamType);
|
||||
UInt32 (*GetMinorVersion)(void);
|
||||
UInt16 (*GetVbasPerVb)(UInt16 wVbn);
|
||||
|
||||
|
||||
// new func - read
|
||||
VFLReadStatusType (*ReadMultipleVbas)(UInt32 vba, UInt16 count, UInt8 *data, UInt8 *meta,
|
||||
BOOL32 bDisableWhitening, BOOL32 bMarkECCForScrub);
|
||||
|
||||
void (*ReadSpansInit)(VFL_ReadSpans_t *s, VFL_ReadSpansCB_t cb, UInt32 cbOpt, BOOL32 bDisableWhitening, BOOL32 bMarkECCForScrub);
|
||||
void (*ReadSpansAdd)(VFL_ReadSpans_t *s, UInt32 vba, UInt32 count, UInt8 *data, UInt8 *meta);
|
||||
VFLReadStatusType (*ReadSpans)(VFL_ReadSpans_t *s);
|
||||
|
||||
} VFLFunctions;
|
||||
|
||||
void VSVFL_Register(VFLFunctions * pVFL_Functions);
|
||||
void VFL_Register(VFLFunctions * pVFL_Functions);
|
||||
void PPNVFL_Register(VFLFunctions * pVFL_Functions);
|
||||
|
||||
#define PPN_VFL_MAJOR_VER (1)
|
||||
VFLFunctions * PPN_VFL_GetFunctions(void);
|
||||
#define PPN_SVFL_MAJOR_VER (2)
|
||||
VFLFunctions * PPN_SVFL_GetFunctions(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _VFL_H_ */
|
||||
@@ -0,0 +1,97 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* PROJECT : Rainbow */
|
||||
/* MODULE : Whimory configuration definition heade file */
|
||||
/* NAME : Whimory configuration definition */
|
||||
/* FILE : WMRConfig.h */
|
||||
/* PURPOSE : Configuation definition for Whimory */
|
||||
/* */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* COPYRIGHT 2003-2005, SAMSUNG ELECTRONICS CO., LTD. */
|
||||
/* ALL RIGHTS RESERVED */
|
||||
/* */
|
||||
/* Permission is hereby granted to licensees of Samsung Electronics */
|
||||
/* Co., Ltd. products to use or abstract this computer program for the */
|
||||
/* sole purpose of implementing a product based on Samsung */
|
||||
/* Electronics Co., Ltd. products. No other rights to reproduce, use, */
|
||||
/* or disseminate this computer program, whether in part or in whole, */
|
||||
/* are granted. */
|
||||
/* */
|
||||
/* Samsung Electronics Co., Ltd. makes no representation or warranties */
|
||||
/* with respect to the performance of this computer program, and */
|
||||
/* specifically disclaims any responsibility for any damages, */
|
||||
/* special or consequential, connected with the use of this program. */
|
||||
/* */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* REVISION HISTORY */
|
||||
/* */
|
||||
/* 12-JUL-2005 [Jaesung Jung] : first writing */
|
||||
/* 03-NOV-2005 [Yangsup Lee ] : Add wear-leveling algorithm */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef _WMR_CONFIG_H_
|
||||
#define _WMR_CONFIG_H_
|
||||
|
||||
#include "WMRFeatures.h"
|
||||
|
||||
#if (defined (AND_SUPPORT_2ND_BOOTLOADER) && AND_SUPPORT_2ND_BOOTLOADER && defined (AND_SIGNATURE_IN_BLOCK_ZERO) && AND_SIGNATURE_IN_BLOCK_ZERO)
|
||||
#error "AND_SUPPORT_2ND_BOOTLOADER & AND_SIGNATURE_IN_BLOCK_ZERO can't both be defined"
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Global Config Definition which should be shared by FTL, VFL, FIL */
|
||||
/*****************************************************************************/
|
||||
#define WMR_BOOT_AREA_DEFAULT_SIZE (1) /* this will be value used unless unit does boot-from-nand */
|
||||
#define AND_MAX_BANKS_PER_CS (8)
|
||||
#define WMR_SECTOR_SIZE (512) /* the size of sector */
|
||||
#if defined(AND_SUPPORT_YAFTL) && AND_SUPPORT_YAFTL
|
||||
#define WMR_NUM_BUFFERS (10) /* the number of buffers - used by VFLBuffer */
|
||||
#else /* defined(AND_SUPPORT_YAFTL) && AND_SUPPORT_YAFTL */
|
||||
#if !(defined(AND_READONLY) && AND_READONLY)
|
||||
#define WMR_NUM_BUFFERS (5) /* the number of buffers - used by VFLBuffer */
|
||||
#elif !(defined(WMR_DISABLE_FTL_RECOVERY) && WMR_DISABLE_FTL_RECOVERY) || \
|
||||
(defined(AND_COLLECT_STATISTICS) && AND_COLLECT_STATISTICS)
|
||||
#define WMR_NUM_BUFFERS (2) /* the number of buffers - used by VFLBuffer */
|
||||
#else
|
||||
#define WMR_NUM_BUFFERS (1) /* Used in _FTLRead and VFL_Open */
|
||||
#endif
|
||||
#endif /* defined(AND_SUPPORT_YAFTL) && AND_SUPPORT_YAFTL */
|
||||
|
||||
#define WMR_SECTORS_PER_PAGE_MIN (4)
|
||||
|
||||
#define WMR_MAX_PAGES_PER_BLOCK (0x100)
|
||||
|
||||
#define WMR_MAX_VB (18000) /* the maximum number of virtual block*/
|
||||
|
||||
#define WMR_MAX_RESERVED_SIZE (820) /* the maximum count of reserved blocks */
|
||||
|
||||
#define FTL_METAWEARLEVEL_RATIO (10) // consider bringing this number up
|
||||
#define WMR_WEAR_LEVEL_FREQUENCY (20)
|
||||
#define WMR_WEAR_LEVEL_FREQUENCY_DELAY (300)
|
||||
#define WMR_WEAR_LEVEL_MAX_DIFF (5)
|
||||
#define WMR_WEAR_LEVEL_MIN_EC_VALUE (3)
|
||||
|
||||
#define DEFAULT_NUMBER_OF_SPECIAL_BLOCKS_CS0 (3)
|
||||
#define NUMBER_OF_SPECIAL_BLOCKS_NOTCS0 (2)
|
||||
|
||||
#define FTL_READ_REFRESH_LIST_SIZE (5)
|
||||
#define FTL_RC_TRESHOLD (10000) // to review for real world drivers
|
||||
#define FTL_READS_SINCE_LAST_REFRESH_MARK_TRASHOLD (200)
|
||||
|
||||
#define YAFTL_RC_THRESHOLD (0xfffd)
|
||||
#define YAFTL_RC_MULTIPLIER (16)
|
||||
|
||||
#define S_RC_THRESHOLD (250000)
|
||||
|
||||
#define BYTES_PER_METADATA_RAW (12)
|
||||
|
||||
#define VSVFL_USER_BLKS_PER_1K (976)
|
||||
#define PPNVFL_USER_BLKS_PER_256B (244)
|
||||
#define VFL_USER_BLKS_PER_1K (968)
|
||||
#define FTL_CXT_SECTION_SIZE (3) // number of FTL Cxt locations are saved by VFL
|
||||
#define WMR_BLOCK_ADDRESS_MSB (1<<15)
|
||||
|
||||
#endif /* _WMR_CONFIG_H_ */
|
||||
@@ -0,0 +1,22 @@
|
||||
// Copyright (C) 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.
|
||||
//
|
||||
//
|
||||
|
||||
#include "WMRTypes.h"
|
||||
#include "FTL.h"
|
||||
#include "VFL.h"
|
||||
#include "FIL.h"
|
||||
|
||||
BOOL32 FIL_Test(void);
|
||||
|
||||
BOOL32 WMR_FTL_Test(FTLFunctions *ftl);
|
||||
BOOL32 WMR_VFL_Test(VFLFunctions *vfl);
|
||||
BOOL32 WMR_FIL_Test(LowFuncTbl *fil);
|
||||
BOOL32 WMR_FPart_Test(FPartFunctions *fpart);
|
||||
Reference in new issue
Block a user