pci: layerscape: add pci driver based on DM
[platform/kernel/u-boot.git] / common / image-fit.c
index 77dc011..95d8bf4 100644 (file)
@@ -14,6 +14,7 @@
 #include <time.h>
 #else
 #include <linux/compiler.h>
+#include <linux/kconfig.h>
 #include <common.h>
 #include <errno.h>
 #include <mapmem.h>
@@ -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);
 }
 
 /**
@@ -1505,12 +1513,6 @@ void fit_conf_print(const void *fit, int noffset, const char *p)
 
 static int fit_image_select(const void *fit, int rd_noffset, int verify)
 {
-#if !defined(USE_HOSTCC) && defined(CONFIG_FIT_IMAGE_POST_PROCESS)
-       const void *data;
-       size_t size;
-       int ret;
-#endif
-
        fit_image_print(fit, rd_noffset, "   ");
 
        if (verify) {
@@ -1522,23 +1524,6 @@ static int fit_image_select(const void *fit, int rd_noffset, int verify)
                puts("OK\n");
        }
 
-#if !defined(USE_HOSTCC) && defined(CONFIG_FIT_IMAGE_POST_PROCESS)
-       ret = fit_image_get_data(fit, rd_noffset, &data, &size);
-       if (ret)
-               return ret;
-
-       /* perform any post-processing on the image data */
-       board_fit_image_post_process((void **)&data, &size);
-
-       /*
-        * update U-Boot's understanding of the "data" property start address
-        * and size according to the performed post-processing
-        */
-       ret = fdt_setprop((void *)fit, rd_noffset, FIT_DATA_PROP, data, size);
-       if (ret)
-               return ret;
-#endif
-
        return 0;
 }
 
@@ -1614,6 +1599,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 +1685,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");
@@ -1738,6 +1732,12 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
                bootstage_error(bootstage_id + BOOTSTAGE_SUB_GET_DATA);
                return -ENOENT;
        }
+
+#if !defined(USE_HOSTCC) && defined(CONFIG_FIT_IMAGE_POST_PROCESS)
+       /* perform any post-processing on the image data */
+       board_fit_image_post_process((void **)&buf, &size);
+#endif
+
        len = (ulong)size;
 
        /* verify that image data is a proper FDT blob */