Commit 3431b392 authored by Tom Rini's avatar Tom Rini

Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot

Patch queue for efi - 2016-10-19

Highlights this time around:

  - Add run time service (power control) support for PSCI (fixed in v3)
  - Add efi gop pointer exposure
  - SMBIOS support for EFI (on ARM)
  - efi pool memory unmap support (needed for 4.8)
  - initial x86 efi payload support (fixed up in v2)
  - various bug fixes
Signed-off-by: default avatarTom Rini <trini@konsulko.com>

Conflicts:
	include/tables_csum.h
parents 68ff827e 3fb97e26
......@@ -21,4 +21,22 @@ config ARMV8_SPIN_TABLE
- Reserve the code for the spin-table and the release address
via a /memreserve/ region in the Device Tree.
config PSCI_RESET
bool "Use PSCI for reset and shutdown"
default y
depends on !ARCH_EXYNOS7 && !ARCH_BCM283X && !TARGET_LS2080A_EMU && \
!TARGET_LS2080A_SIMU && !TARGET_LS2080AQDS && \
!TARGET_LS2080ARDB && !TARGET_LS1012AQDS && \
!TARGET_LS1012ARDB && !TARGET_LS1012AFRDM && \
!TARGET_LS1043ARDB && !ARCH_UNIPHIER && !ARCH_SNAPDRAGON && \
!TARGET_S32V234EVB
help
Most armv8 systems have PSCI support enabled in EL3, either through
ARM Trusted Firmware or other firmware.
On these systems, we do not need to implement system reset manually,
but can instead rely on higher level firmware to deal with it.
Select Y here to make use of PSCI calls for system reset
endif
......@@ -6,6 +6,7 @@
#include <asm-offsets.h>
#include <config.h>
#include <efi_loader.h>
#include <version.h>
#include <asm/macro.h>
#include <asm/psci.h>
......@@ -17,7 +18,7 @@
* x0~x7: input arguments
* x0~x3: output arguments
*/
void hvc_call(struct pt_regs *args)
static void __efi_runtime hvc_call(struct pt_regs *args)
{
asm volatile(
"ldr x0, %0\n"
......@@ -51,7 +52,7 @@ void hvc_call(struct pt_regs *args)
* x0~x3: output arguments
*/
void smc_call(struct pt_regs *args)
void __efi_runtime smc_call(struct pt_regs *args)
{
asm volatile(
"ldr x0, %0\n"
......@@ -75,13 +76,36 @@ void smc_call(struct pt_regs *args)
"x16", "x17");
}
void __noreturn psci_system_reset(bool conduit_smc)
/*
* For now, all systems we support run at least in EL2 and thus
* trigger PSCI calls to EL3 using SMC. If anyone ever wants to
* use PSCI on U-Boot running below a hypervisor, please detect
* this and set the flag accordingly.
*/
static const __efi_runtime_data bool use_smc_for_psci = true;
void __noreturn __efi_runtime psci_system_reset(void)
{
struct pt_regs regs;
regs.regs[0] = ARM_PSCI_0_2_FN_SYSTEM_RESET;
if (conduit_smc)
if (use_smc_for_psci)
smc_call(&regs);
else
hvc_call(&regs);
while (1)
;
}
void __noreturn __efi_runtime psci_system_off(void)
{
struct pt_regs regs;
regs.regs[0] = ARM_PSCI_0_2_FN_SYSTEM_OFF;
if (use_smc_for_psci)
smc_call(&regs);
else
hvc_call(&regs);
......@@ -89,3 +113,30 @@ void __noreturn psci_system_reset(bool conduit_smc)
while (1)
;
}
#ifdef CONFIG_PSCI_RESET
void reset_misc(void)
{
psci_system_reset();
}
#ifdef CONFIG_EFI_LOADER
void __efi_runtime EFIAPI efi_reset_system(
enum efi_reset_type reset_type,
efi_status_t reset_status,
unsigned long data_size, void *reset_data)
{
switch (reset_type) {
case EFI_RESET_COLD:
case EFI_RESET_WARM:
psci_system_reset();
break;
case EFI_RESET_SHUTDOWN:
psci_system_off();
break;
}
while (1) { }
}
#endif /* CONFIG_EFI_LOADER */
#endif /* CONFIG_PSCI_RESET */
......@@ -106,15 +106,6 @@ void smp_kick_all_cpus(void);
void flush_l3_cache(void);
/*
*Issue a hypervisor call in accordance with ARM "SMC Calling convention",
* DEN0028A
*
* @args: input and output arguments
*
*/
void hvc_call(struct pt_regs *args);
/*
*Issue a secure monitor call in accordance with ARM "SMC Calling convention",
* DEN0028A
......@@ -124,7 +115,8 @@ void hvc_call(struct pt_regs *args);
*/
void smc_call(struct pt_regs *args);
void __noreturn psci_system_reset(bool smc);
void __noreturn psci_system_reset(void);
void __noreturn psci_system_off(void);
#endif /* __ASSEMBLY__ */
......
......@@ -43,7 +43,7 @@ void dram_init_banksize(void)
void reset_cpu(ulong addr)
{
psci_system_reset(true);
psci_system_reset();
}
static struct mm_region gxbb_mem_map[] = {
......
......@@ -461,33 +461,6 @@ config GENERATE_ACPI_TABLE
by the operating system. It defines platform-independent interfaces
for configuration and power management monitoring.
config GENERATE_SMBIOS_TABLE
bool "Generate an SMBIOS (System Management BIOS) table"
default y
help
The System Management BIOS (SMBIOS) specification addresses how
motherboard and system vendors present management information about
their products in a standard format by extending the BIOS interface
on Intel architecture systems.
Check http://www.dmtf.org/standards/smbios for details.
config SMBIOS_MANUFACTURER
string "SMBIOS Manufacturer"
depends on GENERATE_SMBIOS_TABLE
default SYS_VENDOR
help
The board manufacturer to store in SMBIOS structures.
Change this to override the default one (CONFIG_SYS_VENDOR).
config SMBIOS_PRODUCT_NAME
string "SMBIOS Product Name"
depends on GENERATE_SMBIOS_TABLE
default SYS_BOARD
help
The product name to store in SMBIOS structures.
Change this to override the default one (CONFIG_SYS_BOARD).
endmenu
config MAX_PIRQ_LINKS
......
......@@ -189,6 +189,7 @@ static const struct cpu_ops cpu_x86_baytrail_ops = {
.get_desc = cpu_x86_get_desc,
.get_info = baytrail_get_info,
.get_count = baytrail_get_count,
.get_vendor = cpu_x86_get_vendor,
};
static const struct udevice_id cpu_x86_baytrail_ids[] = {
......
......@@ -743,6 +743,7 @@ static const struct cpu_ops cpu_x86_broadwell_ops = {
.get_desc = cpu_x86_get_desc,
.get_info = broadwell_get_info,
.get_count = broadwell_get_count,
.get_vendor = cpu_x86_get_vendor,
};
static const struct udevice_id cpu_x86_broadwell_ids[] = {
......
......@@ -15,9 +15,26 @@ DECLARE_GLOBAL_DATA_PTR;
int cpu_x86_bind(struct udevice *dev)
{
struct cpu_platdata *plat = dev_get_parent_platdata(dev);
struct cpuid_result res;
plat->cpu_id = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
"intel,apic-id", -1);
plat->family = gd->arch.x86;
res = cpuid(1);
plat->id[0] = res.eax;
plat->id[1] = res.edx;
return 0;
}
int cpu_x86_get_vendor(struct udevice *dev, char *buf, int size)
{
const char *vendor = cpu_vendor_name(gd->arch.x86_vendor);
if (size < (strlen(vendor) + 1))
return -ENOSPC;
strcpy(buf, vendor);
return 0;
}
......@@ -60,6 +77,7 @@ static int cpu_x86_get_count(struct udevice *dev)
static const struct cpu_ops cpu_x86_ops = {
.get_desc = cpu_x86_get_desc,
.get_count = cpu_x86_get_count,
.get_vendor = cpu_x86_get_vendor,
};
static const struct udevice_id cpu_x86_ids[] = {
......
......@@ -477,6 +477,7 @@ static const struct cpu_ops cpu_x86_model_206ax_ops = {
.get_desc = cpu_x86_get_desc,
.get_info = model_206ax_get_info,
.get_count = model_206ax_get_count,
.get_vendor = cpu_x86_get_vendor,
};
static const struct udevice_id cpu_x86_model_206ax_ids[] = {
......
......@@ -28,7 +28,10 @@ SECTIONS
}
. = ALIGN(4);
.rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
.rodata : {
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
KEEP(*(.rodata.efi.init));
}
. = ALIGN(4);
.data : { *(.data*) }
......@@ -40,6 +43,37 @@ SECTIONS
.got : { *(.got*) }
. = ALIGN(4);
.__efi_runtime_start : {
*(.__efi_runtime_start)
}
.efi_runtime : {
*(efi_runtime_text)
*(efi_runtime_data)
}
.__efi_runtime_stop : {
*(.__efi_runtime_stop)
}
.efi_runtime_rel_start :
{
*(.__efi_runtime_rel_start)
}
.efi_runtime_rel : {
*(.relefi_runtime_text)
*(.relefi_runtime_data)
}
.efi_runtime_rel_stop :
{
*(.__efi_runtime_rel_stop)
}
. = ALIGN(4);
__data_end = .;
__init_end = .;
......
......@@ -31,4 +31,17 @@ int cpu_x86_bind(struct udevice *dev);
*/
int cpu_x86_get_desc(struct udevice *dev, char *buf, int size);
/**
* cpu_x86_get_vendor() - Get a vendor string for an x86 CPU
*
* This uses cpu_vendor_name() and is suitable to use as the get_vendor()
* method for the CPU uclass.
*
* @dev: Device to check (UCLASS_CPU)
* @buf: Buffer to place string
* @size: Size of string space
* @return: 0 if OK, -ENOSPC if buffer is too small, other -ve on error
*/
int cpu_x86_get_vendor(struct udevice *dev, char *buf, int size);
#endif /* _ASM_CPU_X86_H */
......@@ -28,8 +28,8 @@ obj-y += pirq_routing.o
obj-y += relocate.o
obj-y += physmem.o
obj-$(CONFIG_X86_RAMTEST) += ramtest.o
obj-y += sections.o
obj-y += sfi.o
obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += smbios.o
obj-y += string.o
ifndef CONFIG_QEMU
obj-$(CONFIG_GENERATE_ACPI_TABLE) += acpi_table.o
......
/*
* Copyright 2013 Albert ARIBAUD <albert.u.boot@aribaud.net>
*
* SPDX-License-Identifier: GPL-2.0+
*/
char __efi_runtime_start[0] __attribute__((section(".__efi_runtime_start")));
char __efi_runtime_stop[0] __attribute__((section(".__efi_runtime_stop")));
char __efi_runtime_rel_start[0]
__attribute__((section(".__efi_runtime_rel_start")));
char __efi_runtime_rel_stop[0]
__attribute__((section(".__efi_runtime_rel_stop")));
......@@ -5,13 +5,18 @@
*/
#include <common.h>
#include <smbios.h>
#include <asm/sfi.h>
#include <asm/mpspec.h>
#include <asm/smbios.h>
#include <asm/tables.h>
#include <asm/acpi_table.h>
#include <asm/coreboot_tables.h>
static u32 write_smbios_table_wrapper(u32 addr)
{
return write_smbios_table(addr);
}
/**
* Function prototype to write a specific configuration table
*
......@@ -34,7 +39,7 @@ static table_write table_write_funcs[] = {
write_acpi_tables,
#endif
#ifdef CONFIG_GENERATE_SMBIOS_TABLE
write_smbios_table,
write_smbios_table_wrapper,
#endif
};
......
......@@ -427,8 +427,3 @@ int board_usb_cleanup(int index, enum usb_init_type init)
return 0;
}
#endif
void reset_misc(void)
{
psci_system_reset(true);
}
......@@ -15,6 +15,8 @@
#include <libfdt_env.h>
#include <memalign.h>
#include <asm/global_data.h>
#include <asm-generic/sections.h>
#include <linux/linkage.h>
DECLARE_GLOBAL_DATA_PTR;
......@@ -52,7 +54,7 @@ static struct efi_device_path_file_path bootefi_device_path[] = {
}
};
static efi_status_t bootefi_open_dp(void *handle, efi_guid_t *protocol,
static efi_status_t EFIAPI bootefi_open_dp(void *handle, efi_guid_t *protocol,
void **protocol_interface, void *agent_handle,
void *controller_handle, uint32_t attributes)
{
......@@ -145,7 +147,8 @@ static void *copy_fdt(void *fdt)
*/
static unsigned long do_bootefi_exec(void *efi, void *fdt)
{
ulong (*entry)(void *image_handle, struct efi_system_table *st);
ulong (*entry)(void *image_handle, struct efi_system_table *st)
asmlinkage;
ulong fdt_pages, fdt_size, fdt_start, fdt_end;
bootm_headers_t img = { 0 };
......@@ -204,7 +207,16 @@ static unsigned long do_bootefi_exec(void *efi, void *fdt)
if (!memcmp(bootefi_device_path[0].str, "N\0e\0t", 6))
loaded_image_info.device_handle = nethandle;
else
loaded_image_info.device_handle = bootefi_device_path;
#endif
#ifdef CONFIG_GENERATE_SMBIOS_TABLE
efi_smbios_register();
#endif
/* Initialize EFI runtime services */
efi_reset_system_init();
efi_get_time_init();
/* Call our payload! */
debug("%s:%d Jumping to 0x%lx\n", __func__, __LINE__, (long)entry);
......
......@@ -44,6 +44,16 @@ int cpu_get_count(struct udevice *dev)
return ops->get_count(dev);
}
int cpu_get_vendor(struct udevice *dev, char *buf, int size)
{
struct cpu_ops *ops = cpu_get_ops(dev);
if (!ops->get_vendor)
return -ENOSYS;
return ops->get_vendor(dev, buf, size);
}
U_BOOT_DRIVER(cpu_bus) = {
.name = "cpu_bus",
.id = UCLASS_SIMPLE_BUS,
......
......@@ -21,6 +21,8 @@ struct cpu_platdata {
int cpu_id;
int ucode_version;
ulong device_id;
u16 family; /* DMTF CPU Family */
u32 id[2]; /* DMTF CPU Processor IDs */
};
/* CPU features - mostly just a placeholder for now */
......@@ -71,6 +73,16 @@ struct cpu_ops {
* @return CPU count if OK, -ve on error
*/
int (*get_count)(struct udevice *dev);
/**
* get_vendor() - Get vendor name of a CPU
*
* @dev: Device to check (UCLASS_CPU)
* @buf: Buffer to place string
* @size: Size of string space
* @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error
*/
int (*get_vendor)(struct udevice *dev, char *buf, int size);
};
#define cpu_get_ops(dev) ((struct cpu_ops *)(dev)->driver->ops)
......@@ -102,4 +114,14 @@ int cpu_get_info(struct udevice *dev, struct cpu_info *info);
*/
int cpu_get_count(struct udevice *dev);
/**
* cpu_get_vendor() - Get vendor name of a CPU
*
* @dev: Device to check (UCLASS_CPU)
* @buf: Buffer to place string
* @size: Size of string space
* @return 0 if OK, -ENOSPC if buffer is too small, other -ve on error
*/
int cpu_get_vendor(struct udevice *dev, char *buf, int size);
#endif
......@@ -15,6 +15,7 @@
#ifndef _EFI_H
#define _EFI_H
#include <linux/linkage.h>
#include <linux/string.h>
#include <linux/types.h>
......@@ -22,7 +23,7 @@
/* EFI uses the Microsoft ABI which is not the default for GCC */
#define EFIAPI __attribute__((ms_abi))
#else
#define EFIAPI
#define EFIAPI asmlinkage
#endif
struct efi_device_path;
......
......@@ -201,6 +201,10 @@ struct efi_runtime_services {
EFI_GUID(0xb1b621d5, 0xf19c, 0x41a5, \
0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0)
#define SMBIOS_TABLE_GUID \
EFI_GUID(0xeb9d2d31, 0x2d88, 0x11d3, \
0x9a, 0x16, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
struct efi_configuration_table
{
efi_guid_t guid;
......
......@@ -85,6 +85,8 @@ int efi_disk_register(void);
int efi_gop_register(void);
/* Called by bootefi to make the network interface available */
int efi_net_register(void **handle);
/* Called by bootefi to make SMBIOS tables available */
void efi_smbios_register(void);
/* Called by networking code to memorize the dhcp ack package */
void efi_net_set_dhcp_ack(void *pkt, int len);
......@@ -93,7 +95,7 @@ void efi_net_set_dhcp_ack(void *pkt, int len);
* Stub implementation for a protocol opener that just returns the handle as
* interface
*/
efi_status_t efi_return_handle(void *handle,
efi_status_t EFIAPI efi_return_handle(void *handle,
efi_guid_t *protocol, void **protocol_interface,
void *agent_handle, void *controller_handle,
uint32_t attributes);
......@@ -117,8 +119,13 @@ void *efi_alloc(uint64_t len, int memory_type);
/* More specific EFI memory allocator, called by EFI payloads */
efi_status_t efi_allocate_pages(int type, int memory_type, unsigned long pages,
uint64_t *memory);
/* EFI memory free function. Not implemented today */
/* EFI memory free function. */
efi_status_t efi_free_pages(uint64_t memory, unsigned long pages);
/* EFI memory allocator for small allocations */
efi_status_t efi_allocate_pool(int pool_type, unsigned long size,
void **buffer);
/* EFI pool memory free function. */
efi_status_t efi_free_pool(void *buffer);
/* Returns the EFI memory map */
efi_status_t efi_get_memory_map(unsigned long *memory_map_size,
struct efi_mem_desc *memory_map,
......@@ -130,6 +137,8 @@ uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type,
bool overlap_only_ram);
/* Called by board init to initialize the EFI memory map */
int efi_memory_init(void);
/* Adds new or overrides configuration table entry to the system table */
efi_status_t efi_install_configuration_table(const efi_guid_t *guid, void *table);
#ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER
extern void *efi_bounce_buffer;
......@@ -147,14 +156,32 @@ static inline void ascii2unicode(u16 *unicode, const char *ascii)
* Use these to indicate that your code / data should go into the EFI runtime
* section and thus still be available when the OS is running
*/
#define EFI_RUNTIME_DATA __attribute__ ((section ("efi_runtime_data")))
#define EFI_RUNTIME_TEXT __attribute__ ((section ("efi_runtime_text")))
#define __efi_runtime_data __attribute__ ((section ("efi_runtime_data")))
#define __efi_runtime __attribute__ ((section ("efi_runtime_text")))
/* Call this with mmio_ptr as the _pointer_ to a pointer to an MMIO region
* to make it available at runtime */
void efi_add_runtime_mmio(void *mmio_ptr, u64 len);
/* Boards may provide the functions below to implement RTS functionality */
void __efi_runtime EFIAPI efi_reset_system(
enum efi_reset_type reset_type,
efi_status_t reset_status,
unsigned long data_size, void *reset_data);
void efi_reset_system_init(void);
efi_status_t __efi_runtime EFIAPI efi_get_time(
struct efi_time *time,
struct efi_time_cap *capabilities);
void efi_get_time_init(void);
#else /* defined(EFI_LOADER) && !defined(CONFIG_SPL_BUILD) */
/* Without CONFIG_EFI_LOADER we don't have a runtime section, stub it out */
#define EFI_RUNTIME_DATA
#define EFI_RUNTIME_TEXT
#define __efi_runtime_data
#define __efi_runtime
static inline void efi_add_runtime_mmio(void **mmio_ptr, u64 len) { }
/* No loader configured, stub out EFI_ENTRY */
static inline void efi_restore_gd(void) { }
......
......@@ -55,6 +55,7 @@ struct __packed smbios_entry {
#define BIOS_CHARACTERISTICS_SELECTABLE_BOOT (1 << 16)
#define BIOS_CHARACTERISTICS_EXT1_ACPI (1 << 0)
#define BIOS_CHARACTERISTICS_EXT1_UEFI (1 << 3)
#define BIOS_CHARACTERISTICS_EXT2_TARGET (1 << 2)
struct __packed smbios_type0 {
......@@ -139,6 +140,9 @@ struct __packed smbios_type3 {
#define SMBIOS_PROCESSOR_STATUS_ENABLED 1
#define SMBIOS_PROCESSOR_UPGRADE_NONE 6
#define SMBIOS_PROCESSOR_FAMILY_OTHER 1
#define SMBIOS_PROCESSOR_FAMILY_UNKNOWN 2
struct __packed smbios_type4 {
u8 type;
u8 length;
......@@ -221,7 +225,7 @@ static inline void fill_smbios_header(void *table, int type,
* @handle: the structure's handle, a unique 16-bit number
* @return: size of the structure
*/
typedef int (*smbios_write_type)(u32 *addr, int handle);
typedef int (*smbios_write_type)(uintptr_t *addr, int handle);
/**
* write_smbios_table() - Write SMBIOS table
......@@ -231,6 +235,6 @@ typedef int (*smbios_write_type)(u32 *addr, int handle);
* @addr: start address to write SMBIOS table
* @return: end address of SMBIOS table
*/
u32 write_smbios_table(u32 addr);
uintptr_t write_smbios_table(uintptr_t addr);
#endif /* _SMBIOS_H_ */
......@@ -163,6 +163,39 @@ config FDT_FIXUP_PARTITIONS
using partition info defined in the 'mtdparts' environment
variable.
menu "System tables"
depends on (!EFI && !SYS_COREBOOT) || (ARM && EFI_LOADER)
config GENERATE_SMBIOS_TABLE
bool "Generate an SMBIOS (System Management BIOS) table"
default y
depends on X86 || EFI_LOADER
help
The System Management BIOS (SMBIOS) specification addresses how
motherboard and system vendors present management information about
their products in a standard format by extending the BIOS interface
on Intel architecture systems.
Check http://www.dmtf.org/standards/smbios for details.
config SMBIOS_MANUFACTURER
string "SMBIOS Manufacturer"
depends on GENERATE_SMBIOS_TABLE
default SYS_VENDOR
help
The board manufacturer to store in SMBIOS structures.
Change this to override the default one (CONFIG_SYS_VENDOR).
config SMBIOS_PRODUCT_NAME
string "SMBIOS Product Name"
depends on GENERATE_SMBIOS_TABLE
default SYS_BOARD
help
The product name to store in SMBIOS structures.
Change this to override the default one (CONFIG_SYS_BOARD).
endmenu
source lib/efi/Kconfig
source lib/efi_loader/Kconfig
......
......@@ -27,6 +27,7 @@ obj-$(CONFIG_FIT) += fdtdec_common.o
obj-$(CONFIG_TEST_FDTDEC) += fdtdec_test.o
obj-$(CONFIG_GZIP) += gunzip.o
obj-$(CONFIG_GZIP_COMPRESSED) += gzip.o
obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += smbios.o
obj-y += initcall.o
obj-$(CONFIG_LMB) += lmb.o
obj-y += ldiv.o
......@@ -73,6 +74,7 @@ obj-y += linux_string.o
obj-y += membuff.o
obj-$(CONFIG_REGEX) += slre.o
obj-y += string.o
obj-y += tables_csum.o
obj-y += time.o
obj-$(CONFIG_TRACE) += trace.o
obj-$(CONFIG_LIB_UUID) += uuid.o
......
......@@ -12,3 +12,4 @@ obj-y += efi_memory.o
obj-$(CONFIG_LCD) += efi_gop.o
obj-$(CONFIG_PARTITIONS) += efi_disk.o
obj-$(CONFIG_NET) += efi_net.o
obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += efi_smbios.o
......@@ -37,8 +37,9 @@ static bool efi_is_direct_boot = true;
* In most cases we want to pass an FDT to the payload, so reserve one slot of
* config table space for it. The pointer gets populated by do_bootefi_exec().
*/
static struct efi_configuration_table EFI_RUNTIME_DATA efi_conf_table[1];
static struct efi_configuration_table __efi_runtime_data efi_conf_table[2];
#ifdef CONFIG_ARM
/*
* The "gd" pointer lives in a register on ARM and AArch64 that we declare
* fixed when compiling U-Boot. However, the payload does not know about that
......@@ -46,16 +47,20 @@ static struct efi_configuration_table EFI_RUNTIME_DATA efi_conf_table[1];
* EFI callback entry/exit.
*/
static volatile void *efi_gd, *app_gd;
#endif
/* Called from do_bootefi_exec() */
void efi_save_gd(void)
{
#ifdef CONFIG_ARM
efi_gd = gd;
#endif
}
/* Called on every callback entry */
void efi_restore_gd(void)
{
#ifdef CONFIG_ARM
/* Only restore if we're already in EFI context */
if (!efi_gd)
return;
......@@ -63,12 +68,16 @@ void efi_restore_gd(void)
if (gd != efi_gd)
app_gd = gd;
gd = efi_gd;
#endif
}
/* Called on every callback exit */
efi_status_t efi_exit_func(efi_status_t ret)
{