NVIDIA DriveOS Linux SDK API Reference

7.2.5.0 Early Access Release
nvmnand.h
Go to the documentation of this file.
1 /*
2 * SPDX-FileCopyrightText: Copyright (c) 2013-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4 *
5 * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6 * property and proprietary rights in and to this material, related
7 * documentation and any modifications thereto. Any use, reproduction,
8 * disclosure or distribution of this material and related documentation
9 * without an express license agreement from NVIDIA CORPORATION or
10 * its affiliates is strictly prohibited.
11 */
12 
23 #ifndef __NV_MNAND_H__
24 #define __NV_MNAND_H__
25 
26 #include <stdio.h>
27 #include <stdint.h>
28 #include <stdbool.h>
29 #include <assert.h>
30 
31 #if defined(__cplusplus)
32 extern "C"
33 {
34 #endif
35 
54 #define MAX_ERASE_CNT 0xFFFF
55 
59 #ifndef SECTOR_SZ
60 #define SECTOR_SZ 512
61 #endif
62 
66 #define MNAND_READ_CACHE_ENABLE (1 << 0)
67 #define MNAND_WRITE_CACHE_ENABLE (1 << 1)
68 
70 #define MAX_FW_STR_LEN (32U)
71 
72 #define MAX_PRN_STR_LEN (64U)
73 
74 /* forward declaration */
75 struct __mnand_chip;
76 struct __mnand_operations;
77 
84 typedef struct __mnand_block_info {
88  uint16_t block_number;
92  uint16_t block_age;
96  uint16_t block_type;
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)
104 
107  uint16_t valid;
109 
120  uint16_t spare_blocks;
124  double percentage;
126 
133 typedef struct __mnand_life_time_info {
141  uint8_t life_time_type;
142  #define MNAND_LIFETIME_INVALID (1 << 0)
143  #define MNAND_LIFETIME_IN_BLOCK (1 << 1)
144  #define MNAND_LIFETIME_IN_PERCENT (1 << 2)
146 
153 typedef union __mnand_refresh_element {
157  uint16_t block;
161  double percentage;
163 
169 typedef struct __mnand_refresh_progress {
177  uint8_t progress_type;
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)
182 
192  uint32_t rfsh_days;
214 
220 typedef struct __mnand_ages_element {
224  uint16_t min_age;
228  uint16_t max_age;
232  double avg_age;
236  uint32_t total_age;
240  uint8_t valid;
242 
250 typedef struct __mnand_wr_info {
254  uint32_t fnand;
258  uint32_t fram;
263  uint8_t valid;
264 } mnand_wr_info;
265 
275  double slc_weaf;
279  double mlc_weaf;
284  uint8_t valid;
286 
293 typedef struct __mnand_summary_element {
298 
303 
309 
314 
318  uint8_t valid;
320 
327 typedef struct __mnand_summary_info {
332 
337 
342 
347 
352 
356  int32_t spare_bcnt;
358 
364 typedef struct __mnand_cid_info {
368  uint8_t data[16];
370 
376 typedef struct __mnand_csd_info {
380  uint8_t data[16];
382 
388 typedef struct __mnand_ext_csd_info {
392  uint8_t data[512];
394 
400 typedef struct __mnand_device_desc_info {
404  uint8_t data[64];
406 
412 typedef struct __mnand_config_desc_info {
416  uint8_t data1[144];
420  uint8_t data2[144];
424  uint8_t data3[144];
428  uint8_t data4[144];
430 
436 typedef struct __mnand_geo_desc_info {
440  uint8_t data[72];
442 
448 typedef struct __mnand_unit_desc_info {
452  uint8_t data[19];
454 
461 typedef struct __mnand_mmc_geo_info {
465  uint64_t sec_count;
466 
470  uint64_t enh_size_mult;
471 
475  uint64_t enh_start_addr;
476 
480  uint64_t hc_wp_grp_size;
481 
486 
491 
496 
500  uint64_t user_capacity;
502 
509 typedef struct __mnand_ufs_geo_info {
514 
518  uint8_t max_lu;
519 
523  uint32_t segment_size;
524 
529 
534 
539 
544 
549 
554 
559 
564 
569 
574 
579 
584 
589 
595 
602 typedef union __mnand_geo_info {
607 
613 
619 typedef struct __mnand_lu_info {
623  uint8_t lu_enabled;
624 
628  uint8_t memory_type;
629 
633  uint32_t num_alloc_units;
634 
638  uint8_t logical_blk_sz;
639 } mnand_lu_info;
640 
646 typedef enum __mnand_device_type {
670 
676 typedef enum __mnand_storage_type {
684 
690 typedef enum __mnand_eol_status {
696 
704  /* Passed FW version is same as the current FW version on Device */
706  /* Passed FW version is greater than current FW version on Device */
708  /* Passed FW version is lesser than current FW version on Device */
711 
717 typedef enum __mnand_ffu_status {
737 
743 typedef enum __mnand_status {
745  MNAND_OK = 0,
760 } MNAND_STATUS;
761 
769 struct __mnand_chip {
773  int fd;
774 
778  uint32_t identifier;
779 
783  char desc[128];
784 
789 
794 
798  void *priv_ops;
799 
804 
810 
815 
820 
825 
830 
835 
840 
845 
850 
855 
860 
865 
870 
875 
880 
884  uint32_t card_status;
885 
890 
895 
899  void *priv;
900 };
901 
902 typedef struct __mnand_chip mnand_chip;
903 
914  uint8_t opcode;
915 
919  uint8_t idn;
920 
925  uint8_t index;
926 
931  uint8_t selector;
932 
936  uint8_t buf_size;
937 
945  uint8_t *buffer;
946 
950  uint32_t delay;
951 
956 };
957 
968  uint8_t num_cmds;
969 
975  uint8_t need_cq_empty;
976 
982 };
983 
986 
987 /* inline helpers */
988 
1010 {
1011  return (blk->valid != 0);
1012 }
1013 
1035 static inline int mnand_is_bad_block(mnand_block_info *blk)
1036 {
1037  return mnand_is_valid_block(blk) && ((blk->block_type &
1039  MNAND_RUNTIME_BAD_BLOCK)) || (blk->block_age == MAX_ERASE_CNT)) ? 1 : 0;
1040 }
1041 
1064 {
1065  return (!mnand_is_valid_block(blk) || mnand_is_bad_block(blk) ||
1066  (blk->block_type & MNAND_SYSTEM_BLOCK)) ? 0 : 1;
1067 }
1068 
1094  uint16_t blk_type)
1095 {
1096  return (mnand_is_usable_block(blk) && (blk->block_type & blk_type)) ? 1 : 0;
1097 }
1098 
1120 static inline int mnand_is_slc_block(mnand_block_info *blk)
1121 {
1122  return mnand_is_valid_block(blk) &&
1123  (blk->block_type & MNAND_SLC_BLOCK) ? 1 : 0;
1124 }
1125 
1147 static inline int mnand_is_mlc_block(mnand_block_info *blk)
1148 {
1149  return mnand_is_valid_block(blk) &&
1150  (blk->block_type & MNAND_MLC_BLOCK) ? 1 : 0;
1151 }
1152 
1173 static inline int mnand_is_summary_available(mnand_chip *chip)
1174 {
1175  return (chip->summary_available != 0);
1176 }
1177 
1199 {
1200  return (chip->smart_summary_available != 0);
1201 }
1202 
1223 static inline int mnand_is_refresh_available(mnand_chip *chip)
1224 {
1225  return (chip->refresh_available != 0);
1226 }
1227 
1250 {
1251  return (chip->num_blocks > 0);
1252 }
1253 
1276 {
1277  return (chip->storage_type);
1278 }
1279 
1280 /* prototypes for wrapper functions */
1281 
1312 MNAND_STATUS mnand_get_bkops_en(mnand_chip *chip, uint8_t *enabled);
1313 
1342 MNAND_STATUS mnand_get_bkops_status(mnand_chip *chip, uint8_t *stat);
1343 
1375 MNAND_STATUS mnand_set_bkops_en(mnand_chip *chip, uint8_t enable);
1376 
1406 
1436 
1467 
1495 MNAND_STATUS mnand_open(const char *devname, mnand_chip *chip);
1496 
1524 
1564 MNAND_STATUS mnand_bind(int fd, mnand_chip *chip);
1565 
1601 
1633 
1665 
1697 
1729 
1762 
1794 
1827 
1859 
1891 MNAND_STATUS mnand_send_refresh(mnand_chip *chip, uint8_t block_type,
1892  int num_blocks, uint32_t rfsh_unit_time_us,
1893  mnand_refresh_progress *progress);
1894 
1926 MNAND_STATUS mnand_extract_age_info(mnand_chip *chip, int block_type,
1927  uint64_t *total_age, uint32_t *blk_count, double *avg_age);
1928 
1957 MNAND_STATUS mnand_get_refresh_progress(mnand_chip *chip, double *rfsh_progress);
1958 
1988  mnand_life_time_info *life_time_info);
1989 
2020 MNAND_STATUS mnand_set_cache_en(mnand_chip *chip, uint8_t enable);
2021 
2050 
2080 int mnand_read_sectors_virt(mnand_chip *chip, unsigned int start_sector,
2081  unsigned int sector_cnt, void *virtaddr);
2082 
2112 int mnand_read_sectors_phys(mnand_chip *chip, unsigned int start_sector,
2113  unsigned int sector_cnt, off_t physaddr);
2114 
2143 
2174 MNAND_STATUS mnand_get_cache_en(mnand_chip *chip, uint8_t *enabled);
2175 
2206 MNAND_STATUS mnand_switch_cmd(mnand_chip *chip, uint8_t index,
2207  uint8_t value, char *errmsg_prepend);
2208 
2238 
2268 MNAND_STATUS mnand_get_lu_info(mnand_chip *chip, uint32_t lun,
2269  mnand_lu_info *lu_info);
2270 
2299 MNAND_STATUS mnand_get_current_lun(mnand_chip *chip, uint32_t *lun);
2300 
2338  mnand_ufs_query_req *query_req, uint8_t num_cmds, uint8_t need_cq_empty,
2339  uint8_t ret_on_error);
2340 
2370 
2448 MNAND_STATUS mnand_ffu(mnand_chip *chip, char *fw_file);
2449 
2479 
2507 MNAND_STATUS mnand_get_fw_version(mnand_chip *chip, char *fw_version);
2508 
2542 
2569 MNAND_STATUS mnand_is_ffu_ready(mnand_chip *chip, bool *res);
2570 
2573 #if defined(__cplusplus)
2574 }
2575 #endif /* __cplusplus */
2576 
2577 #endif /* __NV_MNAND_H__ */
mnand_check_eol_status
MNAND_STATUS mnand_check_eol_status(mnand_chip *chip, MNAND_EOL_STATUS *eol_status)
Checks the EOL (End of Life) status.
mnand_open
MNAND_STATUS mnand_open(const char *devname, mnand_chip *chip)
Opens and initializes the mNAND device.
__mnand_life_time_info::life_time
mnand_life_time_element life_time
Life time information.
Definition: nvmnand.h:137
__mnand_refresh_properties::def_rfsh_interval
uint32_t def_rfsh_interval
Default refresh interval(msec)
Definition: nvmnand.h:196
MNAND_MANF_BAD_BLOCK
#define MNAND_MANF_BAD_BLOCK
Definition: nvmnand.h:101
__mnand_chip::storage_type
MNAND_STORAGE_TYPE storage_type
Storage type (eMMC/UFS)
Definition: nvmnand.h:894
__mnand_ufs_geo_info::enhanced4_cap_adj_fac
uint16_t enhanced4_cap_adj_fac
Enhanced area 4 capacity adjustment factor.
Definition: nvmnand.h:593
mnand_unit_desc_info
struct __mnand_unit_desc_info mnand_unit_desc_info
UNIT DESC information - UFS Only.
mnand_life_time_info
struct __mnand_life_time_info mnand_life_time_info
Information on life time.
__mnand_lu_info::memory_type
uint8_t memory_type
Memory type of this LU.
Definition: nvmnand.h:628
__mnand_mmc_geo_info::enh_size_mult
uint64_t enh_size_mult
Enhanced area size multiplier.
Definition: nvmnand.h:470
mnand_get_ffu_status
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_ffu_status
mNAND UFS Field Firmware Update (FFU) status enumeration
Definition: nvmnand.h:717
__mnand_device_desc_info
DEVICE DESC information - UFS Only.
Definition: nvmnand.h:400
__mnand_chip::csd
mnand_csd_info csd
Card Specific Data (eMMC only)
Definition: nvmnand.h:854
__mnand_mmc_geo_info::partition_size_alignment
uint64_t partition_size_alignment
Partition size alignment requirement.
Definition: nvmnand.h:495
mnand_test_multi_cmd
MNAND_STATUS mnand_test_multi_cmd(mnand_chip *chip)
Test IOCTL MULTI CMD.
__mnand_chip::priv_chip_ops
void * priv_chip_ops
mNAND storage specific private operations
Definition: nvmnand.h:803
__mnand_csd_info
CSD information - eMMC only.
Definition: nvmnand.h:376
__mnand_mmc_geo_info::max_enh_size_mult
uint64_t max_enh_size_mult
Maximum enhanced area size multiplier.
Definition: nvmnand.h:490
mnand_update_cid
MNAND_STATUS mnand_update_cid(mnand_chip *chip)
Updates the CID field in mNAND chip handle.
__mnand_refresh_progress
Information on refresh progress.
Definition: nvmnand.h:169
MNAND_SAMSUNG50
@ MNAND_SAMSUNG50
Samsung eMMC 5.0 device.
Definition: nvmnand.h:658
__mnand_fw_comparison_result
__mnand_fw_comparison_result
mNAND firmware comparison result enumeration
Definition: nvmnand.h:703
__mnand_geo_info::mmc_geo_info
mnand_mmc_geo_info mmc_geo_info
eMMC specific geometry information
Definition: nvmnand.h:606
MNAND_HYNIX_F26
@ MNAND_HYNIX_F26
Hynix F26 device.
Definition: nvmnand.h:650
__mnand_refresh_progress::progress
mnand_refresh_element progress
Current refresh progress.
Definition: nvmnand.h:173
MNAND_HYNIX_F16
@ MNAND_HYNIX_F16
Hynix F16 device.
Definition: nvmnand.h:654
mnand_update_block_info
MNAND_STATUS mnand_update_block_info(mnand_chip *chip)
Updates the block info list in mNAND chip handle.
mnand_update_xcsd
MNAND_STATUS mnand_update_xcsd(mnand_chip *chip)
Updates the EXT CSD field in mNAND chip handle.
__mnand_summary_info::spare_bcnt
int32_t spare_bcnt
Number of remaining spare blocks, -1=invalid.
Definition: nvmnand.h:356
__mnand_ufs_geo_info
UFS Geometry Information.
Definition: nvmnand.h:509
__mnand_chip::dev_type
MNAND_DEVICE_TYPE dev_type
Device type identifier.
Definition: nvmnand.h:889
__mnand_chip::summary
mnand_summary_info * summary
Summary information, not NULL when available.
Definition: nvmnand.h:844
MNAND_FFU_STATUS_NO_INFORMATION
@ MNAND_FFU_STATUS_NO_INFORMATION
Indicates there is no informatuon available about the FFU operation.
Definition: nvmnand.h:731
__mnand_summary_element::eaf
mnand_ufs_write_erase_amplification eaf
Erase Amplification of the device.
Definition: nvmnand.h:313
mnand_cid_info
struct __mnand_cid_info mnand_cid_info
CID information - eMMC only.
__mnand_chip::cfg_desc
mnand_config_desc_info cfg_desc
Configuration Descriptor (UFS only)
Definition: nvmnand.h:869
mnand_geo_desc_info
struct __mnand_geo_desc_info mnand_geo_desc_info
GEOMETRY DESC information - UFS Only.
mnand_device_desc_info
struct __mnand_device_desc_info mnand_device_desc_info
DEVICE DESC information - UFS Only.
mnand_extract_age_info
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.
__mnand_life_time_element::percentage
double percentage
Life time in percentage.
Definition: nvmnand.h:124
mnand_is_ffu_ready
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_summary_element::life
mnand_life_time_info life
Life time information for this region.
Definition: nvmnand.h:297
MNAND_FFU_STATUS_FW_CORRUPTION_ERROR
@ MNAND_FFU_STATUS_FW_CORRUPTION_ERROR
Indicates the firmware that was passed for the FFU operation was corrupted.
Definition: nvmnand.h:725
MNAND_UFS_SAMSUNG
@ MNAND_UFS_SAMSUNG
Samsung UFS device.
Definition: nvmnand.h:666
mnand_ufs_geo_info
struct __mnand_ufs_geo_info mnand_ufs_geo_info
UFS Geometry Information.
__mnand_ages_element::max_age
uint16_t max_age
Maximum age in this region.
Definition: nvmnand.h:228
__mnand_device_desc_info::data
uint8_t data[64]
Device descriptor data, 64byte wide.
Definition: nvmnand.h:404
mnand_get_bkops_status
MNAND_STATUS mnand_get_bkops_status(mnand_chip *chip, uint8_t *stat)
Gets the status of background operations.
__mnand_mmc_geo_info::hc_erase_grp_size
uint64_t hc_erase_grp_size
High-capacity erase group size.
Definition: nvmnand.h:485
mnand_ufs_write_erase_amplification::valid
uint8_t valid
Specifies whether the values indicated are vaild or not.
Definition: nvmnand.h:284
__mnand_unit_desc_info
UNIT DESC information - UFS Only.
Definition: nvmnand.h:448
__mnand_summary_info
Aggregation of summaries.
Definition: nvmnand.h:327
__mnand_operations
mNAND part/vendor specific operation block
Definition: nvmnand_part_ops.h:138
__mnand_unit_desc_info::data
uint8_t data[19]
Unit descriptor data as per JESD220C spec.
Definition: nvmnand.h:452
__mnand_refresh_properties
Information on refresh properties.
Definition: nvmnand.h:188
MNAND_PASSED_FW_VERSION_LESSER
@ MNAND_PASSED_FW_VERSION_LESSER
Definition: nvmnand.h:709
__mnand_ufs_geo_info::supported_memory_types
uint16_t supported_memory_types
Supported memory types bitmask.
Definition: nvmnand.h:533
mnand_set_bkops_start
MNAND_STATUS mnand_set_bkops_start(mnand_chip *chip)
Mark the start of BKOPS.
mnand_refresh_properties
struct __mnand_refresh_properties mnand_refresh_properties
Information on refresh properties.
MNAND_MLC_BLOCK
#define MNAND_MLC_BLOCK
Definition: nvmnand.h:98
__mnand_refresh_properties::shutdown_rfsh_interval
uint32_t shutdown_rfsh_interval
Minimum shutdown refresh interval(msec)
Definition: nvmnand.h:204
__mnand_cid_info::data
uint8_t data[16]
CID data, 128bit wide.
Definition: nvmnand.h:368
mnand_send_combo_query_req
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_chip::xcsd
mnand_ext_csd_info xcsd
Extended Card Specific Data (eMMC only)
Definition: nvmnand.h:859
__mnand_ufs_combo_query_req::num_cmds
uint8_t num_cmds
Number of Query Commands in this combo request.
Definition: nvmnand.h:968
mnand_is_block_info_available
static int mnand_is_block_info_available(mnand_chip *chip)
Checks if block information is available.
Definition: nvmnand.h:1249
MNAND_CATCH_ALL
@ MNAND_CATCH_ALL
Default catch-all type when no specific match is found.
Definition: nvmnand.h:648
__mnand_chip::card_status
uint32_t card_status
Current card status.
Definition: nvmnand.h:884
mnand_summary_info
struct __mnand_summary_info mnand_summary_info
Aggregation of summaries.
mnand_get_cache_en
MNAND_STATUS mnand_get_cache_en(mnand_chip *chip, uint8_t *enabled)
Determine if eMMC cache is enabled.
MNAND_SYSTEM_BLOCK
#define MNAND_SYSTEM_BLOCK
Definition: nvmnand.h:103
mnand_ext_csd_info
struct __mnand_ext_csd_info mnand_ext_csd_info
EXT CSD information - eMMC only.
mnand_read_sectors_virt
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).
__mnand_wr_info::fram
uint32_t fram
Specifies the host cumulative written data (units of 100MB) from RAM.
Definition: nvmnand.h:258
mnand_trim_all
MNAND_STATUS mnand_trim_all(mnand_chip *chip)
Trimming the whole device.
MNAND_UNSUPPORTED
@ MNAND_UNSUPPORTED
Operation not supported by device.
Definition: nvmnand.h:755
mnand_is_bad_block
static int mnand_is_bad_block(mnand_block_info *blk)
Checks if a block is marked as bad.
Definition: nvmnand.h:1035
__mnand_ufs_query_req::selector
uint8_t selector
Selector value for the query operation.
Definition: nvmnand.h:931
mnand_flush_cache
MNAND_STATUS mnand_flush_cache(mnand_chip *chip)
Flush cache on mNAND.
MNAND_FFU_STATUS_RESERVED_ERROR
@ MNAND_FFU_STATUS_RESERVED_ERROR
Indicates there was a reserved error during the FFU process.
Definition: nvmnand.h:735
MNAND_PASSED_FW_VERSION_SAME
@ MNAND_PASSED_FW_VERSION_SAME
Definition: nvmnand.h:705
mnand_bind
MNAND_STATUS mnand_bind(int fd, mnand_chip *chip)
Binds the mNAND chip.
__mnand_chip::identifier
uint32_t identifier
32bit magic number for plausibilty check.
Definition: nvmnand.h:778
__mnand_chip::ffu_available
int ffu_available
Indicates if FFU (Field Firmware Update) is available.
Definition: nvmnand.h:824
mnand_block_info
struct __mnand_block_info mnand_block_info
Information per block.
__mnand_refresh_element::block
uint16_t block
Last block being refresh.
Definition: nvmnand.h:157
__mnand_ufs_geo_info::sys_code_max_alloc
uint32_t sys_code_max_alloc
Maximum allocation for system code area.
Definition: nvmnand.h:538
__mnand_csd_info::data
uint8_t data[16]
CSD data, 128bit wide.
Definition: nvmnand.h:380
__mnand_chip::smart_summary_available
int smart_summary_available
Indicates if smart summary information is available.
Definition: nvmnand.h:839
MNAND_FFU_STATUS_FW_VERSION_MISMATCH
@ MNAND_FFU_STATUS_FW_VERSION_MISMATCH
Indicates the frimware version does not match
Definition: nvmnand.h:727
mnand_update_summary_info
MNAND_STATUS mnand_update_summary_info(mnand_chip *chip)
Updates the summary info in mNAND chip handle.
mnand_config_desc_info
struct __mnand_config_desc_info mnand_config_desc_info
CONFIG DESC information - UFS Only.
__mnand_summary_info::runtime_bb_cnt
int runtime_bb_cnt
Number of runtime bad blocks, -1=invalid.
Definition: nvmnand.h:351
__mnand_block_info::valid
uint16_t valid
Indicates if this entry is valid.
Definition: nvmnand.h:107
__mnand_eol_status
__mnand_eol_status
mNAND End-of-Life status enumeration
Definition: nvmnand.h:690
__mnand_wr_info
Host cumulative written data information.
Definition: nvmnand.h:250
mnand_ufs_write_erase_amplification::slc_weaf
double slc_weaf
Specifies the SLC write/erase amplification.
Definition: nvmnand.h:275
__mnand_lu_info::logical_blk_sz
uint8_t logical_blk_sz
Logical block size.
Definition: nvmnand.h:638
__mnand_chip::block_info
mnand_block_info * block_info
Block info list, indexed by num_blocks.
Definition: nvmnand.h:814
__mnand_block_info
Information per block.
Definition: nvmnand.h:84
MAX_FW_STR_LEN
#define MAX_FW_STR_LEN
Maximum length of the firmware string.
Definition: nvmnand.h:70
__mnand_config_desc_info::data1
uint8_t data1[144]
First part of Configuration descriptor data as per JESD220C spec.
Definition: nvmnand.h:416
__mnand_chip::summary_available
int summary_available
Indicates if summary information is available.
Definition: nvmnand.h:834
mnand_get_refresh_progress
MNAND_STATUS mnand_get_refresh_progress(mnand_chip *chip, double *rfsh_progress)
Extracts refresh progress from the mNAND chip.
__mnand_summary_element::ages
mnand_ages_info ages
Ages information for this region.
Definition: nvmnand.h:302
mnand_update_card_status
MNAND_STATUS mnand_update_card_status(mnand_chip *chip)
Updates the card status field in mNAND chip handle.
__mnand_refresh_properties::rfsh_days
uint32_t rfsh_days
Whole chip refreshes in given days.
Definition: nvmnand.h:192
__mnand_refresh_properties::rfsh_calibrate_cnt
uint32_t rfsh_calibrate_cnt
Minimum refreshes before re-calibration.
Definition: nvmnand.h:208
MNAND_PASSED_FW_VERSION_GREATER
@ MNAND_PASSED_FW_VERSION_GREATER
Definition: nvmnand.h:707
__mnand_ufs_geo_info::non_persist_cap_adj_fac
uint16_t non_persist_cap_adj_fac
Non-persistent capacity adjustment factor.
Definition: nvmnand.h:553
mnand_unbind
MNAND_STATUS mnand_unbind(mnand_chip *chip)
Unbinds (releases) the mNAND chip.
__mnand_ufs_geo_info::sys_code_cap_adj_fac
uint16_t sys_code_cap_adj_fac
System code capacity adjustment factor.
Definition: nvmnand.h:543
__mnand_life_time_info::life_time_type
uint8_t life_time_type
How the lifetime being presented.
Definition: nvmnand.h:141
__mnand_summary_element::valid
uint8_t valid
Indicates if this entry is valid.
Definition: nvmnand.h:318
__mnand_mmc_geo_info::user_capacity
uint64_t user_capacity
Total user partition capacity.
Definition: nvmnand.h:500
__mnand_status
__mnand_status
mNAND operation status codes
Definition: nvmnand.h:743
mnand_ufs_write_erase_amplification
struct mnand_ufs_write_erase_amplification mnand_ufs_write_erase_amplification
Write/Erase amplification information.
mnand_extract_life_time_info
MNAND_STATUS mnand_extract_life_time_info(mnand_chip *chip, mnand_life_time_info *life_time_info)
Extracts lifetime information from the mNAND chip.
__mnand_ufs_combo_query_req::need_cq_empty
uint8_t need_cq_empty
Flag indicating if command queue must be empty.
Definition: nvmnand.h:975
__mnand_summary_info::slc
mnand_summary_element slc
SLC region summary.
Definition: nvmnand.h:336
__mnand_ufs_geo_info::total_raw_capacity
uint64_t total_raw_capacity
Total raw device capacity.
Definition: nvmnand.h:513
__mnand_lu_info::num_alloc_units
uint32_t num_alloc_units
Number of allocation units.
Definition: nvmnand.h:633
__mnand_ufs_geo_info::enhanced4_max_alloc
uint32_t enhanced4_max_alloc
Maximum allocation for enhanced area 4.
Definition: nvmnand.h:588
__mnand_chip::unit_desc
mnand_unit_desc_info unit_desc
Unit Descriptor (UFS only)
Definition: nvmnand.h:879
mnand_refresh_element
union __mnand_refresh_element mnand_refresh_element
Information on refresh element.
__mnand_summary_info::total
mnand_summary_element total
Per chip summary.
Definition: nvmnand.h:341
__mnand_ufs_query_req::delay
uint32_t delay
Delay in milliseconds after query command completion.
Definition: nvmnand.h:950
__mnand_geo_desc_info
GEOMETRY DESC information - UFS Only.
Definition: nvmnand.h:436
__mnand_chip::cid
mnand_cid_info cid
Card Identification Data (eMMC only)
Definition: nvmnand.h:849
MNAND_FFU_STATUS
enum __mnand_ffu_status MNAND_FFU_STATUS
mNAND UFS Field Firmware Update (FFU) status enumeration
__mnand_ufs_query_req::status
MNAND_STATUS status
Return status of this query request.
Definition: nvmnand.h:955
__mnand_life_time_info
Information on life time.
Definition: nvmnand.h:133
MNAND_EOL_STATUS
enum __mnand_eol_status MNAND_EOL_STATUS
mNAND End-of-Life status enumeration
__mnand_chip::fw_version
char fw_version[MAX_FW_STR_LEN]
Firmware version.
Definition: nvmnand.h:793
mnand_wr_info
struct __mnand_wr_info mnand_wr_info
Host cumulative written data information.
MNAND_EINVAL
@ MNAND_EINVAL
Invalid parameter or operation.
Definition: nvmnand.h:751
__mnand_chip::desc
char desc[128]
Chip description, mNAND specific.
Definition: nvmnand.h:783
mnand_is_refresh_available
static int mnand_is_refresh_available(mnand_chip *chip)
Checks if force refresh is available.
Definition: nvmnand.h:1223
__mnand_ufs_geo_info::enhanced1_cap_adj_fac
uint16_t enhanced1_cap_adj_fac
Enhanced area 1 capacity adjustment factor.
Definition: nvmnand.h:563
MNAND_ENOMEM
@ MNAND_ENOMEM
Memory allocation failed.
Definition: nvmnand.h:747
mnand_compare_fw_version
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...
__mnand_ufs_geo_info::enhanced1_max_alloc
uint32_t enhanced1_max_alloc
Maximum allocation for enhanced area 1.
Definition: nvmnand.h:558
MNAND_UFS_MICRON
@ MNAND_UFS_MICRON
Micron UFS device.
Definition: nvmnand.h:668
mnand_csd_info
struct __mnand_csd_info mnand_csd_info
CSD information - eMMC only.
__mnand_ages_element::total_age
uint32_t total_age
Total age (if available)
Definition: nvmnand.h:236
__mnand_config_desc_info::data2
uint8_t data2[144]
Second part of Configuration descriptor data as per JESD220C spec.
Definition: nvmnand.h:420
__mnand_ufs_geo_info::enhanced2_max_alloc
uint32_t enhanced2_max_alloc
Maximum allocation for enhanced area 2.
Definition: nvmnand.h:568
MNAND_STATUS
enum __mnand_status MNAND_STATUS
mNAND operation status codes
MNAND_MICRON
@ MNAND_MICRON
Micron eMMC device.
Definition: nvmnand.h:656
mnand_ufs_write_erase_amplification
Write/Erase amplification information.
Definition: nvmnand.h:271
__mnand_summary_element::wcount
mnand_wr_info wcount
Host cumulative written data (units of 100MB) Written data is calculated as host cumulative written d...
Definition: nvmnand.h:308
__mnand_mmc_geo_info::enh_start_addr
uint64_t enh_start_addr
Enhanced area start address.
Definition: nvmnand.h:475
__mnand_ages_element::avg_age
double avg_age
Average age in this region.
Definition: nvmnand.h:232
__mnand_ext_csd_info::data
uint8_t data[512]
EXT CSD data, 512byte wide.
Definition: nvmnand.h:392
__mnand_chip::rfsh_properties
mnand_refresh_properties rfsh_properties
Refresh properties for the device.
Definition: nvmnand.h:829
mnand_ages_info
struct __mnand_ages_element mnand_ages_info
Summary of ages.
__mnand_config_desc_info::data3
uint8_t data3[144]
Third part of Configuration descriptor data as per JESD220C spec.
Definition: nvmnand.h:424
__mnand_refresh_element::percentage
double percentage
Refresh percentage.
Definition: nvmnand.h:161
mnand_is_smart_summary_available
static int mnand_is_smart_summary_available(mnand_chip *chip)
Checks if smart summary information is available.
Definition: nvmnand.h:1198
mnand_update_smart_summary_info
MNAND_STATUS mnand_update_smart_summary_info(mnand_chip *chip)
Updates the smart summary info in mNAND chip handle.
MNAND_EOL_DETECTED
@ MNAND_EOL_DETECTED
Device has reached end-of-life condition.
Definition: nvmnand.h:694
MNAND_RUNTIME_BAD_BLOCK
#define MNAND_RUNTIME_BAD_BLOCK
Definition: nvmnand.h:102
__mnand_refresh_properties::min_rfsh_interval
uint32_t min_rfsh_interval
Minimum refresh interval(msec)
Definition: nvmnand.h:200
__mnand_geo_desc_info::data
uint8_t data[72]
Geometry descriptor data as per JESD220C spec.
Definition: nvmnand.h:440
__mnand_config_desc_info
CONFIG DESC information - UFS Only.
Definition: nvmnand.h:412
mnand_summary_element
struct __mnand_summary_element mnand_summary_element
Summary of given block type (or region)
MAX_PRN_STR_LEN
#define MAX_PRN_STR_LEN
Maximum length of the product name string.
Definition: nvmnand.h:72
mnand_is_valid_block
static int mnand_is_valid_block(mnand_block_info *blk)
Checks if a block is valid.
Definition: nvmnand.h:1009
MNAND_FW_COMPARE
enum __mnand_fw_comparison_result MNAND_FW_COMPARE
mNAND firmware comparison result enumeration
__mnand_ufs_combo_query_req::query
struct __mnand_ufs_query_req * query
Pointer to array of query request structures.
Definition: nvmnand.h:981
MNAND_SAMSUNG51
@ MNAND_SAMSUNG51
Samsung eMMC 5.1 device.
Definition: nvmnand.h:660
MNAND_SLC_BLOCK
#define MNAND_SLC_BLOCK
Definition: nvmnand.h:99
__mnand_ufs_geo_info::enhanced3_max_alloc
uint32_t enhanced3_max_alloc
Maximum allocation for enhanced area 3.
Definition: nvmnand.h:578
__mnand_chip::geo_desc
mnand_geo_desc_info geo_desc
Geometry Descriptor (UFS only)
Definition: nvmnand.h:874
MNAND_STORAGE_TYPE
enum __mnand_storage_type MNAND_STORAGE_TYPE
mNAND storage type enumeration
mnand_mmc_geo_info
struct __mnand_mmc_geo_info mnand_mmc_geo_info
MMC Geometry Information.
__mnand_summary_info::factory_bb_cnt
int factory_bb_cnt
Number of factory bad blocks, -1=invalid.
Definition: nvmnand.h:346
mnand_get_current_lun
MNAND_STATUS mnand_get_current_lun(mnand_chip *chip, uint32_t *lun)
Get mnand current lun (UFS only).
__mnand_ages_element::valid
uint8_t valid
Indicates if this entry is valid.
Definition: nvmnand.h:240
__mnand_config_desc_info::data4
uint8_t data4[144]
Fourth part of Configuration descriptor data as per JESD220C spec.
Definition: nvmnand.h:428
mnand_update_csd
MNAND_STATUS mnand_update_csd(mnand_chip *chip)
Updates the CSD field in mNAND chip handle.
mnand_switch_cmd
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).
mnand_is_slc_block
static int mnand_is_slc_block(mnand_block_info *blk)
Checks if a block is in the SLC region.
Definition: nvmnand.h:1120
MNAND_DEVICE_TYPE
enum __mnand_device_type MNAND_DEVICE_TYPE
mNAND device type enumeration
MNAND_EIO
@ MNAND_EIO
Input/Output error occurred.
Definition: nvmnand.h:749
MNAND_UFS
@ MNAND_UFS
UFS storage device.
Definition: nvmnand.h:680
__mnand_mmc_geo_info::sec_count
uint64_t sec_count
Total number of sectors in the device.
Definition: nvmnand.h:465
__mnand_wr_info::fnand
uint32_t fnand
Specifies the host cumulative written data (units of 100MB) from NAND.
Definition: nvmnand.h:254
__mnand_ufs_geo_info::alloc_unit_size
uint8_t alloc_unit_size
Size of allocation unit.
Definition: nvmnand.h:528
mnand_geo_info
union __mnand_geo_info mnand_geo_info
Device Geometry Information.
__mnand_mmc_geo_info::hc_wp_grp_size
uint64_t hc_wp_grp_size
High-capacity write protect group size.
Definition: nvmnand.h:480
mnand_send_refresh
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.
__mnand_ufs_geo_info::segment_size
uint32_t segment_size
Size of each segment.
Definition: nvmnand.h:523
__mnand_ages_element
Summary of ages.
Definition: nvmnand.h:220
__mnand_block_info::block_number
uint16_t block_number
Block number, absolute.
Definition: nvmnand.h:88
__mnand_chip::priv
void * priv
mNAND specific private handle
Definition: nvmnand.h:899
mnand_is_summary_available
static int mnand_is_summary_available(mnand_chip *chip)
Checks if summary information is available.
Definition: nvmnand.h:1173
__mnand_wr_info::valid
uint8_t valid
Specifies whether the values indicated are vaild or not.
Definition: nvmnand.h:263
__mnand_ufs_query_req
UFS Query Request Information Structure.
Definition: nvmnand.h:910
__mnand_block_info::block_type
uint16_t block_type
Block type.
Definition: nvmnand.h:96
__mnand_ufs_query_req::opcode
uint8_t opcode
Query operation opcode.
Definition: nvmnand.h:914
__mnand_storage_type
__mnand_storage_type
mNAND storage type enumeration
Definition: nvmnand.h:676
__mnand_refresh_progress::progress_type
uint8_t progress_type
How the progress being presented.
Definition: nvmnand.h:177
MNAND_FFU_STATUS_INSTALL_FAILED
@ MNAND_FFU_STATUS_INSTALL_FAILED
Indicates installing the firmware failed.
Definition: nvmnand.h:721
mnand_ffu
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...
__mnand_ufs_query_req::buf_size
uint8_t buf_size
Size of the buffer in bytes.
Definition: nvmnand.h:936
__mnand_summary_info::mlc
mnand_summary_element mlc
MLC region summary.
Definition: nvmnand.h:331
__mnand_chip::refresh_available
int refresh_available
Indicates if force refresh is available.
Definition: nvmnand.h:819
mnand_lu_info
struct __mnand_lu_info mnand_lu_info
Logical Unit information - UFS Only.
MNAND_HYNIX_F20
@ MNAND_HYNIX_F20
Hynix F20 device.
Definition: nvmnand.h:652
__mnand_chip::fd
int fd
File descriptor to the device.
Definition: nvmnand.h:773
__mnand_chip::device_desc
mnand_device_desc_info device_desc
Device Descriptor (UFS only)
Definition: nvmnand.h:864
__mnand_chip
mNAND chip information
Definition: nvmnand.h:769
MNAND_UNKNOWN_ERR
@ MNAND_UNKNOWN_ERR
Unknown error occurred.
Definition: nvmnand.h:757
__mnand_lu_info
Logical Unit information - UFS Only.
Definition: nvmnand.h:619
mnand_get_storage_type
static MNAND_STORAGE_TYPE mnand_get_storage_type(mnand_chip *chip)
Returns mnand storage type.
Definition: nvmnand.h:1275
__mnand_life_time_element::spare_blocks
uint16_t spare_blocks
Number of spare blocks in this region.
Definition: nvmnand.h:120
mnand_life_time_element
union __mnand_life_time_element mnand_life_time_element
Information on life time element.
__mnand_block_info::block_age
uint16_t block_age
Age (aka erase, p/e) count.
Definition: nvmnand.h:92
mnand_is_usable_block_with_type
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.
Definition: nvmnand.h:1093
__mnand_life_time_element
Information on life time element.
Definition: nvmnand.h:116
mnand_ufs_write_erase_amplification::mlc_weaf
double mlc_weaf
Specifies the MLC write/erase amplification.
Definition: nvmnand.h:279
MNAND_UNKNOWN_BAD_BLOCK
#define MNAND_UNKNOWN_BAD_BLOCK
Definition: nvmnand.h:100
mnand_is_mlc_block
static int mnand_is_mlc_block(mnand_block_info *blk)
Checks if a block is in the MLC region.
Definition: nvmnand.h:1147
MNAND_EOPEN
@ MNAND_EOPEN
Failed to open device node.
Definition: nvmnand.h:753
__mnand_chip::num_blocks
int num_blocks
Number of blocks available.
Definition: nvmnand.h:809
__mnand_summary_element
Summary of given block type (or region)
Definition: nvmnand.h:293
mnand_get_bkops_en
MNAND_STATUS mnand_get_bkops_en(mnand_chip *chip, uint8_t *enabled)
Gets the status of background operations enable bit.
mnand_enable_power_off_notification
MNAND_STATUS mnand_enable_power_off_notification(mnand_chip *chip)
Enable power-off notification.
MNAND_UFS_TOSHIBA
@ MNAND_UFS_TOSHIBA
Toshiba UFS device.
Definition: nvmnand.h:664
mnand_is_usable_block
static int mnand_is_usable_block(mnand_block_info *blk)
Checks if a block is usable.
Definition: nvmnand.h:1063
MNAND_EMMC
@ MNAND_EMMC
eMMC storage device
Definition: nvmnand.h:678
mnand_read_sectors_phys
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
@ MNAND_TOSHIBA
Toshiba eMMC device.
Definition: nvmnand.h:662
MNAND_FFU_STATUS_INTERNAL_ERROR
@ MNAND_FFU_STATUS_INTERNAL_ERROR
Indicates there was device internal error during FFU operation.
Definition: nvmnand.h:729
__mnand_ufs_geo_info::max_lu
uint8_t max_lu
Maximum number of logical units supported.
Definition: nvmnand.h:518
MNAND_FFU_STATUS_SUCCESS
@ MNAND_FFU_STATUS_SUCCESS
Indicates FFU operation was successful.
Definition: nvmnand.h:719
MNAND_BKOPS_EN_ERR
@ MNAND_BKOPS_EN_ERR
Background operations enable state not set to requested value.
Definition: nvmnand.h:759
mnand_set_cache_en
MNAND_STATUS mnand_set_cache_en(mnand_chip *chip, uint8_t enable)
Enable/Disable cache on mNAND.
__mnand_refresh_element
Information on refresh element.
Definition: nvmnand.h:153
__mnand_refresh_properties::rfsh_unit_time_us
uint32_t rfsh_unit_time_us
Time for each refresh operation(UFS only)
Definition: nvmnand.h:212
__mnand_lu_info::lu_enabled
uint8_t lu_enabled
Indicates if this LU is enabled.
Definition: nvmnand.h:623
__mnand_geo_info::ufs_geo_info
mnand_ufs_geo_info ufs_geo_info
UFS specific geometry information.
Definition: nvmnand.h:611
__mnand_ufs_query_req::idn
uint8_t idn
Query operation identifier.
Definition: nvmnand.h:919
MNAND_OK
@ MNAND_OK
Operation completed successfully.
Definition: nvmnand.h:745
MNAND_FFU_STATUS_GENERIC_ERROR
@ MNAND_FFU_STATUS_GENERIC_ERROR
Indicates there was a generic error during the FFU process.
Definition: nvmnand.h:733
mnand_refresh_progress
struct __mnand_refresh_progress mnand_refresh_progress
Information on refresh progress.
__mnand_mmc_geo_info
MMC Geometry Information.
Definition: nvmnand.h:461
__mnand_ufs_geo_info::enhanced2_cap_adj_fac
uint16_t enhanced2_cap_adj_fac
Enhanced area 2 capacity adjustment factor.
Definition: nvmnand.h:573
__mnand_ages_element::min_age
uint16_t min_age
Minimum age in this region.
Definition: nvmnand.h:224
mnand_get_lu_info
MNAND_STATUS mnand_get_lu_info(mnand_chip *chip, uint32_t lun, mnand_lu_info *lu_info)
Get mnand lu info (UFS only).
mnand_get_fw_version
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.
__mnand_chip::prn
char prn[MAX_PRN_STR_LEN]
Product Name.
Definition: nvmnand.h:788
MNAND_UNKNOWN
@ MNAND_UNKNOWN
Unknown storage type - indicates error condition.
Definition: nvmnand.h:682
__mnand_ufs_query_req::index
uint8_t index
Index value for the query operation.
Definition: nvmnand.h:925
__mnand_geo_info
Device Geometry Information.
Definition: nvmnand.h:602
mnand_close
MNAND_STATUS mnand_close(mnand_chip *chip)
Closes the mNAND device.
__mnand_ext_csd_info
EXT CSD information - eMMC only.
Definition: nvmnand.h:388
__mnand_chip::priv_ops
void * priv_ops
mNAND vendor specific private operations
Definition: nvmnand.h:798
__mnand_device_type
__mnand_device_type
mNAND device type enumeration
Definition: nvmnand.h:646
__mnand_ufs_combo_query_req
UFS Combo Query Request Information Structure.
Definition: nvmnand.h:964
__mnand_ufs_geo_info::non_persist_max_alloc
uint32_t non_persist_max_alloc
Maximum allocation for non-persistent area.
Definition: nvmnand.h:548
__mnand_cid_info
CID information - eMMC only.
Definition: nvmnand.h:364
__mnand_ufs_query_req::buffer
uint8_t * buffer
User buffer pointer for query data.
Definition: nvmnand.h:945
mnand_set_bkops_en
MNAND_STATUS mnand_set_bkops_en(mnand_chip *chip, uint8_t enable)
Sets the background operations enable bit.
mnand_send_power_off_notification
MNAND_STATUS mnand_send_power_off_notification(mnand_chip *chip)
Send power-off notification.
MNAND_FFU_STATUS_ERROR_DOWNLOADING_FIRMWARE
@ MNAND_FFU_STATUS_ERROR_DOWNLOADING_FIRMWARE
Indicates downloading the firmware onto the device failed.
Definition: nvmnand.h:723
mnand_get_geo_info
MNAND_STATUS mnand_get_geo_info(mnand_chip *chip, mnand_geo_info *geo_info)
Extract mnand geometry info.
MNAND_EOL_OK
@ MNAND_EOL_OK
Device has not reached end-of-life.
Definition: nvmnand.h:692
MAX_ERASE_CNT
#define MAX_ERASE_CNT
Maximum erase count a block can have.
Definition: nvmnand.h:54
__mnand_ufs_geo_info::enhanced3_cap_adj_fac
uint16_t enhanced3_cap_adj_fac
Enhanced area 3 capacity adjustment factor.
Definition: nvmnand.h:583