mmc-utils: gp partition support
cover mmc-utils: gp partition support
Add support to create general purpose partition on eMMC device. gp partition if needed can be marked with either enhanced or extended attributes.
Note:
creation of gp partition with enhanced attribute has been tested. Due to lack of access to eMMC device with extended attribute, I could not test gp partition creation with extended attribute.
Balaji T K (2):
mmc-utils: add check for max enhanced user area.
mmc-utils: add support to create gp partition
mmc.c | 5 ++ mmc.h | 18 +++++ mmc_cmds.c | 226 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- mmc_cmds.h | 1 + 4 files changed, 248 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.5.4
PATCH 1/2 mmc-utils: add check for max enhanced user area.
In addition to user area, General purpose partition can be be marked with enhanced attribute, retain enhanced attributes of gp partition while creating enhanced user area and add check for max enhanced area of the device.
--- mmc.h | 16 ++++++++++ mmc_cmds.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 105 insertions(+), 2 deletions(-)
mmc.h +16 -0
@@ -57,6 +57,18 @@#define EXT_CSD_MAX_ENH_SIZE_MULT_0 157#define EXT_CSD_PARTITIONS_ATTRIBUTE 156/* R/W */ #define EXT_CSD_PARTITION_SETTING_COMPLETED 155/* R/W */ +#define EXT_CSD_GP_SIZE_MULT_4_2 154 +#define EXT_CSD_GP_SIZE_MULT_4_1 153 +#define EXT_CSD_GP_SIZE_MULT_4_0 152 +#define EXT_CSD_GP_SIZE_MULT_3_2 151 +#define EXT_CSD_GP_SIZE_MULT_3_1 150 +#define EXT_CSD_GP_SIZE_MULT_3_0 149 +#define EXT_CSD_GP_SIZE_MULT_2_2 148 +#define EXT_CSD_GP_SIZE_MULT_2_1 147 +#define EXT_CSD_GP_SIZE_MULT_2_0 146 +#define EXT_CSD_GP_SIZE_MULT_1_2 145 +#define EXT_CSD_GP_SIZE_MULT_1_1 144 +#define EXT_CSD_GP_SIZE_MULT_1_0 143#define EXT_CSD_ENH_SIZE_MULT_2 142#define EXT_CSD_ENH_SIZE_MULT_1 141#define EXT_CSD_ENH_SIZE_MULT_0 140
@@ -105,6 +117,10 @@#define EXT_CSD_PART_CONFIG_ACC_ACK (0x40)#define EXT_CSD_PARTITIONING_EN (1<<0)#define EXT_CSD_ENH_ATTRIBUTE_EN (1<<1) +#define EXT_CSD_ENH_4 (1<<4) +#define EXT_CSD_ENH_3 (1<<3) +#define EXT_CSD_ENH_2 (1<<2) +#define EXT_CSD_ENH_1 (1<<1)#define EXT_CSD_ENH_USR (1<<0)/* From kernel linux/mmc/core.h */
mmc_cmds.c +89 -2
109 lines not on this page · raw message
Signature · 1 line
1.7.5.4
PATCH 2/2 mmc-utils: add support to create gp partition
In reply to Balaji T Kcreate gp partition if needed with enhanced / extended attribute.
--- mmc.c | 5 ++ mmc.h | 2 + mmc_cmds.c | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ mmc_cmds.h | 1 + 4 files changed, 143 insertions(+), 0 deletions(-)
mmc.c +5 -0
@@ -70,6 +70,11 @@ static struct Command commands[] = {"Set the eMMC data sector size to 4KB by disabling emulation on\n<device>." ,NULL }, + { do_create_gp_partition, -6, +"gp create" ,"<-y|-n> " "<length KiB> " "<partition> " "<enh_attr> " "<ext_attr> " "<device>\n" +"create general purpose partition for the <device>.\nDry-run only unless -y is passed.\nNOTE! This is a one-time programmable (unreversible) change.\nTo set enhanced attribute to general partition being created set\n <enh_attr> to 1 else set it to 0.\nTo set extended attribute to general partition\n set <ext_attr> to 1,2 else set it to 0" , +NULL + }, { do_enh_area_set, -4,"enh_area set" ,"<-y|-n> " "<start KiB> " "<length KiB> " "<device>\n" "Enable the enhanced user area for the <device>.\nDry-run only unless -y is passed.\nNOTE! This is a one-time programmable (unreversible) change.",
mmc.h +2 -0
@@ -79,6 +79,8 @@#define EXT_CSD_NATIVE_SECTOR_SIZE 63/* R */ #define EXT_CSD_USE_NATIVE_SECTOR 62/* R/W */ #define EXT_CSD_DATA_SECTOR_SIZE 61/* R */ +#define EXT_CSD_EXT_PARTITIONS_ATTRIBUTE_1 53 +#define EXT_CSD_EXT_PARTITIONS_ATTRIBUTE_0 52/* * WR_REL_PARAM field definitions
mmc_cmds.c +135 -0
147 lines not on this page · raw message
mmc_cmds.h +1 -0
@@ -26,5 +26,6 @@ int do_hwreset_en(int nargs, char **argv);int do_hwreset_dis (int nargs,char **argv);int do_sanitize (int nargs,char **argv);int do_status_get (int nargs,char **argv); +int do_create_gp_partition (int nargs,char **argv);int do_enh_area_set (int nargs,char **argv);int do_write_reliability_set (int nargs,char **argv);
Signature · 1 line
1.7.5.4
Re: [PATCH 2/2] mmc-utils: add support to create gp partition
Hi,
can I suggest to you this little fix:
mmc_cmds.c +1 -1
@@ -618,7 +618,7 @@ ext_attr =strtol (argv[5 ],NULL ,10 ); device = argv[6 ]; -if (partition <0 || partition >4 ) { +if (partition <1 || partition >4 ) {printf ("Invalid gp parition number valid range [1-4]\n" );exit (1 ); }
regards,
Mickaël