mirror of
https://github.com/linux-sunxi/u-boot-sunxi.git
synced 2024-02-12 11:16:03 +08:00
Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot
Patch queue for efi - 2018-06-14 A few minor fixes for the release: - Compile fixes - HI20 relocations for RISC-V - Fix bootefi without load path - Fix Runtime Services with certain compilers
This commit is contained in:
@ -143,15 +143,12 @@ void __efi_runtime EFIAPI efi_reset_system(
|
|||||||
efi_status_t reset_status,
|
efi_status_t reset_status,
|
||||||
unsigned long data_size, void *reset_data)
|
unsigned long data_size, void *reset_data)
|
||||||
{
|
{
|
||||||
switch (reset_type) {
|
if (reset_type == EFI_RESET_COLD ||
|
||||||
case EFI_RESET_COLD:
|
reset_type == EFI_RESET_WARM ||
|
||||||
case EFI_RESET_WARM:
|
reset_type == EFI_RESET_PLATFORM_SPECIFIC) {
|
||||||
case EFI_RESET_PLATFORM_SPECIFIC:
|
|
||||||
psci_system_reset();
|
psci_system_reset();
|
||||||
break;
|
} else if (reset_type == EFI_RESET_SHUTDOWN) {
|
||||||
case EFI_RESET_SHUTDOWN:
|
|
||||||
psci_system_off();
|
psci_system_off();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) { }
|
while (1) { }
|
||||||
|
@ -59,13 +59,11 @@ void __efi_runtime EFIAPI efi_reset_system(
|
|||||||
{
|
{
|
||||||
u32 val;
|
u32 val;
|
||||||
|
|
||||||
switch (reset_type) {
|
if (reset_type == EFI_RESET_COLD ||
|
||||||
case EFI_RESET_COLD:
|
reset_type == EFI_RESET_WARM ||
|
||||||
case EFI_RESET_WARM:
|
reset_type == EFI_RESET_PLATFORM_SPECIFIC) {
|
||||||
case EFI_RESET_PLATFORM_SPECIFIC:
|
|
||||||
reset_cpu(0);
|
reset_cpu(0);
|
||||||
break;
|
} else if (reset_type == EFI_RESET_SHUTDOWN) {
|
||||||
case EFI_RESET_SHUTDOWN:
|
|
||||||
/*
|
/*
|
||||||
* We set the watchdog hard reset bit here to distinguish this reset
|
* We set the watchdog hard reset bit here to distinguish this reset
|
||||||
* from the normal (full) reset. bootcode.bin will not reboot after a
|
* from the normal (full) reset. bootcode.bin will not reboot after a
|
||||||
@ -76,7 +74,6 @@ void __efi_runtime EFIAPI efi_reset_system(
|
|||||||
val |= BCM2835_WDOG_RSTS_RASPBERRYPI_HALT;
|
val |= BCM2835_WDOG_RSTS_RASPBERRYPI_HALT;
|
||||||
writel(val, &wdog_regs->rsts);
|
writel(val, &wdog_regs->rsts);
|
||||||
reset_cpu(0);
|
reset_cpu(0);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (1) { }
|
while (1) { }
|
||||||
|
@ -263,6 +263,7 @@ static efi_status_t do_bootefi_exec(void *efi,
|
|||||||
{
|
{
|
||||||
struct efi_loaded_image loaded_image_info = {};
|
struct efi_loaded_image loaded_image_info = {};
|
||||||
struct efi_object loaded_image_info_obj = {};
|
struct efi_object loaded_image_info_obj = {};
|
||||||
|
struct efi_object mem_obj = {};
|
||||||
struct efi_device_path *memdp = NULL;
|
struct efi_device_path *memdp = NULL;
|
||||||
efi_status_t ret;
|
efi_status_t ret;
|
||||||
|
|
||||||
@ -279,6 +280,12 @@ static efi_status_t do_bootefi_exec(void *efi,
|
|||||||
/* actual addresses filled in after efi_load_pe() */
|
/* actual addresses filled in after efi_load_pe() */
|
||||||
memdp = efi_dp_from_mem(0, 0, 0);
|
memdp = efi_dp_from_mem(0, 0, 0);
|
||||||
device_path = image_path = memdp;
|
device_path = image_path = memdp;
|
||||||
|
efi_add_handle(&mem_obj);
|
||||||
|
|
||||||
|
ret = efi_add_protocol(mem_obj.handle, &efi_guid_device_path,
|
||||||
|
device_path);
|
||||||
|
if (ret != EFI_SUCCESS)
|
||||||
|
goto exit;
|
||||||
} else {
|
} else {
|
||||||
assert(device_path && image_path);
|
assert(device_path && image_path);
|
||||||
}
|
}
|
||||||
@ -343,6 +350,8 @@ static efi_status_t do_bootefi_exec(void *efi,
|
|||||||
exit:
|
exit:
|
||||||
/* image has returned, loaded-image obj goes *poof*: */
|
/* image has returned, loaded-image obj goes *poof*: */
|
||||||
list_del(&loaded_image_info_obj.link);
|
list_del(&loaded_image_info_obj.link);
|
||||||
|
if (mem_obj.handle)
|
||||||
|
list_del(&mem_obj.link);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,11 @@
|
|||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* GUID for basic data partions.
|
||||||
|
*/
|
||||||
|
static const efi_guid_t partition_basic_data_guid = PARTITION_BASIC_DATA_GUID;
|
||||||
|
|
||||||
#ifdef CONFIG_HAVE_BLOCK_DEVICE
|
#ifdef CONFIG_HAVE_BLOCK_DEVICE
|
||||||
/**
|
/**
|
||||||
* efi_crc32() - EFI version of crc32 function
|
* efi_crc32() - EFI version of crc32 function
|
||||||
@ -502,12 +507,12 @@ int gpt_fill_pte(struct blk_desc *dev_desc,
|
|||||||
} else {
|
} else {
|
||||||
/* default partition type GUID */
|
/* default partition type GUID */
|
||||||
memcpy(bin_type_guid,
|
memcpy(bin_type_guid,
|
||||||
&PARTITION_BASIC_DATA_GUID, 16);
|
&partition_basic_data_guid, 16);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* partition type GUID */
|
/* partition type GUID */
|
||||||
memcpy(gpt_e[i].partition_type_guid.b,
|
memcpy(gpt_e[i].partition_type_guid.b,
|
||||||
&PARTITION_BASIC_DATA_GUID, 16);
|
&partition_basic_data_guid, 16);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
|
#if CONFIG_IS_ENABLED(PARTITION_UUIDS)
|
||||||
|
@ -89,12 +89,11 @@ typedef u64 efi_virtual_addr_t;
|
|||||||
typedef void *efi_handle_t;
|
typedef void *efi_handle_t;
|
||||||
|
|
||||||
#define EFI_GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
|
#define EFI_GUID(a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \
|
||||||
((efi_guid_t) \
|
|
||||||
{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, \
|
{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, \
|
||||||
((a) >> 24) & 0xff, \
|
((a) >> 24) & 0xff, \
|
||||||
(b) & 0xff, ((b) >> 8) & 0xff, \
|
(b) & 0xff, ((b) >> 8) & 0xff, \
|
||||||
(c) & 0xff, ((c) >> 8) & 0xff, \
|
(c) & 0xff, ((c) >> 8) & 0xff, \
|
||||||
(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) } })
|
(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) } }
|
||||||
|
|
||||||
/* Generic EFI table header */
|
/* Generic EFI table header */
|
||||||
struct efi_table_hdr {
|
struct efi_table_hdr {
|
||||||
|
@ -201,10 +201,13 @@ typedef struct _IMAGE_RELOCATION
|
|||||||
#define IMAGE_REL_BASED_MIPS_JMPADDR 5
|
#define IMAGE_REL_BASED_MIPS_JMPADDR 5
|
||||||
#define IMAGE_REL_BASED_ARM_MOV32A 5 /* yes, 5 too */
|
#define IMAGE_REL_BASED_ARM_MOV32A 5 /* yes, 5 too */
|
||||||
#define IMAGE_REL_BASED_ARM_MOV32 5 /* yes, 5 too */
|
#define IMAGE_REL_BASED_ARM_MOV32 5 /* yes, 5 too */
|
||||||
|
#define IMAGE_REL_BASED_RISCV_HI20 5 /* yes, 5 too */
|
||||||
#define IMAGE_REL_BASED_SECTION 6
|
#define IMAGE_REL_BASED_SECTION 6
|
||||||
#define IMAGE_REL_BASED_REL 7
|
#define IMAGE_REL_BASED_REL 7
|
||||||
#define IMAGE_REL_BASED_ARM_MOV32T 7 /* yes, 7 too */
|
#define IMAGE_REL_BASED_ARM_MOV32T 7 /* yes, 7 too */
|
||||||
#define IMAGE_REL_BASED_THUMB_MOV32 7 /* yes, 7 too */
|
#define IMAGE_REL_BASED_THUMB_MOV32 7 /* yes, 7 too */
|
||||||
|
#define IMAGE_REL_BASED_RISCV_LOW12I 7 /* yes, 7 too */
|
||||||
|
#define IMAGE_REL_BASED_RISCV_LOW12S 8
|
||||||
#define IMAGE_REL_BASED_MIPS_JMPADDR16 9
|
#define IMAGE_REL_BASED_MIPS_JMPADDR16 9
|
||||||
#define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
|
#define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
|
||||||
#define IMAGE_REL_BASED_DIR64 10
|
#define IMAGE_REL_BASED_DIR64 10
|
||||||
|
@ -126,6 +126,20 @@ static efi_status_t efi_loader_relocate(const IMAGE_BASE_RELOCATION *rel,
|
|||||||
case IMAGE_REL_BASED_DIR64:
|
case IMAGE_REL_BASED_DIR64:
|
||||||
*x64 += (uint64_t)delta;
|
*x64 += (uint64_t)delta;
|
||||||
break;
|
break;
|
||||||
|
#ifdef __riscv
|
||||||
|
case IMAGE_REL_BASED_RISCV_HI20:
|
||||||
|
*x32 = ((*x32 & 0xfffff000) + (uint32_t)delta) |
|
||||||
|
(*x32 & 0x00000fff);
|
||||||
|
break;
|
||||||
|
case IMAGE_REL_BASED_RISCV_LOW12I:
|
||||||
|
case IMAGE_REL_BASED_RISCV_LOW12S:
|
||||||
|
/* We know that we're 4k aligned */
|
||||||
|
if (delta & 0xfff) {
|
||||||
|
printf("Unsupported reloc offset\n");
|
||||||
|
return EFI_LOAD_ERROR;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
printf("Unknown Relocation off %x type %x\n",
|
printf("Unknown Relocation off %x type %x\n",
|
||||||
offset, type);
|
offset, type);
|
||||||
|
@ -28,6 +28,10 @@ static efi_status_t __efi_runtime EFIAPI efi_unimplemented(void);
|
|||||||
static efi_status_t __efi_runtime EFIAPI efi_device_error(void);
|
static efi_status_t __efi_runtime EFIAPI efi_device_error(void);
|
||||||
static efi_status_t __efi_runtime EFIAPI efi_invalid_parameter(void);
|
static efi_status_t __efi_runtime EFIAPI efi_invalid_parameter(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO(sjg@chromium.org): These defines and structs should come from the elf
|
||||||
|
* header for each arch (or a generic header) rather than being repeated here.
|
||||||
|
*/
|
||||||
#if defined(CONFIG_ARM64)
|
#if defined(CONFIG_ARM64)
|
||||||
#define R_RELATIVE 1027
|
#define R_RELATIVE 1027
|
||||||
#define R_MASK 0xffffffffULL
|
#define R_MASK 0xffffffffULL
|
||||||
|
@ -385,8 +385,14 @@ cmd_efi_ld = $(LD) -nostdlib -znocombreloc -T $(EFI_LDS_PATH) -shared \
|
|||||||
|
|
||||||
EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS)
|
EFI_LDS_PATH = $(srctree)/arch/$(ARCH)/lib/$(EFI_LDS)
|
||||||
|
|
||||||
$(obj)/%_efi.so: $(obj)/%.o arch/$(ARCH)/lib/$(EFI_CRT0) \
|
$(obj)/efi_crt0.o: $(srctree)/arch/$(ARCH)/lib/$(EFI_CRT0:.o=.S)
|
||||||
arch/$(ARCH)/lib/$(EFI_RELOC)
|
$(call if_changed_dep,as_o_S)
|
||||||
|
|
||||||
|
$(obj)/efi_reloc.o: $(srctree)/arch/$(ARCH)/lib/$(EFI_RELOC:.o=.c) $(recordmcount_source) FORCE
|
||||||
|
$(call cmd,force_checksrc)
|
||||||
|
$(call if_changed_rule,cc_o_c)
|
||||||
|
|
||||||
|
$(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o
|
||||||
$(call cmd,efi_ld)
|
$(call cmd,efi_ld)
|
||||||
|
|
||||||
# ACPI
|
# ACPI
|
||||||
|
Reference in New Issue
Block a user