NVIDIA DriveOS Linux SDK API Reference

7.2.5.0 Early Access Release
nvmnand.h File Reference

Detailed Description

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
 Host cumulative written data information. More...
 
struct  mnand_ufs_write_erase_amplification
 Write/Erase amplification information. 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 information - eMMC only. More...
 
struct  __mnand_csd_info
 CSD information - eMMC only. More...
 
struct  __mnand_ext_csd_info
 EXT CSD information - eMMC only. More...
 
struct  __mnand_device_desc_info
 DEVICE DESC information - UFS Only. More...
 
struct  __mnand_config_desc_info
 CONFIG DESC information - UFS Only. More...
 
struct  __mnand_geo_desc_info
 GEOMETRY DESC information - UFS Only. More...
 
struct  __mnand_unit_desc_info
 UNIT DESC information - UFS Only. More...
 
struct  __mnand_mmc_geo_info
 MMC Geometry Information. More...
 
struct  __mnand_ufs_geo_info
 UFS Geometry Information. More...
 
union  __mnand_geo_info
 Device Geometry Information. More...
 
struct  __mnand_lu_info
 Logical Unit information - UFS Only. More...
 
struct  __mnand_chip
 mNAND chip information More...
 
struct  __mnand_ufs_query_req
 UFS Query Request Information Structure. More...
 
struct  __mnand_ufs_combo_query_req
 UFS Combo Query Request Information Structure. More...
 

Macros

#define MAX_ERASE_CNT   0xFFFF
 Maximum erase count a block can have. 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)
 

Typedefs

typedef struct __mnand_block_info mnand_block_info
 Information per block. More...
 
typedef union __mnand_life_time_element mnand_life_time_element
 Information on life time element. More...
 
typedef struct __mnand_life_time_info mnand_life_time_info
 Information on life time. More...
 
typedef union __mnand_refresh_element mnand_refresh_element
 Information on refresh element. More...
 
typedef struct __mnand_refresh_progress mnand_refresh_progress
 Information on refresh progress. More...
 
typedef struct __mnand_refresh_properties mnand_refresh_properties
 Information on refresh properties. More...
 
typedef struct __mnand_ages_element mnand_ages_info
 Summary of ages. More...
 
typedef struct __mnand_wr_info mnand_wr_info
 Host cumulative written data information. More...
 
typedef struct mnand_ufs_write_erase_amplification mnand_ufs_write_erase_amplification
 Write/Erase amplification information. More...
 
typedef struct __mnand_summary_element mnand_summary_element
 Summary of given block type (or region) More...
 
typedef struct __mnand_summary_info mnand_summary_info
 Aggregation of summaries. More...
 
typedef struct __mnand_cid_info mnand_cid_info
 CID information - eMMC only. More...
 
typedef struct __mnand_csd_info mnand_csd_info
 CSD information - eMMC only. More...
 
typedef struct __mnand_ext_csd_info mnand_ext_csd_info
 EXT CSD information - eMMC only. More...
 
typedef struct __mnand_device_desc_info mnand_device_desc_info
 DEVICE DESC information - UFS Only. More...
 
typedef struct __mnand_config_desc_info mnand_config_desc_info
 CONFIG DESC information - UFS Only. More...
 
typedef struct __mnand_geo_desc_info mnand_geo_desc_info
 GEOMETRY DESC information - UFS Only. More...
 
typedef struct __mnand_unit_desc_info mnand_unit_desc_info
 UNIT DESC information - UFS Only. More...
 
typedef struct __mnand_mmc_geo_info mnand_mmc_geo_info
 MMC Geometry Information. More...
 
typedef struct __mnand_ufs_geo_info mnand_ufs_geo_info
 UFS Geometry Information. More...
 
typedef union __mnand_geo_info mnand_geo_info
 Device Geometry Information. More...
 
typedef struct __mnand_lu_info mnand_lu_info
 Logical Unit information - UFS Only. More...
 
typedef enum __mnand_device_type MNAND_DEVICE_TYPE
 mNAND device type enumeration More...
 
typedef enum __mnand_storage_type MNAND_STORAGE_TYPE
 mNAND storage type enumeration More...
 
typedef enum __mnand_eol_status MNAND_EOL_STATUS
 mNAND End-of-Life status enumeration More...
 
typedef enum __mnand_fw_comparison_result MNAND_FW_COMPARE
 mNAND firmware comparison result enumeration More...
 
typedef enum __mnand_ffu_status MNAND_FFU_STATUS
 mNAND UFS Field Firmware Update (FFU) status enumeration More...
 
typedef enum __mnand_status MNAND_STATUS
 mNAND operation status codes More...
 
typedef struct __mnand_chip mnand_chip
 
typedef struct __mnand_ufs_query_req mnand_ufs_query_req
 
typedef struct __mnand_ufs_combo_query_req mnand_ufs_combo_query_req
 

Enumerations

enum  __mnand_device_type {
  MNAND_CATCH_ALL = 0,
  MNAND_HYNIX_F26 = 1,
  MNAND_HYNIX_F20 = 2,
  MNAND_HYNIX_F16 = 3,
  MNAND_MICRON = 4,
  MNAND_SAMSUNG50 = 5,
  MNAND_SAMSUNG51 = 6,
  MNAND_TOSHIBA = 7,
  MNAND_UFS_TOSHIBA = 8,
  MNAND_UFS_SAMSUNG = 9,
  MNAND_UFS_MICRON = 10
}
 mNAND device type enumeration More...
 
enum  __mnand_storage_type {
  MNAND_EMMC = 0,
  MNAND_UFS = 1,
  MNAND_UNKNOWN = 2
}
 mNAND storage type enumeration More...
 
enum  __mnand_eol_status {
  MNAND_EOL_OK = 0,
  MNAND_EOL_DETECTED = 1
}
 mNAND End-of-Life status enumeration More...
 
enum  __mnand_fw_comparison_result {
  MNAND_PASSED_FW_VERSION_SAME = 0,
  MNAND_PASSED_FW_VERSION_GREATER = 1,
  MNAND_PASSED_FW_VERSION_LESSER = 2
}
 mNAND firmware comparison result enumeration More...
 
enum  __mnand_ffu_status {
  MNAND_FFU_STATUS_SUCCESS = 0,
  MNAND_FFU_STATUS_INSTALL_FAILED = 1,
  MNAND_FFU_STATUS_ERROR_DOWNLOADING_FIRMWARE = 2,
  MNAND_FFU_STATUS_FW_CORRUPTION_ERROR = 3,
  MNAND_FFU_STATUS_FW_VERSION_MISMATCH = 4,
  MNAND_FFU_STATUS_INTERNAL_ERROR = 5,
  MNAND_FFU_STATUS_NO_INFORMATION = 6,
  MNAND_FFU_STATUS_GENERIC_ERROR = 7,
  MNAND_FFU_STATUS_RESERVED_ERROR = 8
}
 mNAND UFS Field Firmware Update (FFU) status enumeration More...
 
enum  __mnand_status {
  MNAND_OK = 0,
  MNAND_ENOMEM = 1,
  MNAND_EIO = 2,
  MNAND_EINVAL = 3,
  MNAND_EOPEN = 4,
  MNAND_UNSUPPORTED = 5,
  MNAND_UNKNOWN_ERR = 6,
  MNAND_BKOPS_EN_ERR = 7
}
 mNAND operation status codes More...
 

Functions

static int mnand_is_valid_block (mnand_block_info *blk)
 Checks if a block is valid. More...
 
static int mnand_is_bad_block (mnand_block_info *blk)
 Checks if a block is marked as bad. More...
 
static int mnand_is_usable_block (mnand_block_info *blk)
 Checks if a block is usable. More...
 
static int mnand_is_usable_block_with_type (mnand_block_info *blk, uint16_t blk_type)
 Checks if a block is usable and matches specified type. More...
 
static int mnand_is_slc_block (mnand_block_info *blk)
 Checks if a block is in the SLC region. More...
 
static int mnand_is_mlc_block (mnand_block_info *blk)
 Checks if a block is in the MLC region. More...
 
static int mnand_is_summary_available (mnand_chip *chip)
 Checks if summary information is available. More...
 
static int mnand_is_smart_summary_available (mnand_chip *chip)
 Checks if smart summary information is available. More...
 
static int mnand_is_refresh_available (mnand_chip *chip)
 Checks if force refresh is available. More...
 
static int mnand_is_block_info_available (mnand_chip *chip)
 Checks if block information is available. More...
 
static MNAND_STORAGE_TYPE mnand_get_storage_type (mnand_chip *chip)
 Returns mnand storage type. More...
 
MNAND_STATUS mnand_get_bkops_en (mnand_chip *chip, uint8_t *enabled)
 Gets the status of background operations enable bit. More...
 
MNAND_STATUS mnand_get_bkops_status (mnand_chip *chip, uint8_t *stat)
 Gets the status of background operations. More...
 
MNAND_STATUS mnand_set_bkops_en (mnand_chip *chip, uint8_t enable)
 Sets the background operations enable bit. 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)
 Opens and initializes the mNAND device. More...
 
MNAND_STATUS mnand_close (mnand_chip *chip)
 Closes the mNAND device. More...
 
MNAND_STATUS mnand_bind (int fd, mnand_chip *chip)
 Binds the mNAND chip. More...
 
MNAND_STATUS mnand_unbind (mnand_chip *chip)
 Unbinds (releases) the mNAND chip. More...
 
MNAND_STATUS mnand_update_cid (mnand_chip *chip)
 Updates the CID field in mNAND chip handle. More...
 
MNAND_STATUS mnand_update_csd (mnand_chip *chip)
 Updates the CSD field in mNAND chip handle. More...
 
MNAND_STATUS mnand_update_xcsd (mnand_chip *chip)
 Updates the EXT CSD field in mNAND chip handle. More...
 
MNAND_STATUS mnand_update_card_status (mnand_chip *chip)
 Updates the card status field in mNAND chip handle. More...
 
MNAND_STATUS mnand_update_block_info (mnand_chip *chip)
 Updates the block info list in mNAND chip handle. More...
 
MNAND_STATUS mnand_update_summary_info (mnand_chip *chip)
 Updates the summary info in mNAND chip handle. More...
 
MNAND_STATUS mnand_update_smart_summary_info (mnand_chip *chip)
 Updates the smart summary info in mNAND chip handle. More...
 
MNAND_STATUS mnand_check_eol_status (mnand_chip *chip, MNAND_EOL_STATUS *eol_status)
 Checks the EOL (End of Life) 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)
 Sends "refresh" command to the mNAND chip. More...
 
MNAND_STATUS mnand_extract_age_info (mnand_chip *chip, int block_type, uint64_t *total_age, uint32_t *blk_count, double *avg_age)
 Extracts age information from the mNAND chip. More...
 
MNAND_STATUS mnand_get_refresh_progress (mnand_chip *chip, double *rfsh_progress)
 Extracts refresh progress from the mNAND chip. More...
 
MNAND_STATUS mnand_extract_life_time_info (mnand_chip *chip, mnand_life_time_info *life_time_info)
 Extracts lifetime information 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)
 Read data sectors into given buffer (virtual address). More...
 
int mnand_read_sectors_phys (mnand_chip *chip, unsigned int start_sector, unsigned int sector_cnt, off_t physaddr)
 Read data sectors into given buffer (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 (eMMC only). 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. More...
 
MNAND_STATUS mnand_ffu (mnand_chip *chip, char *fw_file)
 Performs Field Firmware Update for UFS and 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...
 

Macro Definition Documentation

◆ MNAND_LIFETIME_IN_BLOCK

#define MNAND_LIFETIME_IN_BLOCK   (1 << 1)

Definition at line 143 of file nvmnand.h.

◆ MNAND_LIFETIME_IN_PERCENT

#define MNAND_LIFETIME_IN_PERCENT   (1 << 2)

Definition at line 144 of file nvmnand.h.

◆ MNAND_LIFETIME_INVALID

#define MNAND_LIFETIME_INVALID   (1 << 0)

Definition at line 142 of file nvmnand.h.

◆ MNAND_MANF_BAD_BLOCK

#define MNAND_MANF_BAD_BLOCK   (1 << 9)

Definition at line 101 of file nvmnand.h.

◆ MNAND_MLC_BLOCK

#define MNAND_MLC_BLOCK   (1 << 1)

Definition at line 98 of file nvmnand.h.

◆ MNAND_RFSH_PROG_IN_BLOCK

#define MNAND_RFSH_PROG_IN_BLOCK   (1 << 1)

Definition at line 179 of file nvmnand.h.

◆ MNAND_RFSH_PROG_IN_PERCENT

#define MNAND_RFSH_PROG_IN_PERCENT   (1 << 2)

Definition at line 180 of file nvmnand.h.

◆ MNAND_RFSH_PROG_INVALID

#define MNAND_RFSH_PROG_INVALID   (1 << 0)

Definition at line 178 of file nvmnand.h.

◆ MNAND_RUNTIME_BAD_BLOCK

#define MNAND_RUNTIME_BAD_BLOCK   (1 << 10)

Definition at line 102 of file nvmnand.h.

◆ MNAND_SLC_BLOCK

#define MNAND_SLC_BLOCK   (1 << 2)

Definition at line 99 of file nvmnand.h.

◆ MNAND_SYSTEM_BLOCK

#define MNAND_SYSTEM_BLOCK   (1 << 11)

Definition at line 103 of file nvmnand.h.

◆ MNAND_UNKNOWN_BAD_BLOCK

#define MNAND_UNKNOWN_BAD_BLOCK   (1 << 8)

Definition at line 100 of file nvmnand.h.

◆ MNAND_UNKNOWN_BLOCK

#define MNAND_UNKNOWN_BLOCK   (1 << 0)

Definition at line 97 of file nvmnand.h.