mirror of
https://xff.cz/git/u-boot/
synced 2025-08-31 16:22:36 +02:00
Merge tag 'efi-2020-10-rc5' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
Pull request for UEFI sub-system for efi-2020-10-rc5 The following bugs are fixed: * unaligned access in br_i32_decode() * missing restore of global data pointer in UEFI selftest * missing restore of global data pointer on RISC-V in UEfI subsystem * efi_var_mem_notify_exit_boot_services() should not be __efi_runtime
This commit is contained in:
@@ -39,4 +39,13 @@ struct arch_global_data {
|
|||||||
|
|
||||||
#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("gp")
|
#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("gp")
|
||||||
|
|
||||||
|
static inline void set_gd(volatile gd_t *gd_ptr)
|
||||||
|
{
|
||||||
|
#ifdef CONFIG_64BIT
|
||||||
|
asm volatile("ld gp, %0\n" : : "m"(gd_ptr));
|
||||||
|
#else
|
||||||
|
asm volatile("lw gp, %0\n" : : "m"(gd_ptr));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* __ASM_GBL_DATA_H */
|
#endif /* __ASM_GBL_DATA_H */
|
||||||
|
@@ -42,9 +42,9 @@ LIST_HEAD(efi_register_notify_events);
|
|||||||
/* Handle of the currently executing image */
|
/* Handle of the currently executing image */
|
||||||
static efi_handle_t current_image;
|
static efi_handle_t current_image;
|
||||||
|
|
||||||
#ifdef CONFIG_ARM
|
#if defined(CONFIG_ARM) || defined(CONFIG_RISCV)
|
||||||
/*
|
/*
|
||||||
* The "gd" pointer lives in a register on ARM and AArch64 that we declare
|
* The "gd" pointer lives in a register on ARM and RISC-V that we declare
|
||||||
* fixed when compiling U-Boot. However, the payload does not know about that
|
* fixed when compiling U-Boot. However, the payload does not know about that
|
||||||
* restriction so we need to manually swap its and our view of that register on
|
* restriction so we need to manually swap its and our view of that register on
|
||||||
* EFI callback entry/exit.
|
* EFI callback entry/exit.
|
||||||
@@ -86,7 +86,7 @@ static efi_status_t EFIAPI efi_disconnect_controller(
|
|||||||
int __efi_entry_check(void)
|
int __efi_entry_check(void)
|
||||||
{
|
{
|
||||||
int ret = entry_count++ == 0;
|
int ret = entry_count++ == 0;
|
||||||
#ifdef CONFIG_ARM
|
#if defined(CONFIG_ARM) || defined(CONFIG_RISCV)
|
||||||
assert(efi_gd);
|
assert(efi_gd);
|
||||||
app_gd = gd;
|
app_gd = gd;
|
||||||
set_gd(efi_gd);
|
set_gd(efi_gd);
|
||||||
@@ -98,7 +98,7 @@ int __efi_entry_check(void)
|
|||||||
int __efi_exit_check(void)
|
int __efi_exit_check(void)
|
||||||
{
|
{
|
||||||
int ret = --entry_count == 0;
|
int ret = --entry_count == 0;
|
||||||
#ifdef CONFIG_ARM
|
#if defined(CONFIG_ARM) || defined(CONFIG_RISCV)
|
||||||
set_gd(app_gd);
|
set_gd(app_gd);
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
@@ -107,7 +107,7 @@ int __efi_exit_check(void)
|
|||||||
/**
|
/**
|
||||||
* efi_save_gd() - save global data register
|
* efi_save_gd() - save global data register
|
||||||
*
|
*
|
||||||
* On the ARM architecture gd is mapped to a fixed register (r9 or x18).
|
* On the ARM and RISC-V architectures gd is mapped to a fixed register.
|
||||||
* As this register may be overwritten by an EFI payload we save it here
|
* As this register may be overwritten by an EFI payload we save it here
|
||||||
* and restore it on every callback entered.
|
* and restore it on every callback entered.
|
||||||
*
|
*
|
||||||
@@ -115,7 +115,7 @@ int __efi_exit_check(void)
|
|||||||
*/
|
*/
|
||||||
void efi_save_gd(void)
|
void efi_save_gd(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ARM
|
#if defined(CONFIG_ARM) || defined(CONFIG_RISCV)
|
||||||
efi_gd = gd;
|
efi_gd = gd;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -123,13 +123,13 @@ void efi_save_gd(void)
|
|||||||
/**
|
/**
|
||||||
* efi_restore_gd() - restore global data register
|
* efi_restore_gd() - restore global data register
|
||||||
*
|
*
|
||||||
* On the ARM architecture gd is mapped to a fixed register (r9 or x18).
|
* On the ARM and RISC-V architectures gd is mapped to a fixed register.
|
||||||
* Restore it after returning from the UEFI world to the value saved via
|
* Restore it after returning from the UEFI world to the value saved via
|
||||||
* efi_save_gd().
|
* efi_save_gd().
|
||||||
*/
|
*/
|
||||||
void efi_restore_gd(void)
|
void efi_restore_gd(void)
|
||||||
{
|
{
|
||||||
#ifdef CONFIG_ARM
|
#if defined(CONFIG_ARM) || defined(CONFIG_RISCV)
|
||||||
/* Only restore if we're already in EFI context */
|
/* Only restore if we're already in EFI context */
|
||||||
if (!efi_gd)
|
if (!efi_gd)
|
||||||
return;
|
return;
|
||||||
@@ -2920,7 +2920,7 @@ efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
|
|||||||
* us to the current line. This implies that the second half
|
* us to the current line. This implies that the second half
|
||||||
* of the EFI_CALL macro has not been executed.
|
* of the EFI_CALL macro has not been executed.
|
||||||
*/
|
*/
|
||||||
#ifdef CONFIG_ARM
|
#if defined(CONFIG_ARM) || defined(CONFIG_RISCV)
|
||||||
/*
|
/*
|
||||||
* efi_exit() called efi_restore_gd(). We have to undo this
|
* efi_exit() called efi_restore_gd(). We have to undo this
|
||||||
* otherwise __efi_entry_check() will put the wrong value into
|
* otherwise __efi_entry_check() will put the wrong value into
|
||||||
|
@@ -211,7 +211,7 @@ static void efi_var_mem_bs_del(void)
|
|||||||
* @event: callback event
|
* @event: callback event
|
||||||
* @context: callback context
|
* @context: callback context
|
||||||
*/
|
*/
|
||||||
static void EFIAPI __efi_runtime
|
static void EFIAPI
|
||||||
efi_var_mem_notify_exit_boot_services(struct efi_event *event, void *context)
|
efi_var_mem_notify_exit_boot_services(struct efi_event *event, void *context)
|
||||||
{
|
{
|
||||||
EFI_ENTRY("%p, %p", event, context);
|
EFI_ENTRY("%p, %p", event, context);
|
||||||
|
@@ -311,11 +311,13 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle,
|
|||||||
efi_st_printf("Preparing for reset. Press any key...\n");
|
efi_st_printf("Preparing for reset. Press any key...\n");
|
||||||
efi_st_get_key();
|
efi_st_get_key();
|
||||||
|
|
||||||
if (IS_ENABLED(CONFIG_EFI_HAVE_RUNTIME_RESET))
|
if (IS_ENABLED(CONFIG_EFI_HAVE_RUNTIME_RESET)) {
|
||||||
runtime->reset_system(EFI_RESET_WARM, EFI_NOT_READY,
|
runtime->reset_system(EFI_RESET_WARM, EFI_NOT_READY,
|
||||||
sizeof(reset_message), reset_message);
|
sizeof(reset_message), reset_message);
|
||||||
else
|
} else {
|
||||||
|
efi_restore_gd();
|
||||||
do_reset(NULL, 0, 0, NULL);
|
do_reset(NULL, 0, 0, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
efi_st_printf("\n");
|
efi_st_printf("\n");
|
||||||
efi_st_error("Reset failed\n");
|
efi_st_error("Reset failed\n");
|
||||||
|
@@ -12,9 +12,9 @@
|
|||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <asm/byteorder.h>
|
|
||||||
#include <crypto/internal/rsa.h>
|
#include <crypto/internal/rsa.h>
|
||||||
#include <u-boot/rsa-mod-exp.h>
|
#include <u-boot/rsa-mod-exp.h>
|
||||||
|
#include <asm/unaligned.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* br_dec16be() - Convert 16-bit big-endian integer to native
|
* br_dec16be() - Convert 16-bit big-endian integer to native
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
static unsigned br_dec16be(const void *src)
|
static unsigned br_dec16be(const void *src)
|
||||||
{
|
{
|
||||||
return be16_to_cpup(src);
|
return get_unaligned_be16(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,7 +33,7 @@ static unsigned br_dec16be(const void *src)
|
|||||||
*/
|
*/
|
||||||
static uint32_t br_dec32be(const void *src)
|
static uint32_t br_dec32be(const void *src)
|
||||||
{
|
{
|
||||||
return be32_to_cpup(src);
|
return get_unaligned_be32(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user