Commit d40ec535 authored by Jungseung Lee's avatar Jungseung Lee Committed by Chris Ball
Browse files

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: default avatarJungseung Lee <js07.lee@samsung.com>
Reviewed-by: default avatarAvri Altman <Avri.Altman@wdc.com>
Signed-off-by: default avatarChris Ball <chris@printf.net>
parent aef913e3
...@@ -116,6 +116,7 @@ ...@@ -116,6 +116,7 @@
#define EXT_CSD_MODE_CONFIG 30 #define EXT_CSD_MODE_CONFIG 30
#define EXT_CSD_MODE_OPERATION_CODES 29 /* W */ #define EXT_CSD_MODE_OPERATION_CODES 29 /* W */
#define EXT_CSD_FFU_STATUS 26 /* R */ #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 */ #define EXT_CSD_CMDQ_MODE_EN 15 /* R/W */
/* /*
...@@ -132,6 +133,8 @@ ...@@ -132,6 +133,8 @@
/* /*
* EXT_CSD field definitions * 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_INSTALL (0x01)
#define EXT_CSD_FFU_MODE (0x01) #define EXT_CSD_FFU_MODE (0x01)
#define EXT_CSD_NORMAL_MODE (0x00) #define EXT_CSD_NORMAL_MODE (0x00)
......
...@@ -1766,6 +1766,38 @@ int do_read_extcsd(int nargs, char **argv) ...@@ -1766,6 +1766,38 @@ int do_read_extcsd(int nargs, char **argv)
ext_csd[EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B]); ext_csd[EXT_CSD_DEVICE_LIFE_TIME_EST_TYP_B]);
printf("eMMC Pre EOL information [EXT_CSD_PRE_EOL_INFO]: 0x%02x\n", printf("eMMC Pre EOL information [EXT_CSD_PRE_EOL_INFO]: 0x%02x\n",
ext_csd[EXT_CSD_PRE_EOL_INFO]); 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) { if (ext_csd_rev >= 8) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment