common: image-fit: add API to get "/totalsize"

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Icca5200040ab14ad76515888cdaa4cd16f554af0
This commit is contained in:
Joseph Chen 2020-07-06 15:55:00 +08:00
parent 28e3182f59
commit 4fe117be42
2 changed files with 24 additions and 0 deletions

View File

@ -527,6 +527,29 @@ int fit_get_timestamp(const void *fit, int noffset, time_t *timestamp)
return 0; return 0;
} }
/**
* fit_get_totalsize - get node totalsize property.
*
* @fit: pointer to the FIT image header
* @totalsize: holds the /totalsize property
*
* returns:
* 0, on success
* -ENOENT if the property could not be found
*/
int fit_get_totalsize(const void *fit, int *totalsize)
{
const fdt32_t *val;
val = fdt_getprop(fit, 0, FIT_TOTALSIZE_PROP, NULL);
if (!val)
return -ENOENT;
*totalsize = fdt32_to_cpu(*val);
return 0;
}
/** /**
* fit_image_get_node - get node offset for component image of a given unit name * fit_image_get_node - get node offset for component image of a given unit name
* @fit: pointer to the FIT format image header * @fit: pointer to the FIT format image header

View File

@ -1001,6 +1001,7 @@ static inline const char *fit_get_name(const void *fit_hdr,
int fit_get_desc(const void *fit, int noffset, char **desc); int fit_get_desc(const void *fit, int noffset, char **desc);
int fit_get_timestamp(const void *fit, int noffset, time_t *timestamp); int fit_get_timestamp(const void *fit, int noffset, time_t *timestamp);
int fit_get_totalsize(const void *fit, int *totalsize);
int fit_image_get_node(const void *fit, const char *image_uname); int fit_image_get_node(const void *fit, const char *image_uname);
int fit_image_get_os(const void *fit, int noffset, uint8_t *os); int fit_image_get_os(const void *fit, int noffset, uint8_t *os);