|
|
NVIDIA DriveOS Linux SDK API Reference
|
7.2.5.0 Early Access Release
|
Go to the documentation of this file.
23 #ifndef __NV_MNAND_H__
24 #define __NV_MNAND_H__
31 #if defined(__cplusplus)
54 #define MAX_ERASE_CNT 0xFFFF
66 #define MNAND_READ_CACHE_ENABLE (1 << 0)
67 #define MNAND_WRITE_CACHE_ENABLE (1 << 1)
70 #define MAX_FW_STR_LEN (32U)
72 #define MAX_PRN_STR_LEN (64U)
97 #define MNAND_UNKNOWN_BLOCK (1 << 0)
98 #define MNAND_MLC_BLOCK (1 << 1)
99 #define MNAND_SLC_BLOCK (1 << 2)
100 #define MNAND_UNKNOWN_BAD_BLOCK (1 << 8)
101 #define MNAND_MANF_BAD_BLOCK (1 << 9)
102 #define MNAND_RUNTIME_BAD_BLOCK (1 << 10)
103 #define MNAND_SYSTEM_BLOCK (1 << 11)
142 #define MNAND_LIFETIME_INVALID (1 << 0)
143 #define MNAND_LIFETIME_IN_BLOCK (1 << 1)
144 #define MNAND_LIFETIME_IN_PERCENT (1 << 2)
178 #define MNAND_RFSH_PROG_INVALID (1 << 0)
179 #define MNAND_RFSH_PROG_IN_BLOCK (1 << 1)
180 #define MNAND_RFSH_PROG_IN_PERCENT (1 << 2)
1011 return (blk->
valid != 0);
1892 int num_blocks, uint32_t rfsh_unit_time_us,
1927 uint64_t *total_age, uint32_t *blk_count,
double *avg_age);
2081 unsigned int sector_cnt,
void *virtaddr);
2113 unsigned int sector_cnt, off_t physaddr);
2207 uint8_t value,
char *errmsg_prepend);
2339 uint8_t ret_on_error);
2573 #if defined(__cplusplus)
MNAND_STATUS mnand_check_eol_status(mnand_chip *chip, MNAND_EOL_STATUS *eol_status)
Checks the EOL (End of Life) status.
MNAND_STATUS mnand_open(const char *devname, mnand_chip *chip)
Opens and initializes the mNAND device.
mnand_life_time_element life_time
Life time information.
uint32_t def_rfsh_interval
Default refresh interval(msec)
#define MNAND_MANF_BAD_BLOCK
MNAND_STORAGE_TYPE storage_type
Storage type (eMMC/UFS)
uint16_t enhanced4_cap_adj_fac
Enhanced area 4 capacity adjustment factor.
struct __mnand_unit_desc_info mnand_unit_desc_info
UNIT DESC information - UFS Only.
struct __mnand_life_time_info mnand_life_time_info
Information on life time.
uint8_t memory_type
Memory type of this LU.
uint64_t enh_size_mult
Enhanced area size multiplier.
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.
__mnand_ffu_status
mNAND UFS Field Firmware Update (FFU) status enumeration
DEVICE DESC information - UFS Only.
mnand_csd_info csd
Card Specific Data (eMMC only)
uint64_t partition_size_alignment
Partition size alignment requirement.
MNAND_STATUS mnand_test_multi_cmd(mnand_chip *chip)
Test IOCTL MULTI CMD.
void * priv_chip_ops
mNAND storage specific private operations
CSD information - eMMC only.
uint64_t max_enh_size_mult
Maximum enhanced area size multiplier.
MNAND_STATUS mnand_update_cid(mnand_chip *chip)
Updates the CID field in mNAND chip handle.
Information on refresh progress.
@ MNAND_SAMSUNG50
Samsung eMMC 5.0 device.
__mnand_fw_comparison_result
mNAND firmware comparison result enumeration
mnand_mmc_geo_info mmc_geo_info
eMMC specific geometry information
@ MNAND_HYNIX_F26
Hynix F26 device.
mnand_refresh_element progress
Current refresh progress.
@ MNAND_HYNIX_F16
Hynix F16 device.
MNAND_STATUS mnand_update_block_info(mnand_chip *chip)
Updates the block info list in mNAND chip handle.
MNAND_STATUS mnand_update_xcsd(mnand_chip *chip)
Updates the EXT CSD field in mNAND chip handle.
int32_t spare_bcnt
Number of remaining spare blocks, -1=invalid.
UFS Geometry Information.
MNAND_DEVICE_TYPE dev_type
Device type identifier.
mnand_summary_info * summary
Summary information, not NULL when available.
@ MNAND_FFU_STATUS_NO_INFORMATION
Indicates there is no informatuon available about the FFU operation.
mnand_ufs_write_erase_amplification eaf
Erase Amplification of the device.
struct __mnand_cid_info mnand_cid_info
CID information - eMMC only.
mnand_config_desc_info cfg_desc
Configuration Descriptor (UFS only)
struct __mnand_geo_desc_info mnand_geo_desc_info
GEOMETRY DESC information - UFS Only.
struct __mnand_device_desc_info mnand_device_desc_info
DEVICE DESC information - UFS Only.
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.
double percentage
Life time in percentage.
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 p...
mnand_life_time_info life
Life time information for this region.
@ MNAND_FFU_STATUS_FW_CORRUPTION_ERROR
Indicates the firmware that was passed for the FFU operation was corrupted.
@ MNAND_UFS_SAMSUNG
Samsung UFS device.
struct __mnand_ufs_geo_info mnand_ufs_geo_info
UFS Geometry Information.
uint16_t max_age
Maximum age in this region.
uint8_t data[64]
Device descriptor data, 64byte wide.
MNAND_STATUS mnand_get_bkops_status(mnand_chip *chip, uint8_t *stat)
Gets the status of background operations.
uint64_t hc_erase_grp_size
High-capacity erase group size.
uint8_t valid
Specifies whether the values indicated are vaild or not.
UNIT DESC information - UFS Only.
Aggregation of summaries.
mNAND part/vendor specific operation block
uint8_t data[19]
Unit descriptor data as per JESD220C spec.
Information on refresh properties.
@ MNAND_PASSED_FW_VERSION_LESSER
uint16_t supported_memory_types
Supported memory types bitmask.
MNAND_STATUS mnand_set_bkops_start(mnand_chip *chip)
Mark the start of BKOPS.
struct __mnand_refresh_properties mnand_refresh_properties
Information on refresh properties.
uint32_t shutdown_rfsh_interval
Minimum shutdown refresh interval(msec)
uint8_t data[16]
CID data, 128bit wide.
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).
mnand_ext_csd_info xcsd
Extended Card Specific Data (eMMC only)
uint8_t num_cmds
Number of Query Commands in this combo request.
static int mnand_is_block_info_available(mnand_chip *chip)
Checks if block information is available.
@ MNAND_CATCH_ALL
Default catch-all type when no specific match is found.
uint32_t card_status
Current card status.
struct __mnand_summary_info mnand_summary_info
Aggregation of summaries.
MNAND_STATUS mnand_get_cache_en(mnand_chip *chip, uint8_t *enabled)
Determine if eMMC cache is enabled.
#define MNAND_SYSTEM_BLOCK
struct __mnand_ext_csd_info mnand_ext_csd_info
EXT CSD information - eMMC only.
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).
uint32_t fram
Specifies the host cumulative written data (units of 100MB) from RAM.
MNAND_STATUS mnand_trim_all(mnand_chip *chip)
Trimming the whole device.
@ MNAND_UNSUPPORTED
Operation not supported by device.
static int mnand_is_bad_block(mnand_block_info *blk)
Checks if a block is marked as bad.
uint8_t selector
Selector value for the query operation.
MNAND_STATUS mnand_flush_cache(mnand_chip *chip)
Flush cache on mNAND.
@ MNAND_FFU_STATUS_RESERVED_ERROR
Indicates there was a reserved error during the FFU process.
@ MNAND_PASSED_FW_VERSION_SAME
MNAND_STATUS mnand_bind(int fd, mnand_chip *chip)
Binds the mNAND chip.
uint32_t identifier
32bit magic number for plausibilty check.
int ffu_available
Indicates if FFU (Field Firmware Update) is available.
struct __mnand_block_info mnand_block_info
Information per block.
uint16_t block
Last block being refresh.
uint32_t sys_code_max_alloc
Maximum allocation for system code area.
uint8_t data[16]
CSD data, 128bit wide.
int smart_summary_available
Indicates if smart summary information is available.
@ MNAND_FFU_STATUS_FW_VERSION_MISMATCH
Indicates the frimware version does not match
MNAND_STATUS mnand_update_summary_info(mnand_chip *chip)
Updates the summary info in mNAND chip handle.
struct __mnand_config_desc_info mnand_config_desc_info
CONFIG DESC information - UFS Only.
int runtime_bb_cnt
Number of runtime bad blocks, -1=invalid.
uint16_t valid
Indicates if this entry is valid.
__mnand_eol_status
mNAND End-of-Life status enumeration
Host cumulative written data information.
double slc_weaf
Specifies the SLC write/erase amplification.
uint8_t logical_blk_sz
Logical block size.
mnand_block_info * block_info
Block info list, indexed by num_blocks.
#define MAX_FW_STR_LEN
Maximum length of the firmware string.
uint8_t data1[144]
First part of Configuration descriptor data as per JESD220C spec.
int summary_available
Indicates if summary information is available.
MNAND_STATUS mnand_get_refresh_progress(mnand_chip *chip, double *rfsh_progress)
Extracts refresh progress from the mNAND chip.
mnand_ages_info ages
Ages information for this region.
MNAND_STATUS mnand_update_card_status(mnand_chip *chip)
Updates the card status field in mNAND chip handle.
uint32_t rfsh_days
Whole chip refreshes in given days.
uint32_t rfsh_calibrate_cnt
Minimum refreshes before re-calibration.
@ MNAND_PASSED_FW_VERSION_GREATER
uint16_t non_persist_cap_adj_fac
Non-persistent capacity adjustment factor.
MNAND_STATUS mnand_unbind(mnand_chip *chip)
Unbinds (releases) the mNAND chip.
uint16_t sys_code_cap_adj_fac
System code capacity adjustment factor.
uint8_t life_time_type
How the lifetime being presented.
uint8_t valid
Indicates if this entry is valid.
uint64_t user_capacity
Total user partition capacity.
__mnand_status
mNAND operation status codes
struct mnand_ufs_write_erase_amplification mnand_ufs_write_erase_amplification
Write/Erase amplification information.
MNAND_STATUS mnand_extract_life_time_info(mnand_chip *chip, mnand_life_time_info *life_time_info)
Extracts lifetime information from the mNAND chip.
uint8_t need_cq_empty
Flag indicating if command queue must be empty.
mnand_summary_element slc
SLC region summary.
uint64_t total_raw_capacity
Total raw device capacity.
uint32_t num_alloc_units
Number of allocation units.
uint32_t enhanced4_max_alloc
Maximum allocation for enhanced area 4.
mnand_unit_desc_info unit_desc
Unit Descriptor (UFS only)
union __mnand_refresh_element mnand_refresh_element
Information on refresh element.
mnand_summary_element total
Per chip summary.
uint32_t delay
Delay in milliseconds after query command completion.
GEOMETRY DESC information - UFS Only.
mnand_cid_info cid
Card Identification Data (eMMC only)
enum __mnand_ffu_status MNAND_FFU_STATUS
mNAND UFS Field Firmware Update (FFU) status enumeration
MNAND_STATUS status
Return status of this query request.
Information on life time.
enum __mnand_eol_status MNAND_EOL_STATUS
mNAND End-of-Life status enumeration
char fw_version[MAX_FW_STR_LEN]
Firmware version.
struct __mnand_wr_info mnand_wr_info
Host cumulative written data information.
@ MNAND_EINVAL
Invalid parameter or operation.
char desc[128]
Chip description, mNAND specific.
static int mnand_is_refresh_available(mnand_chip *chip)
Checks if force refresh is available.
uint16_t enhanced1_cap_adj_fac
Enhanced area 1 capacity adjustment factor.
@ MNAND_ENOMEM
Memory allocation failed.
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 runnin...
uint32_t enhanced1_max_alloc
Maximum allocation for enhanced area 1.
@ MNAND_UFS_MICRON
Micron UFS device.
struct __mnand_csd_info mnand_csd_info
CSD information - eMMC only.
uint32_t total_age
Total age (if available)
uint8_t data2[144]
Second part of Configuration descriptor data as per JESD220C spec.
uint32_t enhanced2_max_alloc
Maximum allocation for enhanced area 2.
enum __mnand_status MNAND_STATUS
mNAND operation status codes
@ MNAND_MICRON
Micron eMMC device.
Write/Erase amplification information.
mnand_wr_info wcount
Host cumulative written data (units of 100MB) Written data is calculated as host cumulative written d...
uint64_t enh_start_addr
Enhanced area start address.
double avg_age
Average age in this region.
uint8_t data[512]
EXT CSD data, 512byte wide.
mnand_refresh_properties rfsh_properties
Refresh properties for the device.
struct __mnand_ages_element mnand_ages_info
Summary of ages.
uint8_t data3[144]
Third part of Configuration descriptor data as per JESD220C spec.
double percentage
Refresh percentage.
static int mnand_is_smart_summary_available(mnand_chip *chip)
Checks if smart summary information is available.
MNAND_STATUS mnand_update_smart_summary_info(mnand_chip *chip)
Updates the smart summary info in mNAND chip handle.
@ MNAND_EOL_DETECTED
Device has reached end-of-life condition.
#define MNAND_RUNTIME_BAD_BLOCK
uint32_t min_rfsh_interval
Minimum refresh interval(msec)
uint8_t data[72]
Geometry descriptor data as per JESD220C spec.
CONFIG DESC information - UFS Only.
struct __mnand_summary_element mnand_summary_element
Summary of given block type (or region)
#define MAX_PRN_STR_LEN
Maximum length of the product name string.
static int mnand_is_valid_block(mnand_block_info *blk)
Checks if a block is valid.
enum __mnand_fw_comparison_result MNAND_FW_COMPARE
mNAND firmware comparison result enumeration
struct __mnand_ufs_query_req * query
Pointer to array of query request structures.
@ MNAND_SAMSUNG51
Samsung eMMC 5.1 device.
uint32_t enhanced3_max_alloc
Maximum allocation for enhanced area 3.
mnand_geo_desc_info geo_desc
Geometry Descriptor (UFS only)
enum __mnand_storage_type MNAND_STORAGE_TYPE
mNAND storage type enumeration
struct __mnand_mmc_geo_info mnand_mmc_geo_info
MMC Geometry Information.
int factory_bb_cnt
Number of factory bad blocks, -1=invalid.
MNAND_STATUS mnand_get_current_lun(mnand_chip *chip, uint32_t *lun)
Get mnand current lun (UFS only).
uint8_t valid
Indicates if this entry is valid.
uint8_t data4[144]
Fourth part of Configuration descriptor data as per JESD220C spec.
MNAND_STATUS mnand_update_csd(mnand_chip *chip)
Updates the CSD field in mNAND chip handle.
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).
static int mnand_is_slc_block(mnand_block_info *blk)
Checks if a block is in the SLC region.
enum __mnand_device_type MNAND_DEVICE_TYPE
mNAND device type enumeration
@ MNAND_EIO
Input/Output error occurred.
@ MNAND_UFS
UFS storage device.
uint64_t sec_count
Total number of sectors in the device.
uint32_t fnand
Specifies the host cumulative written data (units of 100MB) from NAND.
uint8_t alloc_unit_size
Size of allocation unit.
union __mnand_geo_info mnand_geo_info
Device Geometry Information.
uint64_t hc_wp_grp_size
High-capacity write protect group size.
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.
uint32_t segment_size
Size of each segment.
uint16_t block_number
Block number, absolute.
void * priv
mNAND specific private handle
static int mnand_is_summary_available(mnand_chip *chip)
Checks if summary information is available.
uint8_t valid
Specifies whether the values indicated are vaild or not.
UFS Query Request Information Structure.
uint16_t block_type
Block type.
uint8_t opcode
Query operation opcode.
__mnand_storage_type
mNAND storage type enumeration
uint8_t progress_type
How the progress being presented.
@ MNAND_FFU_STATUS_INSTALL_FAILED
Indicates installing the firmware failed.
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 arg...
uint8_t buf_size
Size of the buffer in bytes.
mnand_summary_element mlc
MLC region summary.
int refresh_available
Indicates if force refresh is available.
struct __mnand_lu_info mnand_lu_info
Logical Unit information - UFS Only.
@ MNAND_HYNIX_F20
Hynix F20 device.
int fd
File descriptor to the device.
mnand_device_desc_info device_desc
Device Descriptor (UFS only)
@ MNAND_UNKNOWN_ERR
Unknown error occurred.
Logical Unit information - UFS Only.
static MNAND_STORAGE_TYPE mnand_get_storage_type(mnand_chip *chip)
Returns mnand storage type.
uint16_t spare_blocks
Number of spare blocks in this region.
union __mnand_life_time_element mnand_life_time_element
Information on life time element.
uint16_t block_age
Age (aka erase, p/e) count.
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.
Information on life time element.
double mlc_weaf
Specifies the MLC write/erase amplification.
#define MNAND_UNKNOWN_BAD_BLOCK
static int mnand_is_mlc_block(mnand_block_info *blk)
Checks if a block is in the MLC region.
@ MNAND_EOPEN
Failed to open device node.
int num_blocks
Number of blocks available.
Summary of given block type (or region)
MNAND_STATUS mnand_get_bkops_en(mnand_chip *chip, uint8_t *enabled)
Gets the status of background operations enable bit.
MNAND_STATUS mnand_enable_power_off_notification(mnand_chip *chip)
Enable power-off notification.
@ MNAND_UFS_TOSHIBA
Toshiba UFS device.
static int mnand_is_usable_block(mnand_block_info *blk)
Checks if a block is usable.
@ MNAND_EMMC
eMMC storage device
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).
@ MNAND_TOSHIBA
Toshiba eMMC device.
@ MNAND_FFU_STATUS_INTERNAL_ERROR
Indicates there was device internal error during FFU operation.
uint8_t max_lu
Maximum number of logical units supported.
@ MNAND_FFU_STATUS_SUCCESS
Indicates FFU operation was successful.
@ MNAND_BKOPS_EN_ERR
Background operations enable state not set to requested value.
MNAND_STATUS mnand_set_cache_en(mnand_chip *chip, uint8_t enable)
Enable/Disable cache on mNAND.
Information on refresh element.
uint32_t rfsh_unit_time_us
Time for each refresh operation(UFS only)
uint8_t lu_enabled
Indicates if this LU is enabled.
mnand_ufs_geo_info ufs_geo_info
UFS specific geometry information.
uint8_t idn
Query operation identifier.
@ MNAND_OK
Operation completed successfully.
@ MNAND_FFU_STATUS_GENERIC_ERROR
Indicates there was a generic error during the FFU process.
struct __mnand_refresh_progress mnand_refresh_progress
Information on refresh progress.
MMC Geometry Information.
uint16_t enhanced2_cap_adj_fac
Enhanced area 2 capacity adjustment factor.
uint16_t min_age
Minimum age in this region.
MNAND_STATUS mnand_get_lu_info(mnand_chip *chip, uint32_t lun, mnand_lu_info *lu_info)
Get mnand lu info (UFS only).
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.
char prn[MAX_PRN_STR_LEN]
Product Name.
@ MNAND_UNKNOWN
Unknown storage type - indicates error condition.
uint8_t index
Index value for the query operation.
Device Geometry Information.
MNAND_STATUS mnand_close(mnand_chip *chip)
Closes the mNAND device.
EXT CSD information - eMMC only.
void * priv_ops
mNAND vendor specific private operations
__mnand_device_type
mNAND device type enumeration
UFS Combo Query Request Information Structure.
uint32_t non_persist_max_alloc
Maximum allocation for non-persistent area.
CID information - eMMC only.
uint8_t * buffer
User buffer pointer for query data.
MNAND_STATUS mnand_set_bkops_en(mnand_chip *chip, uint8_t enable)
Sets the background operations enable bit.
MNAND_STATUS mnand_send_power_off_notification(mnand_chip *chip)
Send power-off notification.
@ MNAND_FFU_STATUS_ERROR_DOWNLOADING_FIRMWARE
Indicates downloading the firmware onto the device failed.
MNAND_STATUS mnand_get_geo_info(mnand_chip *chip, mnand_geo_info *geo_info)
Extract mnand geometry info.
@ MNAND_EOL_OK
Device has not reached end-of-life.
#define MAX_ERASE_CNT
Maximum erase count a block can have.
uint16_t enhanced3_cap_adj_fac
Enhanced area 3 capacity adjustment factor.