Skip to content
Snippets Groups Projects
Commit c1913cb7 authored by York Sun's avatar York Sun Committed by Tom Rini
Browse files

common: image-fit: Fix load and entry addresses in FIT image


FIT image supports more than 32 bits in addresses by using #address-cell
field. Fixing 64-bit support by using this field.

Signed-off-by: default avatarYork Sun <york.sun@nxp.com>
Reviewed-by: default avatarSimon Glass <sjg@chromium.org>
parent 6004765d
No related branches found
No related tags found
No related merge requests found
...@@ -678,16 +678,28 @@ int fit_image_get_comp(const void *fit, int noffset, uint8_t *comp) ...@@ -678,16 +678,28 @@ int fit_image_get_comp(const void *fit, int noffset, uint8_t *comp)
static int fit_image_get_address(const void *fit, int noffset, char *name, static int fit_image_get_address(const void *fit, int noffset, char *name,
ulong *load) ulong *load)
{ {
int len; int len, cell_len;
const uint32_t *data; const fdt32_t *cell;
uint64_t load64 = 0;
data = fdt_getprop(fit, noffset, name, &len); cell = fdt_getprop(fit, noffset, name, &len);
if (data == NULL) { if (cell == NULL) {
fit_get_debug(fit, noffset, name, len); fit_get_debug(fit, noffset, name, len);
return -1; return -1;
} }
*load = uimage_to_cpu(*data); if (len > sizeof(ulong)) {
printf("Unsupported %s address size\n", name);
return -1;
}
cell_len = len >> 2;
/* Use load64 to avoid compiling warning for 32-bit target */
while (cell_len--) {
load64 = (load64 << 32) | uimage_to_cpu(*cell);
cell++;
}
*load = (ulong)load64;
return 0; return 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment