NVIDIA mNAND library
Description: This files declares the interface for using mNAND with encapsulation of different vendor commands for health related information.
Definition in file nvmnand.h.
Go to the source code of this file.
Data Structures | |
struct | __mnand_block_info |
information per block More... | |
union | __mnand_life_time_element |
information on life time element More... | |
struct | __mnand_life_time_info |
information on life time More... | |
union | __mnand_refresh_element |
information on refresh element More... | |
struct | __mnand_refresh_progress |
information on refresh progress More... | |
struct | __mnand_refresh_properties |
information on refresh properties More... | |
struct | __mnand_ages_element |
summary of ages More... | |
struct | __mnand_wr_info |
Holds the information that indicates the host cumulative written data (units of 100MB). More... | |
struct | mnand_ufs_write_erase_amplification |
Gives the erase/write amplification value for the device. More... | |
struct | __mnand_summary_element |
summary of given block type (or region) More... | |
struct | __mnand_summary_info |
aggregation of summaries More... | |
struct | __mnand_cid_info |
CID - eMMC only. More... | |
struct | __mnand_csd_info |
CSD - eMMC only. More... | |
struct | __mnand_ext_csd_info |
EXT CSD - eMMC only. More... | |
struct | __mnand_device_desc_info |
DEVICE DESC - UFS Only. More... | |
struct | __mnand_config_desc_info |
CONFIG DESC - UFS Only. More... | |
struct | __mnand_geo_desc_info |
GEOMETRY DESC - UFS Only. More... | |
struct | __mnand_unit_desc_info |
UNIT DESC - UFS Only. More... | |
struct | __mnand_mmc_geo_info |
MMC GEOMETRY INFO - eMMC only. More... | |
struct | __mnand_ufs_geo_info |
UFS GEOMETRY INFO - UFS only. More... | |
union | __mnand_geo_info |
GEOMETRY INFO. More... | |
struct | __mnand_lu_info |
LOGICAL UNIT INFO - UFS Only. More... | |
struct | __mnand_chip |
mNAND chip information More... | |
struct | __mnand_ufs_query_req |
UFS Query Request Info (UFS Only) More... | |
struct | __mnand_ufs_combo_query_req |
UFS Combo Query Request Info (UFS Only) More... | |
Macros | |
#define | MAX_ERASE_CNT 0xFFFF |
max. More... | |
#define | SECTOR_SZ 512 |
sector size More... | |
#define | MNAND_READ_CACHE_ENABLE (1 << 0) |
Read/Write Cache enable bits used in cache handling API. More... | |
#define | MNAND_WRITE_CACHE_ENABLE (1 << 1) |
#define | MAX_FW_STR_LEN (32U) |
Maximum length of the firmware string. More... | |
#define | MAX_PRN_STR_LEN (64U) |
Maximum length of the product name string. More... | |
#define | MNAND_UNKNOWN_BLOCK (1 << 0) |
#define | MNAND_MLC_BLOCK (1 << 1) |
#define | MNAND_SLC_BLOCK (1 << 2) |
#define | MNAND_UNKNOWN_BAD_BLOCK (1 << 8) |
#define | MNAND_MANF_BAD_BLOCK (1 << 9) |
#define | MNAND_RUNTIME_BAD_BLOCK (1 << 10) |
#define | MNAND_SYSTEM_BLOCK (1 << 11) |
#define | MNAND_LIFETIME_INVALID (1 << 0) |
#define | MNAND_LIFETIME_IN_BLOCK (1 << 1) |
#define | MNAND_LIFETIME_IN_PERCENT (1 << 2) |
#define | MNAND_RFSH_PROG_INVALID (1 << 0) |
#define | MNAND_RFSH_PROG_IN_BLOCK (1 << 1) |
#define | MNAND_RFSH_PROG_IN_PERCENT (1 << 2) |
Functions | |
static int | mnand_is_valid_block (mnand_block_info *blk) |
Return the validity of the block, given the pointer of block info. More... | |
static int | mnand_is_bad_block (mnand_block_info *blk) |
Determine if given block is a bad block. More... | |
static int | mnand_is_usable_block (mnand_block_info *blk) |
Determine if given block is a usable block. More... | |
static int | mnand_is_usable_block_with_type (mnand_block_info *blk, uint16_t blk_type) |
Determine if given block is a usable block, and matches given block type. More... | |
static int | mnand_is_slc_block (mnand_block_info *blk) |
Determine if given block is in SLC region. More... | |
static int | mnand_is_mlc_block (mnand_block_info *blk) |
Determine if given block is in MLC region. More... | |
static int | mnand_is_summary_available (mnand_chip *chip) |
Return if the summary is available. More... | |
static int | mnand_is_smart_summary_available (mnand_chip *chip) |
Return if the smart summary is available. More... | |
static int | mnand_is_refresh_available (mnand_chip *chip) |
Return if force refresh is available. More... | |
static int | mnand_is_block_info_available (mnand_chip *chip) |
Return if the block info is available. More... | |
static MNAND_STORAGE_TYPE | mnand_get_storage_type (mnand_chip *chip) |
Return mnand storage type. More... | |
MNAND_STATUS | mnand_get_bkops_en (mnand_chip *chip, uint8_t *enabled) |
Return the status of BKOPS_EN bit. More... | |
MNAND_STATUS | mnand_get_bkops_status (mnand_chip *chip, uint8_t *stat) |
Return the status of BKOPS. More... | |
MNAND_STATUS | mnand_set_bkops_en (mnand_chip *chip, uint8_t enable) |
set the BKOPS_EN bit in ext_csd Note: BNKOPS_EN is a OTP, once programmed can't change the value. More... | |
MNAND_STATUS | mnand_set_bkops_start (mnand_chip *chip) |
Mark the start of BKOPS. More... | |
MNAND_STATUS | mnand_enable_power_off_notification (mnand_chip *chip) |
Enable power-off notification. More... | |
MNAND_STATUS | mnand_send_power_off_notification (mnand_chip *chip) |
Send power-off notification. More... | |
MNAND_STATUS | mnand_open (const char *devname, mnand_chip *chip) |
"Opening" the mNAND chip. More... | |
MNAND_STATUS | mnand_close (mnand_chip *chip) |
"Closing" (aka releasing) the mNAND chip. More... | |
MNAND_STATUS | mnand_bind (int fd, mnand_chip *chip) |
"Binding" the mNAND chip. More... | |
MNAND_STATUS | mnand_unbind (mnand_chip *chip) |
"Unbinding" (aka releasing) the mNAND chip. More... | |
MNAND_STATUS | mnand_update_cid (mnand_chip *chip) |
Updating the CID field inside mNAND chip handle. More... | |
MNAND_STATUS | mnand_update_csd (mnand_chip *chip) |
Updating the CSD field inside mNAND chip handle. More... | |
MNAND_STATUS | mnand_update_xcsd (mnand_chip *chip) |
Updating the EXT CSD field inside mNAND chip handle. More... | |
MNAND_STATUS | mnand_update_card_status (mnand_chip *chip) |
Updating the card status field inside mNAND chip handle. More... | |
MNAND_STATUS | mnand_update_block_info (mnand_chip *chip) |
Updating the list of block info inside mNAND chip handle. More... | |
MNAND_STATUS | mnand_update_summary_info (mnand_chip *chip) |
Updating the summary info inside mNAND chip handle. More... | |
MNAND_STATUS | mnand_update_smart_summary_info (mnand_chip *chip) |
Updating the smart summary info inside mNAND chip handle. More... | |
MNAND_STATUS | mnand_check_eol_status (mnand_chip *chip, MNAND_EOL_STATUS *eol_status) |
Checking EOL status. More... | |
MNAND_STATUS | mnand_send_refresh (mnand_chip *chip, uint8_t block_type, int num_blocks, uint32_t rfsh_unit_time_us, mnand_refresh_progress *progress) |
Send "refresh" command to the mNAND chip. More... | |
MNAND_STATUS | mnand_extract_age_info (mnand_chip *chip, int block_type, uint64_t *total_age, int *blk_count, double *avg_age) |
Extract age info from the mNAND chip. More... | |
MNAND_STATUS | mnand_get_refresh_progress (mnand_chip *chip, double *rfsh_progress) |
Extract refresh progress from the mNAND chip. More... | |
MNAND_STATUS | mnand_extract_life_time_info (mnand_chip *chip, mnand_life_time_info *life_time_info) |
Extract spare count info from the mNAND chip. More... | |
MNAND_STATUS | mnand_set_cache_en (mnand_chip *chip, uint8_t enable) |
Enable/Disable cache on mnand. More... | |
MNAND_STATUS | mnand_flush_cache (mnand_chip *chip) |
Flush cache on mnand. More... | |
int | mnand_read_sectors_virt (mnand_chip *chip, unsigned int start_sector, unsigned int sector_cnt, void *virtaddr) |
Reading data sectors into given buffer (pointed by virtual address). More... | |
int | mnand_read_sectors_phys (mnand_chip *chip, unsigned int start_sector, unsigned int sector_cnt, off_t physaddr) |
Reading data sectors into given buffer (pointed by physical address). More... | |
MNAND_STATUS | mnand_trim_all (mnand_chip *chip) |
Trimming the whole device. More... | |
MNAND_STATUS | mnand_get_cache_en (mnand_chip *chip, uint8_t *enabled) |
Determine if eMMC cache is enabled. More... | |
MNAND_STATUS | mnand_switch_cmd (mnand_chip *chip, uint8_t index, uint8_t value, char *errmsg_prepend) |
Send mnand switch cmd to mmc to set EXT CSD register. More... | |
MNAND_STATUS | mnand_get_geo_info (mnand_chip *chip, mnand_geo_info *geo_info) |
Extract mnand geometry info. More... | |
MNAND_STATUS | mnand_get_lu_info (mnand_chip *chip, uint32_t lun, mnand_lu_info *lu_info) |
get mnand lu info (UFS only) More... | |
MNAND_STATUS | mnand_get_current_lun (mnand_chip *chip, uint32_t *lun) |
get mnand current lun (UFS only) More... | |
MNAND_STATUS | mnand_send_combo_query_req (mnand_chip *chip, mnand_ufs_query_req *query_req, uint8_t num_cmds, uint8_t need_cq_empty, uint8_t ret_on_error) |
Send mnand combo query request (UFS only) More... | |
MNAND_STATUS | mnand_test_multi_cmd (mnand_chip *chip) |
Test IOCTL MULTI CMD Currently under this test: Reads the XCSD status, toggles the cache status, reads the XCSD status again toggles the cache status again, and updates the XCSD register. More... | |
MNAND_STATUS | mnand_ffu (mnand_chip *chip, char *fw_file) |
Performs Field Firmware Update for eMMC device using the firmware image that is passed as argument. More... | |
MNAND_STATUS | mnand_get_ffu_status (mnand_chip *chip, MNAND_FFU_STATUS *ffu_status) |
Returns the status of the FFU operation that was done in the previous boot cycle. More... | |
MNAND_STATUS | mnand_get_fw_version (mnand_chip *chip, char *fw_version) |
Returns the current version(in hex string format) of the firmware that is running on the device. More... | |
MNAND_STATUS | mnand_compare_fw_version (mnand_chip *chip, char *fw_file, MNAND_FW_COMPARE *res) |
Compares the version of the passed firmware with the version of the frimware that is currently running on the device and returns if the passed firmware version is equal or lesser or greater. More... | |
MNAND_STATUS | mnand_is_ffu_ready (mnand_chip *chip, bool *res) |
Returns wheher the device is ready to read the current firmware verion that is on the device and to perform the FFU operation . More... | |
#define MAX_ERASE_CNT 0xFFFF |
#define MAX_FW_STR_LEN (32U) |
#define MAX_PRN_STR_LEN (64U) |
#define MNAND_READ_CACHE_ENABLE (1 << 0) |
typedef struct __mnand_ages_element mnand_ages_info |
summary of ages
typedef struct __mnand_block_info mnand_block_info |
information per block
typedef struct __mnand_chip mnand_chip |
typedef struct __mnand_cid_info mnand_cid_info |
CID - eMMC only.
typedef struct __mnand_config_desc_info mnand_config_desc_info |
CONFIG DESC - UFS Only.
typedef struct __mnand_csd_info mnand_csd_info |
CSD - eMMC only.
typedef struct __mnand_device_desc_info mnand_device_desc_info |
DEVICE DESC - UFS Only.
typedef enum __mnand_device_type MNAND_DEVICE_TYPE |
mNAND device enumeration
typedef enum __mnand_eol_status MNAND_EOL_STATUS |
mNAND EOL status enumeration
typedef struct __mnand_ext_csd_info mnand_ext_csd_info |
EXT CSD - eMMC only.
typedef enum __mnand_ffu_status MNAND_FFU_STATUS |
mNAND UFS FFU status
typedef enum __mnand_fw_comparison_result MNAND_FW_COMPARE |
mNAND firmware comparison enumeration
typedef struct __mnand_geo_desc_info mnand_geo_desc_info |
GEOMETRY DESC - UFS Only.
typedef union __mnand_geo_info mnand_geo_info |
GEOMETRY INFO.
typedef union __mnand_life_time_element mnand_life_time_element |
information on life time element
typedef struct __mnand_life_time_info mnand_life_time_info |
information on life time
typedef struct __mnand_lu_info mnand_lu_info |
LOGICAL UNIT INFO - UFS Only.
typedef struct __mnand_mmc_geo_info mnand_mmc_geo_info |
MMC GEOMETRY INFO - eMMC only.
typedef union __mnand_refresh_element mnand_refresh_element |
information on refresh element
typedef struct __mnand_refresh_progress mnand_refresh_progress |
information on refresh progress
typedef struct __mnand_refresh_properties mnand_refresh_properties |
information on refresh properties
typedef enum __mnand_status MNAND_STATUS |
mNAND operation status used in the API
typedef enum __mnand_storage_type MNAND_STORAGE_TYPE |
mNAND storage type enumeration
typedef struct __mnand_summary_element mnand_summary_element |
summary of given block type (or region)
typedef struct __mnand_summary_info mnand_summary_info |
aggregation of summaries
typedef struct __mnand_ufs_combo_query_req mnand_ufs_combo_query_req |
typedef struct __mnand_ufs_geo_info mnand_ufs_geo_info |
UFS GEOMETRY INFO - UFS only.
typedef struct __mnand_ufs_query_req mnand_ufs_query_req |
Gives the erase/write amplification value for the device.
typedef struct __mnand_unit_desc_info mnand_unit_desc_info |
UNIT DESC - UFS Only.
typedef struct __mnand_wr_info mnand_wr_info |
Holds the information that indicates the host cumulative written data (units of 100MB).
Written data is calculated as host cumulative written data * 100MB.
enum __mnand_device_type |
enum __mnand_eol_status |
enum __mnand_ffu_status |
mNAND UFS FFU status
enum __mnand_status |
enum __mnand_storage_type |
MNAND_STATUS mnand_bind | ( | int | fd, |
mnand_chip * | chip | ||
) |
"Binding" the mNAND chip.
This function needs to be called first to establish mNAND health related content. Identification of mNAND will be performed. Various health related data structures will be allocated, initialized, and set up.
mnand_bind and mnand_unbind to be used in pair.
Note: this function uses existed file descriptor (unlike mnand_open, which takes a pathname for device node).
fd | - file descriptor to mNAND device |
chip | - the mNAND chip handle to be initialized |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_check_eol_status | ( | mnand_chip * | chip, |
MNAND_EOL_STATUS * | eol_status | ||
) |
Checking EOL status.
chip | - the mNAND chip handle to be updated |
eol_status | - EOL status (MNAND_EOL_DETECTED = EOL set) |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_close | ( | mnand_chip * | chip | ) |
"Closing" (aka releasing) the mNAND chip.
This function needs to be called last to free up health related resource and various data structures.
mnand_open and mnand_close to be used in pair.
chip | - the mNAND chip handle to be used |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_compare_fw_version | ( | mnand_chip * | chip, |
char * | fw_file, | ||
MNAND_FW_COMPARE * | res | ||
) |
Compares the version of the passed firmware with the version of the frimware that is currently running on the device and returns if the passed firmware version is equal or lesser or greater.
[in] | handle | - Handle to an mNAND eMMC device structure. |
[in] | fw_file | - Pointer to the path/name of the firmware file with the firmware filename adhering to the filename naming convention given in the API description of mnand_ffu(). |
[out] | res | - result of the version comparison. |
Usage considerations
MNAND_STATUS mnand_enable_power_off_notification | ( | mnand_chip * | chip | ) |
Enable power-off notification.
chip | - pointer to chip handle |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_extract_age_info | ( | mnand_chip * | chip, |
int | block_type, | ||
uint64_t * | total_age, | ||
int * | blk_count, | ||
double * | avg_age | ||
) |
Extract age info from the mNAND chip.
chip | - the mNAND chip handle to be used |
block_type | - which region (SLC/MLC) to be used |
total_age | - the sum of the ages from the blocks @prarm blk_count - #blocks in specified region |
avg_age | - average age of the blocks, can be used when total_age/blk_counot not available |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_extract_life_time_info | ( | mnand_chip * | chip, |
mnand_life_time_info * | life_time_info | ||
) |
Extract spare count info from the mNAND chip.
chip | - the mNAND chip handle to be used |
life_time_info | - information on life time |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_ffu | ( | mnand_chip * | chip, |
char * | fw_file | ||
) |
Performs Field Firmware Update for eMMC device using the firmware image that is passed as argument.
This API expects the firmware image name to be defined in below format. <firmware image>_PRN_<product id/revision>_FWVER_<hex version string>.bin
For generating the firmware image name in the above format, the details can be obtained from below sources.
Ex: If below are the UFS firmare image details received from the vendor, then the firmware image name should be "SAMSUNG_UFS_3_1_SELENA_V5_TLC_128GB_P53_PRN_KLUDG4UHYB-B0EP_FWVER_13EC.bin"
Similarly if below are the eMMC firmware details received from the vendor, then the firmware image name should be "SAMSUNG_eMMC_5_1_VINCENT_FETB_MLC_32GB_P63_PRN_BGUF4R_FWVER_000000059.bin"
Below is the sequence that needs to be followed for performing FFU.
[in] | handle | - Handle to an mNAND UFS device structure. |
[in] | fw_file | - Pointer to the path of the firmware file with the firmware filename adhering to the filename naming convention given in the API description. |
Usage considerations
MNAND_STATUS mnand_flush_cache | ( | mnand_chip * | chip | ) |
Flush cache on mnand.
chip | - the mNAND chip handle to be used |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_get_bkops_en | ( | mnand_chip * | chip, |
uint8_t * | enabled | ||
) |
Return the status of BKOPS_EN bit.
chip | - pointer to chip handle |
enabled | - store the BKOPS_EN bit |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_get_bkops_status | ( | mnand_chip * | chip, |
uint8_t * | stat | ||
) |
Return the status of BKOPS.
chip | - pointer to chip handle |
stat | - store the status of BKOPS |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_get_cache_en | ( | mnand_chip * | chip, |
uint8_t * | enabled | ||
) |
Determine if eMMC cache is enabled.
chip | - pointer to chip handle |
enabled | - store the Read and Write cache enabled status Bit 0 - Read Cache, Bit 1 - Write Cache Bit value 1 - Cache enabled, Bit value 0 - Cache Disabled |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_get_current_lun | ( | mnand_chip * | chip, |
uint32_t * | lun | ||
) |
get mnand current lun (UFS only)
chip | - the mNAND chip handle to be used |
lun | - Pointer to logical unit number to be updated |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_get_ffu_status | ( | mnand_chip * | chip, |
MNAND_FFU_STATUS * | ffu_status | ||
) |
Returns the status of the FFU operation that was done in the previous boot cycle.
[in] | handle | - Handle to an mNAND eMMC device structure. |
[out] | ffu_status | - Ths status of the FFU operation that was performed before. |
Usage considerations
MNAND_STATUS mnand_get_fw_version | ( | mnand_chip * | chip, |
char * | fw_version | ||
) |
Returns the current version(in hex string format) of the firmware that is running on the device.
[in] | handle | - Handle to an mNAND eMMC device structure. |
[out] | fw_version | - pointer to the string buffer to which the version should be copied. |
Usage considerations
MNAND_STATUS mnand_get_geo_info | ( | mnand_chip * | chip, |
mnand_geo_info * | geo_info | ||
) |
Extract mnand geometry info.
chip | - the mNAND chip handle to be used |
geo_info | - mnand geometry info |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_get_lu_info | ( | mnand_chip * | chip, |
uint32_t | lun, | ||
mnand_lu_info * | lu_info | ||
) |
get mnand lu info (UFS only)
chip | - the mNAND chip handle to be used |
lun | - logical unit number for which lu info is needed |
lu_info | - pointer for the lu_info data to be updated |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_get_refresh_progress | ( | mnand_chip * | chip, |
double * | rfsh_progress | ||
) |
Extract refresh progress from the mNAND chip.
chip | - the mNAND chip handle to be used |
rfsh_progress | - current refresh progress (in percentage) |
MNAND_OK,success | |
else | problem with operation |
|
inlinestatic |
Return mnand storage type.
chip | - pointer to chip handle |
storage | type(enum) of the mnand device |
Definition at line 656 of file nvmnand.h.
References __mnand_chip::storage_type.
|
inlinestatic |
Determine if given block is a bad block.
blk | - pointer to block info |
non-zero,block | is bad block |
0,block | is not bad block |
Definition at line 514 of file nvmnand.h.
References __mnand_block_info::block_age, __mnand_block_info::block_type, MAX_ERASE_CNT, mnand_is_valid_block(), MNAND_MANF_BAD_BLOCK, MNAND_RUNTIME_BAD_BLOCK, and MNAND_UNKNOWN_BAD_BLOCK.
Referenced by mnand_is_usable_block().
|
inlinestatic |
Return if the block info is available.
chip | - pointer to chip handle |
non-zero,block | info is available |
0,block | info is not available |
Definition at line 642 of file nvmnand.h.
References __mnand_chip::num_blocks.
MNAND_STATUS mnand_is_ffu_ready | ( | mnand_chip * | chip, |
bool * | res | ||
) |
Returns wheher the device is ready to read the current firmware verion that is on the device and to perform the FFU operation .
[in] | handle | - Handle to an mNAND eMMC device structure. |
[out] | res | - whether the device is ready. |
Usage considerations
|
inlinestatic |
Determine if given block is in MLC region.
blk | - pointer to block info |
non-zero,block | is in MLC region |
0,block | is not in MLC region |
Definition at line 581 of file nvmnand.h.
References __mnand_block_info::block_type, mnand_is_valid_block(), and MNAND_MLC_BLOCK.
|
inlinestatic |
Return if force refresh is available.
chip | - pointer to chip handle |
non-zero,force | refresh is available |
0,force | refresh is not available |
Definition at line 627 of file nvmnand.h.
References __mnand_chip::refresh_available.
|
inlinestatic |
Determine if given block is in SLC region.
blk | - pointer to block info |
non-zero,block | is in SLC region |
0,block | is not in SLC region |
Definition at line 565 of file nvmnand.h.
References __mnand_block_info::block_type, mnand_is_valid_block(), and MNAND_SLC_BLOCK.
|
inlinestatic |
Return if the smart summary is available.
chip | - pointer to chip handle |
non-zero,smart | summary is available |
0,smart | summary is not available |
Definition at line 612 of file nvmnand.h.
References __mnand_chip::smart_summary_available.
|
inlinestatic |
Return if the summary is available.
chip | - pointer to chip handle |
non-zero,summary | is available |
0,summary | is not available |
Definition at line 597 of file nvmnand.h.
References __mnand_chip::summary_available.
|
inlinestatic |
Determine if given block is a usable block.
Note, in addition to bad block, system block is not usable, neither.
blk | - pointer to block info |
non-zero,block | is usable |
0,block | is not usable |
Definition at line 532 of file nvmnand.h.
References __mnand_block_info::block_type, mnand_is_bad_block(), mnand_is_valid_block(), and MNAND_SYSTEM_BLOCK.
Referenced by mnand_is_usable_block_with_type().
|
inlinestatic |
Determine if given block is a usable block, and matches given block type.
blk | - pointer to block info |
blk_type | - block type to match |
non-zero,block | is usable |
0,block | is not usable |
Definition at line 549 of file nvmnand.h.
References __mnand_block_info::block_type, and mnand_is_usable_block().
|
inlinestatic |
Return the validity of the block, given the pointer of block info.
blk | - pointer to block info |
non-zero,block | info is valid |
0,block | info is invalid |
Definition at line 499 of file nvmnand.h.
References __mnand_block_info::valid.
Referenced by mnand_is_bad_block(), mnand_is_mlc_block(), mnand_is_slc_block(), and mnand_is_usable_block().
MNAND_STATUS mnand_open | ( | const char * | devname, |
mnand_chip * | chip | ||
) |
"Opening" the mNAND chip.
This function needs to be called first to establish mNAND health related content. Identification of mNAND will be performed. Various health related data structures will be allocated, initialized, and set up.
mnand_open and mnand_close to be used in pair.
devname | - pointer to device name (e.g. /dev/emmc0) |
chip | - the mNAND chip handle to be initialized |
MNAND_OK,success | |
else | problem with operation |
int mnand_read_sectors_phys | ( | mnand_chip * | chip, |
unsigned int | start_sector, | ||
unsigned int | sector_cnt, | ||
off_t | physaddr | ||
) |
Reading data sectors into given buffer (pointed by physical address).
chip | - the mNAND chip handle to be used |
start_sector | - the starting sector to be read |
sector_cnt | - the number of sectors to be read |
addr | - buffer address (in physical address form) |
number | of sectors read |
-1 | problem with operation |
int mnand_read_sectors_virt | ( | mnand_chip * | chip, |
unsigned int | start_sector, | ||
unsigned int | sector_cnt, | ||
void * | virtaddr | ||
) |
Reading data sectors into given buffer (pointed by virtual address).
chip | - the mNAND chip handle to be used |
start_sector | - the starting sector to be read |
sector_cnt | - the number of sectors to be read |
virtaddr | - buffer address (in virtual address form) |
number | of sectors read |
-1 | problem with operation |
MNAND_STATUS mnand_send_combo_query_req | ( | mnand_chip * | chip, |
mnand_ufs_query_req * | query_req, | ||
uint8_t | num_cmds, | ||
uint8_t | need_cq_empty, | ||
uint8_t | ret_on_error | ||
) |
Send mnand combo query request (UFS only)
chip | - the mNAND chip handle to be used |
query_req | - Pointer to ufs query request info |
num_cmds | - number of query requests in this combo request |
need_cq_empty | - Flag to specify if this request needs cq to be empty |
ret_on_err | - Flag to specify to return on error or continue furthur |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_send_power_off_notification | ( | mnand_chip * | chip | ) |
Send power-off notification.
chip | - pointer to chip handle |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_send_refresh | ( | mnand_chip * | chip, |
uint8_t | block_type, | ||
int | num_blocks, | ||
uint32_t | rfsh_unit_time_us, | ||
mnand_refresh_progress * | progress | ||
) |
Send "refresh" command to the mNAND chip.
The purpose is to force data rotation to improve the data retention.
chip | - the mNAND chip handle to be used |
block_type | - which region (SLC/MLC) to be used |
num_blocks | - #blocks to be refreshed @prarm progress - refresh progress |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_set_bkops_en | ( | mnand_chip * | chip, |
uint8_t | enable | ||
) |
set the BKOPS_EN bit in ext_csd Note: BNKOPS_EN is a OTP, once programmed can't change the value.
chip | - pointer to chip handle |
enable | - Value to set in BKOPS_EN bit Set 1 to BKOPS_EN, indicates host driver will issue bkops req and 0 indicate host driver will not issue bkops request. |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_set_bkops_start | ( | mnand_chip * | chip | ) |
Mark the start of BKOPS.
chip | - pointer to chip handle |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_set_cache_en | ( | mnand_chip * | chip, |
uint8_t | enable | ||
) |
Enable/Disable cache on mnand.
chip | - the mNAND chip handle to be used |
enable | - Enables/Disable state for Read and Write cache Bit 0 - Read Cache, Bit 1 - Write Cache Bit value 1 - Cache enabled, Bit value 0 - Cache Disabled |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_switch_cmd | ( | mnand_chip * | chip, |
uint8_t | index, | ||
uint8_t | value, | ||
char * | errmsg_prepend | ||
) |
Send mnand switch cmd to mmc to set EXT CSD register.
(eMMC only)
chip | - the mNAND chip handle to be used |
index | - which EXT CSD register to be set |
value | - the value of EXT CSD register to be set |
errmsg_prepend | - error msg to be displayed on failure |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_test_multi_cmd | ( | mnand_chip * | chip | ) |
Test IOCTL MULTI CMD Currently under this test: Reads the XCSD status, toggles the cache status, reads the XCSD status again toggles the cache status again, and updates the XCSD register.
chip | - the mNAND chip handle to be used |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_trim_all | ( | mnand_chip * | chip | ) |
Trimming the whole device.
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_unbind | ( | mnand_chip * | chip | ) |
"Unbinding" (aka releasing) the mNAND chip.
This function needs to be called last to free up health related resource and various data structures.
mnand_bind and mnand_unbind to be used in pair.
Note: file descriptor used in "bind" will NOT be closed.
chip | - the mNAND chip handle to be used |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_update_block_info | ( | mnand_chip * | chip | ) |
Updating the list of block info inside mNAND chip handle.
chip | - the mNAND chip handle to be updated |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_update_card_status | ( | mnand_chip * | chip | ) |
Updating the card status field inside mNAND chip handle.
chip | - the mNAND chip handle to be updated |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_update_cid | ( | mnand_chip * | chip | ) |
Updating the CID field inside mNAND chip handle.
chip | - the mNAND chip handle to be updated |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_update_csd | ( | mnand_chip * | chip | ) |
Updating the CSD field inside mNAND chip handle.
chip | - the mNAND chip handle to be updated |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_update_smart_summary_info | ( | mnand_chip * | chip | ) |
Updating the smart summary info inside mNAND chip handle.
chip | - the mNAND chip handle to be updated |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_update_summary_info | ( | mnand_chip * | chip | ) |
Updating the summary info inside mNAND chip handle.
chip | - the mNAND chip handle to be updated |
MNAND_OK,success | |
else | problem with operation |
MNAND_STATUS mnand_update_xcsd | ( | mnand_chip * | chip | ) |
Updating the EXT CSD field inside mNAND chip handle.
chip | - the mNAND chip handle to be updated |
MNAND_OK,success | |
else | problem with operation |