diff options
author | Jungseung Lee <js07.lee@samsung.com> | 2019-08-08 18:42:30 -0400 |
---|---|---|
committer | Chris Ball <chris@printf.net> | 2019-08-08 18:42:38 -0400 |
commit | d40ec535b9d4e4c974e8c2fbfb422cd0348cc5e8 (patch) | |
tree | bc348b2a8f264f1800ec1fa01d8f53a05ead0d87 | |
parent | aef913e31b659462fe6b9320d241676cba97f67b (diff) | |
download | mmc-utils-old-d40ec535b9d4e4c974e8c2fbfb422cd0348cc5e8.tar.gz |
mmc-utils: feature spec 5.0+, add secure removal type fields to Extended CSD
Display secure removal type when printing Extended CSD
Example:
# mmc extcsd read /dev/mmcblk0
...
Secure Removal Type [SECURE_REMOVAL_TYPE]: 0x39
information is configured to be removed using a vendor defined
Supported Secure Removal Type:
information removed by an erase of the physical memory
information removed using a vendor defined
Signed-off-by: Jungseung Lee <js07.lee@samsung.com>
Reviewed-by: Avri Altman <Avri.Altman@wdc.com>
Signed-off-by: Chris Ball <chris@printf.net>
-rw-r--r-- | mmc.h | 3 | ||||
-rw-r--r-- | mmc_cmds.c | 32 |
2 files changed, 35 insertions, 0 deletions
@@ -116,6 +116,7 @@ #define EXT_CSD_MODE_CONFIG 30 #define EXT_CSD_MODE_OPERATION_CODES 29 /* W */ #define EXT_CSD_FFU_STATUS 26 /* R */ +#define EXT_CSD_SECURE_REMOVAL_TYPE 16 /* R/W */ #define EXT_CSD_CMDQ_MODE_EN 15 /* R/W */ /* @@ -132,6 +133,8 @@ /* * EXT_CSD field definitions */ +#define EXT_CSD_CONFIG_SECRM_TYPE (0x30) +#define EXT_CSD_SUPPORTED_SECRM_TYPE (0x0f) #define EXT_CSD_FFU_INSTALL (0x01) #define EXT_CSD_FFU_MODE (0x01) #define EXT_CSD_NORMAL_MODE (0x00) @@ -1766,6 +1766,38 @@ int do_read_extcsd(int nargs, char **argv) ext_csd[EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B]); printf("eMMC Pre EOL information [EXT_CSD_PRE_EOL_INFO]: 0x%02x\n", ext_csd[EXT_CSD_PRE_EOL_INFO]); + reg = ext_csd[EXT_CSD_SECURE_REMOVAL_TYPE]; + printf("Secure Removal Type [SECURE_REMOVAL_TYPE]: 0x%02x\n", reg); + printf(" information is configured to be removed "); + /* Bit [5:4]: Configure Secure Removal Type */ + switch ((reg & EXT_CSD_CONFIG_SECRM_TYPE) >> 4) { + case 0x0: + printf("by an erase of the physical memory\n"); + break; + case 0x1: + printf("by an overwriting the addressed locations" + " with a character followed by an erase\n"); + break; + case 0x2: + printf("by an overwriting the addressed locations" + " with a character, its complement, then a random character\n"); + break; + case 0x3: + printf("using a vendor defined\n"); + break; + } + /* Bit [3:0]: Supported Secure Removal Type */ + printf(" Supported Secure Removal Type:\n"); + if (reg & 0x01) + printf(" information removed by an erase of the physical memory\n"); + if (reg & 0x02) + printf(" information removed by an overwriting the addressed locations" + " with a character followed by an erase\n"); + if (reg & 0x04) + printf(" information removed by an overwriting the addressed locations" + " with a character, its complement, then a random character\n"); + if (reg & 0x08) + printf(" information removed using a vendor defined\n"); } if (ext_csd_rev >= 8) { |