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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int spl_get_partitions_sector(struct blk_desc *dev_desc, char *partition,
|
int spl_ab_append_part_slot(struct blk_desc *dev_desc,
|
||||||
u32 *sectors)
|
const char *part_name,
|
||||||
|
char *new_name)
|
||||||
{
|
{
|
||||||
disk_partition_t part_info;
|
char slot_suffix[3] = {0};
|
||||||
char part[10] = {0};
|
|
||||||
char slot[3] = {0};
|
|
||||||
|
|
||||||
if (!partition || !sectors)
|
if (!strcmp(part_name, "misc")) {
|
||||||
return -EFAULT;
|
strcat(new_name, part_name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
spl_get_current_slot(dev_desc, "misc", slot);
|
if (spl_get_current_slot(dev_desc, "misc", slot_suffix)) {
|
||||||
if (strlen(partition) > 8)
|
printf("%s: failed to get slot suffix !\n", __func__);
|
||||||
return -ENOMEM;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
strcat(part, partition);
|
strcpy(new_name, part_name);
|
||||||
strcat(part, slot);
|
strcat(new_name, slot_suffix);
|
||||||
if (part_get_info_by_name(dev_desc, part, &part_info) < 0)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
*sectors = part_info.start;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,13 +24,16 @@ int spl_get_current_slot(struct blk_desc *dev_desc, char *partition,
|
||||||
char *slot);
|
char *slot);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* spl_get_partitions_sector
|
* spl_ab_append_part_slot
|
||||||
*
|
*
|
||||||
* @dev_desc: block description
|
* @dev_desc: block description
|
||||||
* @partition: partition name
|
* @part_name: partition name
|
||||||
* @sectors: firmware load address
|
* @new_name: append the slot suffix
|
||||||
|
*
|
||||||
|
* return: 0 success, others fail.
|
||||||
*/
|
*/
|
||||||
int spl_get_partitions_sector(struct blk_desc *dev_desc, char *partition,
|
int spl_ab_append_part_slot(struct blk_desc *dev_desc,
|
||||||
u32 *sectors);
|
const char *part_name,
|
||||||
|
char *new_name);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue