i2c: synquacer: SNI Synquacer I2C controller
[platform/kernel/u-boot.git] / cmd / bootefi.c
index fe70eec..cba81ff 100644 (file)
@@ -8,6 +8,7 @@
 #define LOG_CATEGORY LOGC_EFI
 
 #include <common.h>
+#include <bootm.h>
 #include <charset.h>
 #include <command.h>
 #include <dm.h>
@@ -18,6 +19,7 @@
 #include <image.h>
 #include <log.h>
 #include <malloc.h>
+#include <asm/global_data.h>
 #include <linux/libfdt.h>
 #include <linux/libfdt_env.h>
 #include <mapmem.h>
@@ -71,7 +73,7 @@ void efi_set_bootdev(const char *dev, const char *devnr, const char *path,
        /* Remember only PE-COFF and FIT images */
        if (efi_check_pe(buffer, buffer_size, NULL) != EFI_SUCCESS) {
 #ifdef CONFIG_FIT
-               if (!fit_check_format(buffer))
+               if (fit_check_format(buffer, IMAGE_SIZE_INVAL))
                        return;
                /*
                 * FIT images of type EFI_OS are started via command bootm.
@@ -338,6 +340,9 @@ static efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options)
        efi_uintn_t exit_data_size = 0;
        u16 *exit_data = NULL;
 
+       /* On ARM switch from EL3 or secure mode to EL2 or non-secure mode */
+       switch_to_non_secure_mode();
+
        /* Call our payload! */
        ret = EFI_CALL(efi_start_image(handle, &exit_data_size, &exit_data));
        if (ret != EFI_SUCCESS) {
@@ -353,6 +358,9 @@ static efi_status_t do_bootefi_exec(efi_handle_t handle, void *load_options)
 
        free(load_options);
 
+       if (IS_ENABLED(CONFIG_EFI_LOAD_FILE2_INITRD))
+               efi_initrd_deregister();
+
        return ret;
 }
 
@@ -631,10 +639,12 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc,
        else if (ret != EFI_SUCCESS)
                return CMD_RET_FAILURE;
 
-       if (!strcmp(argv[1], "bootmgr"))
-               return do_efibootmgr();
+       if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR)) {
+               if (!strcmp(argv[1], "bootmgr"))
+                       return do_efibootmgr();
+       }
 #ifdef CONFIG_CMD_BOOTEFI_SELFTEST
-       else if (!strcmp(argv[1], "selftest"))
+       if (!strcmp(argv[1], "selftest"))
                return do_efi_selftest();
 #endif
 
@@ -657,11 +667,14 @@ static char bootefi_help_text[] =
        "    Use environment variable efi_selftest to select a single test.\n"
        "    Use 'setenv efi_selftest list' to enumerate all tests.\n"
 #endif
+#ifdef CONFIG_CMD_BOOTEFI_BOOTMGR
        "bootefi bootmgr [fdt address]\n"
        "  - load and boot EFI payload based on BootOrder/BootXXXX variables.\n"
        "\n"
        "    If specified, the device tree located at <fdt address> gets\n"
-       "    exposed as EFI configuration table.\n";
+       "    exposed as EFI configuration table.\n"
+#endif
+       ;
 #endif
 
 U_BOOT_CMD(