From e706ed7f5b291282e8747e65c2f2d0e4f8ef5e03 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 16 Oct 2018 07:44:53 +0200 Subject: efi_loader: implement EFI_RESET_SHUTDOWN at boot time Allow an EFI application to shut down the system. If EFI_RESET_SHUTDOWN is issued call do_poweroff(). Signed-off-by: Heinrich Schuchardt Signed-off-by: Alexander Graf --- lib/efi_loader/efi_runtime.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/efi_loader/efi_runtime.c') diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index f059dc97fd4..abcf03c5a42 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -141,7 +141,9 @@ static void EFIAPI efi_reset_system_boottime( do_reset(NULL, 0, 0, NULL); break; case EFI_RESET_SHUTDOWN: - /* We don't have anything to map this to */ +#ifdef CONFIG_CMD_POWEROFF + do_poweroff(NULL, 0, 0, NULL); +#endif break; } -- cgit v1.2.3 From afdc4fcc8931589f2fab75d8830ab9b43d2725c4 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Sun, 4 Nov 2018 22:25:22 +0100 Subject: efi_loader: Handle RELA absolute relocations properly With RELA absolute relocations, the relocation target contains our link offset which we need to remove from the equation again. We did this properly in the relative relocation path, but not in the absolute one. So let's do this for the absolute one as well. That way, u-boot can have a TEXT_OFFSET of != 0 and still relocate itself properly. This fixes a bug where efi_loader did not work on the RISC-V QEMU port. With this patch, I can successfully run UEFI applications on the RISC-V QEMU port. Reported-by: Auer, Lukas Signed-off-by: Alexander Graf Tested-by: Bin Meng Tested-by: Lukas Auer --- lib/efi_loader/efi_runtime.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/efi_loader/efi_runtime.c') diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index abcf03c5a42..ca66d33e588 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -380,6 +380,9 @@ void efi_runtime_relocate(ulong offset, struct efi_mem_desc *map) ulong symidx = rel->info >> SYM_INDEX; extern struct dyn_sym __dyn_sym_start[]; newaddr = __dyn_sym_start[symidx].addr + offset; +#ifdef IS_RELA + newaddr -= CONFIG_SYS_TEXT_BASE; +#endif break; } #endif -- cgit v1.2.3 From 19dd90748cb60ab2cf88b3e9c52b0da4bc0ae0a5 Mon Sep 17 00:00:00 2001 From: AKASHI Takahiro Date: Wed, 14 Nov 2018 16:18:53 +0900 Subject: efi_loader: correct a function prototype of QueryCapsuleCapabilities() See UEFI specification v2.7, section 8.5.3. Signed-off-by: AKASHI Takahiro Signed-off-by: Alexander Graf --- lib/efi_loader/efi_runtime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/efi_loader/efi_runtime.c') diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index ca66d33e588..405f7001404 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -628,8 +628,8 @@ efi_status_t __efi_runtime EFIAPI efi_update_capsule( efi_status_t __efi_runtime EFIAPI efi_query_capsule_caps( struct efi_capsule_header **capsule_header_array, efi_uintn_t capsule_count, - u64 maximum_capsule_size, - u32 reset_type) + u64 *maximum_capsule_size, + u32 *reset_type) { return EFI_UNSUPPORTED; } -- cgit v1.2.3 From 83582419ea3653fdf3e5e5d0434f9ff5a8217149 Mon Sep 17 00:00:00 2001 From: AKASHI Takahiro Date: Wed, 14 Nov 2018 16:18:07 +0900 Subject: efi_loader: SetVirtualAddressMap() should return EFI_UNSUPPORTED See UEFI specification 2.7, section 8.4. Signed-off-by: AKASHI Takahiro Signed-off-by: Alexander Graf --- lib/efi_loader/efi_runtime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/efi_loader/efi_runtime.c') diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index 405f7001404..95844efdb0e 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -284,7 +284,7 @@ static const struct efi_runtime_detach_list_struct efi_runtime_detach_list[] = { }, { /* invalidate_*cache_all are gone */ .ptr = &efi_runtime_services.set_virtual_address_map, - .patchto = &efi_invalid_parameter, + .patchto = &efi_unimplemented, }, { /* RTC accessors are gone */ .ptr = &efi_runtime_services.get_time, -- cgit v1.2.3