summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYork Sun <york.sun@nxp.com>2016-02-29 15:48:41 -0800
committerTom Rini <trini@konsulko.com>2016-03-14 19:18:41 -0400
commitc1913cb7897f77a26791765ef9c3c02b3588f3c1 (patch)
tree32275b55c9c32600ea3848cf5a083278093cc5bc
parent6004765d14b81210cabc6b0ed807bc0a9f12cdab (diff)
downloadu-boot-imx-c1913cb7897f77a26791765ef9c3c02b3588f3c1.zip
u-boot-imx-c1913cb7897f77a26791765ef9c3c02b3588f3c1.tar.gz
u-boot-imx-c1913cb7897f77a26791765ef9c3c02b3588f3c1.tar.bz2
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: York Sun <york.sun@nxp.com> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--common/image-fit.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/common/image-fit.c b/common/image-fit.c
index 9e27569..25f8a11 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -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,
ulong *load)
{
- int len;
- const uint32_t *data;
+ int len, cell_len;
+ const fdt32_t *cell;
+ uint64_t load64 = 0;
- data = fdt_getprop(fit, noffset, name, &len);
- if (data == NULL) {
+ cell = fdt_getprop(fit, noffset, name, &len);
+ if (cell == NULL) {
fit_get_debug(fit, noffset, name, len);
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;
}