]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/image-fit.c
spl: move comment to the right place
[karo-tx-uboot.git] / common / image-fit.c
index c0d7b8ca9156568dc9799a4a93b95adb7b8f53f4..a272ea2e83456d9a50018ffb1752b0e2016ddcf7 100644 (file)
@@ -21,10 +21,10 @@ DECLARE_GLOBAL_DATA_PTR;
 #endif /* !USE_HOSTCC*/
 
 #include <bootstage.h>
-#include <sha1.h>
-#include <sha256.h>
 #include <u-boot/crc.h>
 #include <u-boot/md5.h>
+#include <u-boot/sha1.h>
+#include <u-boot/sha256.h>
 
 /*****************************************************************************/
 /* New uImage format routines */
@@ -1434,7 +1434,7 @@ void fit_conf_print(const void *fit, int noffset, const char *p)
                printf("%s  FDT:          %s\n", p, uname);
 }
 
-int fit_image_select(const void *fit, int rd_noffset, int verify)
+static int fit_image_select(const void *fit, int rd_noffset, int verify)
 {
        fit_image_print(fit, rd_noffset, "   ");
 
@@ -1497,6 +1497,8 @@ static const char *fit_get_image_type_property(int type)
                return FIT_KERNEL_PROP;
        case IH_TYPE_RAMDISK:
                return FIT_RAMDISK_PROP;
+       case IH_TYPE_X86_SETUP:
+               return FIT_SETUP_PROP;
        }
 
        return "unknown";
@@ -1591,12 +1593,13 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
        }
 
        bootstage_mark(bootstage_id + BOOTSTAGE_SUB_CHECK_ARCH);
+#if !defined(USE_HOSTCC) && !defined(CONFIG_SANDBOX)
        if (!fit_image_check_target_arch(fit, noffset)) {
                puts("Unsupported Architecture\n");
                bootstage_error(bootstage_id + BOOTSTAGE_SUB_CHECK_ARCH);
                return -ENOEXEC;
        }
-
+#endif
        if (image_type == IH_TYPE_FLATDT &&
            !fit_image_check_comp(fit, noffset, IH_COMP_NONE)) {
                puts("FDT image is compressed");
@@ -1637,7 +1640,7 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
 
        /*
         * Work-around for eldk-4.2 which gives this warning if we try to
-        * case in the unmap_sysmem() call:
+        * cast in the unmap_sysmem() call:
         * warning: initialization discards qualifiers from pointer target type
         */
        {
@@ -1655,7 +1658,7 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
                        bootstage_error(bootstage_id + BOOTSTAGE_SUB_LOAD);
                        return -EBADF;
                }
-       } else {
+       } else if (load_op != FIT_LOAD_OPTIONAL_NON_ZERO || load) {
                ulong image_start, image_end;
                ulong load_end;
                void *dst;
@@ -1692,3 +1695,23 @@ int fit_image_load(bootm_headers_t *images, ulong addr,
 
        return noffset;
 }
+
+int boot_get_setup_fit(bootm_headers_t *images, uint8_t arch,
+                       ulong *setup_start, ulong *setup_len)
+{
+       int noffset;
+       ulong addr;
+       ulong len;
+       int ret;
+
+       addr = map_to_sysmem(images->fit_hdr_os);
+       noffset = fit_get_node_from_config(images, FIT_SETUP_PROP, addr);
+       if (noffset < 0)
+               return noffset;
+
+       ret = fit_image_load(images, addr, NULL, NULL, arch,
+                            IH_TYPE_X86_SETUP, BOOTSTAGE_ID_FIT_SETUP_START,
+                            FIT_LOAD_REQUIRED, setup_start, &len);
+
+       return ret;
+}