summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAlison Wang <b18965@freescale.com>2016-11-10 10:49:03 +0800
committerYork Sun <york.sun@nxp.com>2016-11-22 11:40:24 -0800
commitec6617c39741adc6c54952564579e32c3c09c66f (patch)
tree2c65fb7ab999e39eb6acc0be8890eced30c950a1 /common
parent95e74a3df75bf01eaf69f5c28f9aa2db6568e901 (diff)
downloadu-boot-imx-ec6617c39741adc6c54952564579e32c3c09c66f.zip
u-boot-imx-ec6617c39741adc6c54952564579e32c3c09c66f.tar.gz
u-boot-imx-ec6617c39741adc6c54952564579e32c3c09c66f.tar.bz2
armv8: Support loading 32-bit OS in AArch32 execution state
To support loading a 32-bit OS, the execution state will change from AArch64 to AArch32 when jumping to kernel. The architecture information will be got through checking FIT image, then U-Boot will load 32-bit OS or 64-bit OS automatically. Signed-off-by: Ebony Zhu <ebony.zhu@nxp.com> Signed-off-by: Alison Wang <alison.wang@nxp.com> Signed-off-by: Chenhui Zhao <chenhui.zhao@nxp.com> Reviewed-by: York Sun <york.sun@nxp.com>
Diffstat (limited to 'common')
-rw-r--r--common/image-fit.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/common/image-fit.c b/common/image-fit.c
index 77dc011..ea56d5b 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -27,6 +27,7 @@ DECLARE_GLOBAL_DATA_PTR;
#include <u-boot/md5.h>
#include <u-boot/sha1.h>
#include <u-boot/sha256.h>
+#include <generated/autoconf.h>
/*****************************************************************************/
/* New uImage format routines */
@@ -1161,11 +1162,18 @@ int fit_image_check_os(const void *fit, int noffset, uint8_t os)
int fit_image_check_arch(const void *fit, int noffset, uint8_t arch)
{
uint8_t image_arch;
+ int aarch32_support = 0;
+
+#ifdef CONFIG_ARM64_SUPPORT_AARCH32
+ aarch32_support = 1;
+#endif
if (fit_image_get_arch(fit, noffset, &image_arch))
return 0;
return (arch == image_arch) ||
- (arch == IH_ARCH_I386 && image_arch == IH_ARCH_X86_64);
+ (arch == IH_ARCH_I386 && image_arch == IH_ARCH_X86_64) ||
+ (arch == IH_ARCH_ARM64 && image_arch == IH_ARCH_ARM &&
+ aarch32_support);
}
/**
@@ -1614,6 +1622,9 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
int type_ok, os_ok;
ulong load, data, len;
uint8_t os;
+#ifndef USE_HOSTCC
+ uint8_t os_arch;
+#endif
const char *prop_name;
int ret;
@@ -1697,6 +1708,12 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
return -ENOEXEC;
}
#endif
+
+#ifndef USE_HOSTCC
+ fit_image_get_arch(fit, noffset, &os_arch);
+ images->os.arch = os_arch;
+#endif
+
if (image_type == IH_TYPE_FLATDT &&
!fit_image_check_comp(fit, noffset, IH_COMP_NONE)) {
puts("FDT image is compressed");