RE: [PATCH] mmc-utils: feature spec 5.0+, add secure removal type fileds to Extended CSD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

> 
> Display secure removal type when printing Extended CSD
> Example:
> 	# mmc extcsd read /dev/mmcblk0
> 	...
> 	Secure Removal Type [SECURE_REMOVAL_TYPE]: 0x39
> 	 information removed using a vendor defined
> 
> Signed-off-by: Jungseung Lee <js07.lee@xxxxxxxxxxx>
> ---
>  mmc.h      |  3 +++
>  mmc_cmds.c | 19 +++++++++++++++++++
>  2 files changed, 22 insertions(+)
> 
> diff --git a/mmc.h b/mmc.h
> index 285c1f1..648fb26 100644
> --- a/mmc.h
> +++ b/mmc.h
> @@ -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)
> diff --git a/mmc_cmds.c b/mmc_cmds.c
> index 19a9da1..8d6455e 100644
> --- a/mmc_cmds.c
> +++ b/mmc_cmds.c
> @@ -1766,6 +1766,25 @@ 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 removed ");
printf(" information is configured to be removed ");

> +		switch ((reg & EXT_CSD_CONFIG_SECRM_TYPE) >> 4) {
Maybe add an appropriate comment, e.g.
/* Bit [5:4]: Configure Secure Removal Type */

> +			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;
> +		}
>  	}
You forgot to parse the supported part - EXT_CSD_SUPPORTED_SECRM_TYPE


Thanks,
Avri




[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux