common: spl: ab: update new function to support ab system
Add spl_ab_append_part_slot() Delete spl_get_partitions_sector() Signed-off-by: Jason Zhu <jason.zhu@rock-chips.com> Change-Id: I116d6d708604762203974dc66a39be1a0e7b6bbe
This commit is contained in:
parent
9561619343
commit
1e33e3cb7c
|
|
@ -242,26 +242,24 @@ out:
|
|||
return 0;
|
||||
}
|
||||
|
||||
int spl_get_partitions_sector(struct blk_desc *dev_desc, char *partition,
|
||||
u32 *sectors)
|
||||
int spl_ab_append_part_slot(struct blk_desc *dev_desc,
|
||||
const char *part_name,
|
||||
char *new_name)
|
||||
{
|
||||
disk_partition_t part_info;
|
||||
char part[10] = {0};
|
||||
char slot[3] = {0};
|
||||
char slot_suffix[3] = {0};
|
||||
|
||||
if (!partition || !sectors)
|
||||
return -EFAULT;
|
||||
if (!strcmp(part_name, "misc")) {
|
||||
strcat(new_name, part_name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
spl_get_current_slot(dev_desc, "misc", slot);
|
||||
if (strlen(partition) > 8)
|
||||
return -ENOMEM;
|
||||
if (spl_get_current_slot(dev_desc, "misc", slot_suffix)) {
|
||||
printf("%s: failed to get slot suffix !\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
strcat(part, partition);
|
||||
strcat(part, slot);
|
||||
if (part_get_info_by_name(dev_desc, part, &part_info) < 0)
|
||||
return -ENODEV;
|
||||
|
||||
*sectors = part_info.start;
|
||||
strcpy(new_name, part_name);
|
||||
strcat(new_name, slot_suffix);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,13 +24,16 @@ int spl_get_current_slot(struct blk_desc *dev_desc, char *partition,
|
|||
char *slot);
|
||||
|
||||
/*
|
||||
* spl_get_partitions_sector
|
||||
* spl_ab_append_part_slot
|
||||
*
|
||||
* @dev_desc: block description
|
||||
* @partition: partition name
|
||||
* @sectors: firmware load address
|
||||
* @part_name: partition name
|
||||
* @new_name: append the slot suffix
|
||||
*
|
||||
* return: 0 success, others fail.
|
||||
*/
|
||||
int spl_get_partitions_sector(struct blk_desc *dev_desc, char *partition,
|
||||
u32 *sectors);
|
||||
int spl_ab_append_part_slot(struct blk_desc *dev_desc,
|
||||
const char *part_name,
|
||||
char *new_name);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue