Skip to content

Commit

Permalink
efi_loader: switch to non-secure mode later
Browse files Browse the repository at this point in the history
Some ARMv7 boards using PSCI require to be in secure-mode when booted via
'bootz' or 'bootm'. During distro-boot 'bootefi bootmgr' is called to check
if booting via UEFI is possible.

With the change we change the switch from secure mode to non-secure mode is
moved from the UEFI subsystem setup to just before calling StartImage().

Cc: Jernej Škrabec <jernej.skrabec@gmail.com>
Reported by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
  • Loading branch information
xypron committed Jan 29, 2021
1 parent 688e882 commit 82d01f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 4 additions & 0 deletions cmd/bootefi.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#define LOG_CATEGORY LOGC_EFI

#include <common.h>
#include <bootm.h>
#include <charset.h>
#include <command.h>
#include <dm.h>
Expand Down Expand Up @@ -338,6 +339,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) {
Expand Down
4 changes: 0 additions & 4 deletions lib/efi_loader/efi_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

#include <common.h>
#include <bootm.h>
#include <efi_loader.h>
#include <efi_variable.h>

Expand Down Expand Up @@ -188,9 +187,6 @@ efi_status_t efi_init_obj_list(void)
/* Allow unaligned memory access */
allow_unaligned();

/* On ARM switch from EL3 or secure mode to EL2 or non-secure mode */
switch_to_non_secure_mode();

/* Initialize root node */
ret = efi_root_node_register();
if (ret != EFI_SUCCESS)
Expand Down

0 comments on commit 82d01f0

Please sign in to comment.