summaryrefslogtreecommitdiff
path: root/common/image-fit.c
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2020-09-03 12:44:51 +0200
committerMichal Simek <michal.simek@xilinx.com>2020-10-27 08:13:32 +0100
commit13d1ca8742ab714d4238f7b1598931bb6aaa1ea4 (patch)
treeb7b2af12b71288dbe12282e4db98056b66319d58 /common/image-fit.c
parentcaa7fc2c57750f323d53aef38c7ee2e01898c4ba (diff)
spl: fdt: Record load/entry fit-images entries in 64bit format
The commit 9f45aeb93727 ("spl: fit: implement fdt_record_loadable") which introduced fdt_record_loadable() state there spl_fit.c is not 64bit safe. Based on my tests on Xilinx ZynqMP zcu102 platform there shouldn't be a problem to record these addresses in 64bit format. The patch adds support for systems which need to load images above 4GB. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/image-fit.c')
-rw-r--r--common/image-fit.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/common/image-fit.c b/common/image-fit.c
index d54eff9033..c82d4d8015 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -791,17 +791,18 @@ static int fit_image_get_address(const void *fit, int noffset, char *name,
return -1;
}
- 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++;
}
+
+ if (len > sizeof(ulong) && (uint32_t)(load64 >> 32)) {
+ printf("Unsupported %s address size\n", name);
+ return -1;
+ }
+
*load = (ulong)load64;
return 0;