fwu: meta-data: switch to management by common code

The common code can now read, verify and fix meta-data copies
while exposing one consistent structure to users.
 Only the .read_mdata() and .write_mdata() callbacks of fwu_mdata_ops
are needed. Get rid of .get_mdata() .update_mdata() .get_mdata_part_num()
.read_mdata_partition() and .write_mdata_partition() and also the
corresponding wrapper functions.

Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Tested-by: Sughosh Ganu <sughosh.ganu@linaro.org>
This commit is contained in:
Jassi Brar
2023-06-09 13:52:40 -04:00
committed by Tom Rini
parent 3733e16925
commit 246ec2a12c
5 changed files with 38 additions and 702 deletions
+2 -15
View File
@@ -43,23 +43,10 @@ static void print_mdata(struct fwu_mdata *mdata)
int do_fwu_mdata_read(struct cmd_tbl *cmdtp, int flag,
int argc, char * const argv[])
{
struct udevice *dev;
int ret = CMD_RET_SUCCESS, res;
struct fwu_mdata mdata = { 0 };
struct fwu_mdata mdata;
if (uclass_get_device(UCLASS_FWU_MDATA, 0, &dev) || !dev) {
log_err("Unable to get FWU metadata device\n");
return CMD_RET_FAILURE;
}
res = fwu_check_mdata_validity();
if (res < 0) {
log_err("FWU Metadata check failed\n");
ret = CMD_RET_FAILURE;
goto out;
}
res = fwu_get_mdata(dev, &mdata);
res = fwu_get_verified_mdata(&mdata);
if (res < 0) {
log_err("Unable to get valid FWU metadata\n");
ret = CMD_RET_FAILURE;