mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-13 15:03:58 +03:00
Merge tag 'efi-2025-10-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request efi-2025-10-rc1 CI: https://source.denx.de/u-boot/custodians/u-boot-efi/-/pipelines/27176 Documentation: * update FIT signature testing instructions * describe defconfigs for AM69-SK UEFI: * provide unit test for system table pointer * efi_realloc() must check efi_alloc() return value * correct EFI_DEBUG_TABLE_ENTRY_SIZE * avoid NULL dereference in ESRT creation tests * add missing check in FMP.GetImageInfo() * rename lib/efi to lib/efi_client * rename CONFIG_EFI to CONFIG_EFI_CLIENT * create a new CONFIG_EFI * update maintainers for EFI_CLIENT
This commit is contained in:
@@ -1094,7 +1094,7 @@ F: drivers/core/
|
||||
F: include/dm/
|
||||
F: test/dm/
|
||||
|
||||
EFI APP
|
||||
EFI CLIENT
|
||||
M: Simon Glass <sjg@chromium.org>
|
||||
M: Heinrich Schuchardt <xypron.glpk@gmx.de>
|
||||
S: Maintained
|
||||
@@ -1104,11 +1104,11 @@ F: configs/efi-x86_app*
|
||||
F: doc/develop/uefi/u-boot_on_efi.rst
|
||||
F: drivers/block/efi-media-uclass.c
|
||||
F: drivers/block/sb_efi_media.c
|
||||
F: lib/efi/efi_app.c
|
||||
F: lib/efi_client/
|
||||
F: scripts/build-efi.sh
|
||||
F: test/dm/efi_media.c
|
||||
|
||||
EFI PAYLOAD
|
||||
EFI LOADER
|
||||
M: Heinrich Schuchardt <xypron.glpk@gmx.de>
|
||||
M: Ilias Apalodimas <ilias.apalodimas@linaro.org>
|
||||
S: Maintained
|
||||
|
||||
2
Makefile
2
Makefile
@@ -1891,7 +1891,7 @@ u-boot-payload.lds: $(LDSCRIPT_EFI) FORCE
|
||||
quiet_cmd_u-boot_payload ?= LD $@
|
||||
cmd_u-boot_payload ?= $(LD) $(LDFLAGS_EFI_PAYLOAD) -o $@ \
|
||||
-T u-boot-payload.lds arch/x86/cpu/call32.o \
|
||||
lib/efi/efi.o lib/efi/efi_stub.o u-boot.bin.o \
|
||||
lib/efi_client/efi.o lib/efi_client/efi_stub.o u-boot.bin.o \
|
||||
$(addprefix arch/$(ARCH)/lib/,$(EFISTUB))
|
||||
|
||||
u-boot-payload: u-boot.bin.o u-boot-payload.lds FORCE
|
||||
|
||||
@@ -368,7 +368,7 @@ config USE_HOB
|
||||
|
||||
config HAVE_FSP
|
||||
bool "Add an Firmware Support Package binary"
|
||||
depends on !EFI
|
||||
depends on !EFI_CLIENT
|
||||
select USE_HOB
|
||||
select HAS_ROM
|
||||
help
|
||||
@@ -517,7 +517,7 @@ config FSP_BROKEN_HOB
|
||||
|
||||
config ENABLE_MRC_CACHE
|
||||
bool "Enable MRC cache"
|
||||
depends on !EFI && !SYS_COREBOOT
|
||||
depends on !EFI_CLIENT && !SYS_COREBOOT
|
||||
help
|
||||
Enable this feature to cause MRC data to be cached in NV storage
|
||||
to be used for speeding up boot time on future reboots and/or
|
||||
@@ -756,7 +756,7 @@ config HAVE_P2SB
|
||||
devices.
|
||||
|
||||
menu "System tables"
|
||||
depends on !EFI && !SYS_COREBOOT
|
||||
depends on !EFI_CLIENT && !SYS_COREBOOT
|
||||
|
||||
config GENERATE_PIRQ_TABLE
|
||||
bool "Generate a PIRQ table"
|
||||
|
||||
@@ -47,7 +47,7 @@ obj-$(CONFIG_INTEL_BRASWELL) += braswell/
|
||||
obj-$(CONFIG_INTEL_BROADWELL) += broadwell/
|
||||
obj-$(CONFIG_SYS_COREBOOT) += coreboot/
|
||||
obj-$(CONFIG_SYS_SLIMBOOTLOADER) += slimbootloader/
|
||||
obj-$(CONFIG_EFI) += efi/
|
||||
obj-$(CONFIG_EFI_CLIENT) += efi/
|
||||
obj-$(CONFIG_QEMU) += qemu/
|
||||
obj-$(CONFIG_NORTHBRIDGE_INTEL_IVYBRIDGE) += ivybridge/
|
||||
obj-$(CONFIG_INTEL_QUARK) += quark/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
if EFI
|
||||
if EFI_CLIENT
|
||||
|
||||
config SYS_CAR_ADDR
|
||||
hex
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
|
||||
obj-y += cpu.o interrupts.o setjmp.o
|
||||
|
||||
ifndef CONFIG_EFI
|
||||
ifndef CONFIG_EFI_CLIENT
|
||||
obj-y += misc.o
|
||||
endif
|
||||
|
||||
@@ -67,7 +67,7 @@ obj-$(CONFIG_CMD_EXTENSION) += extension_board.o
|
||||
obj-$(CONFIG_CMD_ECHO) += echo.o
|
||||
obj-$(CONFIG_ENV_IS_IN_EEPROM) += eeprom.o
|
||||
obj-$(CONFIG_CMD_EEPROM) += eeprom.o
|
||||
obj-$(CONFIG_EFI) += efi.o efi_common.o
|
||||
obj-$(CONFIG_EFI_CLIENT) += efi.o efi_common.o
|
||||
obj-$(CONFIG_CMD_EFIDEBUG) += efidebug.o efi_common.o
|
||||
obj-$(CONFIG_CMD_EFICONFIG) += eficonfig.o
|
||||
ifdef CONFIG_CMD_EFICONFIG
|
||||
|
||||
@@ -7,7 +7,7 @@ CONFIG_DEBUG_UART_CLOCK=0
|
||||
CONFIG_VENDOR_EFI=y
|
||||
CONFIG_TARGET_EFI_APP32=y
|
||||
CONFIG_DEBUG_UART=y
|
||||
CONFIG_EFI=y
|
||||
CONFIG_EFI_CLIENT=y
|
||||
CONFIG_FIT=y
|
||||
# CONFIG_BOOTSTD is not set
|
||||
CONFIG_SHOW_BOOT_PROGRESS=y
|
||||
|
||||
@@ -8,7 +8,7 @@ CONFIG_X86_RUN_64BIT=y
|
||||
CONFIG_VENDOR_EFI=y
|
||||
CONFIG_TARGET_EFI_APP64=y
|
||||
CONFIG_DEBUG_UART=y
|
||||
CONFIG_EFI=y
|
||||
CONFIG_EFI_CLIENT=y
|
||||
CONFIG_EFI_APP_64BIT=y
|
||||
CONFIG_FIT=y
|
||||
# CONFIG_BOOTSTD is not set
|
||||
|
||||
@@ -5,7 +5,7 @@ CONFIG_DEFAULT_DEVICE_TREE="efi-x86_payload"
|
||||
CONFIG_PRE_CON_BUF_ADDR=0x100000
|
||||
CONFIG_VENDOR_EFI=y
|
||||
CONFIG_TARGET_EFI_PAYLOAD=y
|
||||
CONFIG_EFI=y
|
||||
CONFIG_EFI_CLIENT=y
|
||||
CONFIG_EFI_STUB=y
|
||||
CONFIG_FIT=y
|
||||
CONFIG_FIT_SIGNATURE=y
|
||||
|
||||
@@ -5,7 +5,7 @@ CONFIG_DEFAULT_DEVICE_TREE="efi-x86_payload"
|
||||
CONFIG_PRE_CON_BUF_ADDR=0x100000
|
||||
CONFIG_VENDOR_EFI=y
|
||||
CONFIG_TARGET_EFI_PAYLOAD=y
|
||||
CONFIG_EFI=y
|
||||
CONFIG_EFI_CLIENT=y
|
||||
CONFIG_EFI_STUB=y
|
||||
CONFIG_EFI_STUB_64BIT=y
|
||||
CONFIG_FIT=y
|
||||
|
||||
@@ -90,6 +90,15 @@ Set the variables corresponding to this platform:
|
||||
export OPTEE_PLATFORM=k3-j784s4
|
||||
export OPTEE_EXTRA_ARGS="CFG_CONSOLE_UART=0x8"
|
||||
|
||||
.. note::
|
||||
|
||||
For AM69-SK, use the following U_BOOT_CFG instead:
|
||||
|
||||
.. prompt:: bash
|
||||
|
||||
export UBOOT_CFG_CORTEXR=am69_sk_r5_defconfig
|
||||
export UBOOT_CFG_CORTEXA=am69_sk_a72_defconfig
|
||||
|
||||
.. j784s4_evm_rst_include_start_build_steps
|
||||
|
||||
1. Trusted Firmware-A
|
||||
|
||||
@@ -45,15 +45,15 @@ First choose a board that has EFI support and obtain an EFI implementation
|
||||
for that board. It will be either 32-bit or 64-bit. Alternatively, you can
|
||||
opt for using QEMU [1] and the OVMF [2], as detailed below.
|
||||
|
||||
To build U-Boot as an EFI application, enable CONFIG_EFI and CONFIG_EFI_APP.
|
||||
The efi-x86_app32 and efi-x86_app64 configs are set up for this. Just build
|
||||
U-Boot as normal, e.g.::
|
||||
To build U-Boot as an EFI application, enable CONFIG_EFI_CLIENT and
|
||||
CONFIG_EFI_APP. The efi-x86_app32 and efi-x86_app64 configs are set up for
|
||||
this. Just build U-Boot as normal, e.g.::
|
||||
|
||||
make efi-x86_app32_defconfig
|
||||
make
|
||||
|
||||
To build U-Boot as an EFI payload (32-bit or 64-bit EFI can be used), enable
|
||||
CONFIG_EFI, CONFIG_EFI_STUB, and select either CONFIG_EFI_STUB_32BIT or
|
||||
CONFIG_EFI_CLIENT, CONFIG_EFI_STUB, and select either CONFIG_EFI_STUB_32BIT or
|
||||
CONFIG_EFI_STUB_64BIT. The efi-x86_payload configs (efi-x86_payload32_defconfig
|
||||
and efi-x86_payload32_defconfig) are set up for this. Then build U-Boot as
|
||||
normal, e.g.::
|
||||
@@ -113,7 +113,7 @@ implemented completely differently.
|
||||
EFI Application
|
||||
~~~~~~~~~~~~~~~
|
||||
For the application the whole of U-Boot is built as a shared library. The
|
||||
efi_main() function is in lib/efi/efi_app.c. It sets up some basic EFI
|
||||
efi_main() function is in lib/efi_client/efi_app.c. It sets up some basic EFI
|
||||
functions with efi_init(), sets up U-Boot global_data, allocates memory for
|
||||
U-Boot's malloc(), etc. and enters the normal init sequence (board_init_f()
|
||||
and board_init_r()).
|
||||
@@ -121,7 +121,7 @@ and board_init_r()).
|
||||
Since U-Boot limits its memory access to the allocated regions very little
|
||||
special code is needed. The CONFIG_EFI_APP option controls a few things
|
||||
that need to change so 'git grep CONFIG_EFI_APP' may be instructive.
|
||||
The CONFIG_EFI option controls more general EFI adjustments.
|
||||
The CONFIG_EFI_CLIENT option controls more general EFI adjustments.
|
||||
|
||||
The only available driver is the serial driver. This calls back into EFI
|
||||
'boot services' to send and receive characters. Although it is implemented
|
||||
@@ -149,7 +149,7 @@ image (including device tree) into a small EFI stub application responsible
|
||||
for booting it. The stub application is built as a normal EFI application
|
||||
except that it has a lot of data attached to it.
|
||||
|
||||
The stub application is implemented in lib/efi/efi_stub.c. The efi_main()
|
||||
The stub application is implemented in lib/efi_client/efi_stub.c. The efi_main()
|
||||
function is called by EFI. It is responsible for copying U-Boot from its
|
||||
original location into memory, disabling EFI boot services and starting
|
||||
U-Boot. U-Boot then starts as normal, relocates, starts all drivers, etc.
|
||||
@@ -192,7 +192,7 @@ careful to build the correct one so that your UEFI firmware can start it. Most
|
||||
UEFI images are 64-bit at present.
|
||||
|
||||
The payload stub can be build as either 32- or 64-bits. Only a small amount
|
||||
of code is built this way (see the extra- line in lib/efi/Makefile).
|
||||
of code is built this way (see the extra- line in lib/efi_client/Makefile).
|
||||
Everything else is built as a normal U-Boot, so is always 32-bit on x86 at
|
||||
present.
|
||||
|
||||
@@ -353,7 +353,7 @@ This work could be extended in a number of ways:
|
||||
|
||||
Where is the code?
|
||||
------------------
|
||||
lib/efi
|
||||
lib/efi_client
|
||||
payload stub, application, support code. Mostly arch-neutral
|
||||
|
||||
arch/x86/cpu/efi
|
||||
|
||||
@@ -433,16 +433,14 @@ CONFIG_LEGACY_IMAGE_FORMAT
|
||||
Testing
|
||||
-------
|
||||
|
||||
An easy way to test signing and verification is to use the test script
|
||||
provided in test/vboot/vboot_test.sh. This uses sandbox (a special version
|
||||
An easy way to test signing and verification is to use the vboot tests
|
||||
provided in the pytest suite. This uses sandbox (a special version
|
||||
of U-Boot which runs under Linux) to show the operation of a 'bootm'
|
||||
command loading and verifying images.
|
||||
|
||||
A sample run is show below::
|
||||
|
||||
$ make O=sandbox sandbox_config
|
||||
$ make O=sandbox
|
||||
$ O=sandbox ./test/vboot/vboot_test.sh
|
||||
$ ./test/py/test.py --bd sandbox --build -k vboot
|
||||
|
||||
|
||||
Simple Verified Boot Test
|
||||
|
||||
@@ -96,7 +96,7 @@ config TPL_BLOCK_CACHE
|
||||
|
||||
config EFI_MEDIA
|
||||
bool "Support EFI media drivers"
|
||||
default y if EFI || SANDBOX
|
||||
default y if EFI_CLIENT || SANDBOX
|
||||
select BLK
|
||||
help
|
||||
Enable this to support media devices on top of UEFI. This enables
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* In case of the EFI app the UEFI firmware provides the low-level
|
||||
* initialisation.
|
||||
*/
|
||||
#ifdef CONFIG_EFI
|
||||
#ifdef CONFIG_EFI_CLIENT
|
||||
#define ll_boot_init() false
|
||||
#else
|
||||
#include <asm/global_data.h>
|
||||
|
||||
@@ -1096,7 +1096,7 @@ config VPL_OF_LIBFDT_ASSUME_MASK
|
||||
unsafe execution. See FDT_ASSUME_PERFECT, etc. in libfdt_internal.h
|
||||
|
||||
menu "System tables"
|
||||
depends on (!EFI && !SYS_COREBOOT) || (ARM && EFI_LOADER)
|
||||
depends on (!EFI_CLIENT && !SYS_COREBOOT) || (ARM && EFI_LOADER)
|
||||
|
||||
config BLOBLIST_TABLES
|
||||
bool "Put tables in a bloblist"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
ifndef CONFIG_XPL_BUILD
|
||||
|
||||
obj-$(CONFIG_EFI) += efi/
|
||||
obj-$(CONFIG_EFI_CLIENT) += efi_client/
|
||||
obj-$(CONFIG_EFI_LOADER) += efi_driver/
|
||||
obj-$(CONFIG_EFI_LOADER) += efi_loader/
|
||||
obj-$(CONFIG_CMD_BOOTEFI_SELFTEST) += efi_selftest/
|
||||
|
||||
@@ -1,79 +1,12 @@
|
||||
menu "U-Boot as UEFI application"
|
||||
depends on X86
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
# Copyright 2025 Simon Glass <sjg@chromium.org>
|
||||
#
|
||||
|
||||
config EFI
|
||||
bool "Support running U-Boot from EFI"
|
||||
depends on X86
|
||||
imply X86_TSC_READ_BASE
|
||||
bool
|
||||
help
|
||||
U-Boot can be started from EFI on certain platforms. This allows
|
||||
EFI to perform most of the system init and then jump to U-Boot for
|
||||
final system boot. Another option is to run U-Boot as an EFI
|
||||
application, with U-Boot using EFI's drivers instead of its own.
|
||||
Indicates that EFI functionality is enabled, either via EFI_CLIENT or
|
||||
EFI_LOADER
|
||||
|
||||
choice
|
||||
prompt "Select EFI mode to use"
|
||||
depends on X86 && EFI
|
||||
|
||||
config EFI_APP
|
||||
bool "Support running as an EFI application"
|
||||
select CHARSET
|
||||
help
|
||||
Build U-Boot as an application which can be started from EFI. This
|
||||
is useful for examining a platform in the early stages of porting
|
||||
U-Boot to it. It allows only very basic functionality, such as a
|
||||
command prompt and memory and I/O functions. Use 'reset' to return
|
||||
to EFI.
|
||||
|
||||
config EFI_STUB
|
||||
bool "Support running as an EFI payload"
|
||||
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "EFI app 32/64-bit selection"
|
||||
depends on EFI_APP
|
||||
help
|
||||
EFI does not support mixing 32-bit and 64-bit modes. This is a
|
||||
significant problem because it means that you must build a stub with
|
||||
the correct type for EFI to load it correctly. If you are using
|
||||
32-bit EFI, select 32-bit here, else select 64-bit. Failure to do
|
||||
this may produce no error message - it just won't start!
|
||||
|
||||
config EFI_APP_32BIT
|
||||
bool "Produce an app for running with 32-bit EFI"
|
||||
|
||||
config EFI_APP_64BIT
|
||||
bool "Produce an app for running with 64-bit EFI"
|
||||
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "EFI stub 32/64-bit selection"
|
||||
depends on EFI_STUB
|
||||
help
|
||||
EFI does not support mixing 32-bit and 64-bit modes. This is a
|
||||
significant problem because it means that you must build a stub with
|
||||
the correct type for EFI to load it correctly. If you are using
|
||||
32-bit EFI, select 32-bit here, else select 64-bit. Failure to do
|
||||
this may produce no error message - it just won't start!
|
||||
|
||||
config EFI_STUB_32BIT
|
||||
bool "Produce a stub for running with 32-bit EFI"
|
||||
|
||||
config EFI_STUB_64BIT
|
||||
bool "Produce a stub for running with 64-bit EFI"
|
||||
|
||||
endchoice
|
||||
|
||||
config EFI_RAM_SIZE
|
||||
hex "Amount of EFI RAM for U-Boot"
|
||||
depends on EFI_APP
|
||||
default 0x10000000
|
||||
help
|
||||
Set the amount of EFI RAM which is claimed by U-Boot for its own
|
||||
use. U-Boot allocates this from EFI on start-up (along with a few
|
||||
other smaller amounts) and it can never be increased after that.
|
||||
It is used as the RAM size in with U-Boot.
|
||||
|
||||
endmenu
|
||||
This is used to provide libraries shared by both.
|
||||
|
||||
80
lib/efi_client/Kconfig
Normal file
80
lib/efi_client/Kconfig
Normal file
@@ -0,0 +1,80 @@
|
||||
menu "U-Boot as UEFI application"
|
||||
depends on X86
|
||||
|
||||
config EFI_CLIENT
|
||||
bool "Support running U-Boot from EFI"
|
||||
depends on X86
|
||||
imply X86_TSC_READ_BASE
|
||||
select EFI
|
||||
help
|
||||
U-Boot can be started from EFI on certain platforms. This allows
|
||||
EFI to perform most of the system init and then jump to U-Boot for
|
||||
final system boot. Another option is to run U-Boot as an EFI
|
||||
application, with U-Boot using EFI's drivers instead of its own.
|
||||
|
||||
choice
|
||||
prompt "Select EFI mode to use"
|
||||
depends on X86 && EFI_CLIENT
|
||||
|
||||
config EFI_APP
|
||||
bool "Support running as an EFI application"
|
||||
select CHARSET
|
||||
help
|
||||
Build U-Boot as an application which can be started from EFI. This
|
||||
is useful for examining a platform in the early stages of porting
|
||||
U-Boot to it. It allows only very basic functionality, such as a
|
||||
command prompt and memory and I/O functions. Use 'reset' to return
|
||||
to EFI.
|
||||
|
||||
config EFI_STUB
|
||||
bool "Support running as an EFI payload"
|
||||
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "EFI app 32/64-bit selection"
|
||||
depends on EFI_APP
|
||||
help
|
||||
EFI does not support mixing 32-bit and 64-bit modes. This is a
|
||||
significant problem because it means that you must build a stub with
|
||||
the correct type for EFI to load it correctly. If you are using
|
||||
32-bit EFI, select 32-bit here, else select 64-bit. Failure to do
|
||||
this may produce no error message - it just won't start!
|
||||
|
||||
config EFI_APP_32BIT
|
||||
bool "Produce an app for running with 32-bit EFI"
|
||||
|
||||
config EFI_APP_64BIT
|
||||
bool "Produce an app for running with 64-bit EFI"
|
||||
|
||||
endchoice
|
||||
|
||||
choice
|
||||
prompt "EFI stub 32/64-bit selection"
|
||||
depends on EFI_STUB
|
||||
help
|
||||
EFI does not support mixing 32-bit and 64-bit modes. This is a
|
||||
significant problem because it means that you must build a stub with
|
||||
the correct type for EFI to load it correctly. If you are using
|
||||
32-bit EFI, select 32-bit here, else select 64-bit. Failure to do
|
||||
this may produce no error message - it just won't start!
|
||||
|
||||
config EFI_STUB_32BIT
|
||||
bool "Produce a stub for running with 32-bit EFI"
|
||||
|
||||
config EFI_STUB_64BIT
|
||||
bool "Produce a stub for running with 64-bit EFI"
|
||||
|
||||
endchoice
|
||||
|
||||
config EFI_RAM_SIZE
|
||||
hex "Amount of EFI RAM for U-Boot"
|
||||
depends on EFI_APP
|
||||
default 0x10000000
|
||||
help
|
||||
Set the amount of EFI RAM which is claimed by U-Boot for its own
|
||||
use. U-Boot allocates this from EFI on start-up (along with a few
|
||||
other smaller amounts) and it can never be increased after that.
|
||||
It is used as the RAM size in with U-Boot.
|
||||
|
||||
endmenu
|
||||
@@ -16,6 +16,7 @@ config EFI_LOADER
|
||||
depends on !EFI_STUB || !X86 || X86_64 || EFI_STUB_32BIT
|
||||
depends on !EFI_APP
|
||||
default y if !ARM || SYS_CPU = armv7 || SYS_CPU = armv8
|
||||
select EFI
|
||||
select CHARSET
|
||||
# We need to send DM events, dynamically, in the EFI block driver
|
||||
select DM_EVENT
|
||||
@@ -595,6 +596,8 @@ config BOOTEFI_TESTAPP_COMPILE
|
||||
|
||||
endif
|
||||
|
||||
source "lib/efi_client/Kconfig"
|
||||
|
||||
source "lib/efi/Kconfig"
|
||||
|
||||
endmenu
|
||||
|
||||
@@ -22,7 +22,7 @@ struct efi_debug_image_info_table_header efi_m_debug_info_table_header = {
|
||||
*/
|
||||
static u32 efi_m_max_table_entries;
|
||||
|
||||
#define EFI_DEBUG_TABLE_ENTRY_SIZE (sizeof(union efi_debug_image_info *))
|
||||
#define EFI_DEBUG_TABLE_ENTRY_SIZE (sizeof(union efi_debug_image_info))
|
||||
|
||||
/**
|
||||
* efi_initialize_system_table_pointer() - Initialize system table pointer
|
||||
|
||||
@@ -332,6 +332,8 @@ static efi_status_t efi_fill_image_desc_array(
|
||||
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
if (!image_info)
|
||||
return EFI_INVALID_PARAMETER;
|
||||
*image_info_size = total_size;
|
||||
|
||||
ret = efi_gen_capsule_guids();
|
||||
|
||||
@@ -714,6 +714,8 @@ efi_status_t efi_realloc(void **ptr, size_t size)
|
||||
sizeof(struct efi_pool_allocation);
|
||||
|
||||
new_ptr = efi_alloc(size);
|
||||
if (!new_ptr)
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
|
||||
/* copy old data to new alloced buffer */
|
||||
memcpy(new_ptr, *ptr, min(size, old_size));
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <efi_loader.h>
|
||||
#include <efi_selftest.h>
|
||||
#include <linux/sizes.h>
|
||||
|
||||
/**
|
||||
* efi_st_debug_support_execute() - execute test
|
||||
@@ -21,6 +22,12 @@ static int efi_st_debug_support_execute(void)
|
||||
{
|
||||
struct efi_debug_image_info_table_header *efi_st_debug_info_table_header = NULL;
|
||||
efi_guid_t efi_debug_image_info_table_guid = EFI_DEBUG_IMAGE_INFO_TABLE_GUID;
|
||||
struct efi_mem_desc *memory_map;
|
||||
efi_uintn_t map_size = 0;
|
||||
efi_uintn_t map_key;
|
||||
efi_uintn_t desc_size;
|
||||
u32 desc_version;
|
||||
efi_status_t ret;
|
||||
|
||||
/* get EFI_DEBUG_IMAGE_INFO_TABLE */
|
||||
efi_st_debug_info_table_header = efi_st_get_config_table(&efi_debug_image_info_table_guid);
|
||||
@@ -30,7 +37,66 @@ static int efi_st_debug_support_execute(void)
|
||||
return EFI_ST_FAILURE;
|
||||
}
|
||||
|
||||
return EFI_ST_SUCCESS;
|
||||
/* Load memory map */
|
||||
ret = st_boottime->get_memory_map(&map_size, NULL, &map_key, &desc_size,
|
||||
&desc_version);
|
||||
if (ret != EFI_BUFFER_TOO_SMALL) {
|
||||
efi_st_error
|
||||
("GetMemoryMap did not return EFI_BUFFER_TOO_SMALL\n");
|
||||
return EFI_ST_FAILURE;
|
||||
}
|
||||
/* Allocate extra space for newly allocated memory */
|
||||
map_size += sizeof(struct efi_mem_desc);
|
||||
ret = st_boottime->allocate_pool(EFI_BOOT_SERVICES_DATA, map_size,
|
||||
(void **)&memory_map);
|
||||
if (ret != EFI_SUCCESS) {
|
||||
efi_st_error("AllocatePool failed\n");
|
||||
return EFI_ST_FAILURE;
|
||||
}
|
||||
ret = st_boottime->get_memory_map(&map_size, memory_map, &map_key,
|
||||
&desc_size, &desc_version);
|
||||
if (ret != EFI_SUCCESS) {
|
||||
efi_st_error("GetMemoryMap failed\n");
|
||||
return EFI_ST_FAILURE;
|
||||
}
|
||||
/* Find the system table pointer */
|
||||
for (efi_uintn_t i = 0; map_size; ++i, map_size -= desc_size) {
|
||||
struct efi_mem_desc *entry = &memory_map[i];
|
||||
u64 end;
|
||||
|
||||
if (entry->type != EFI_RUNTIME_SERVICES_DATA)
|
||||
continue;
|
||||
|
||||
end = entry->physical_start +
|
||||
(entry->num_pages << EFI_PAGE_SHIFT);
|
||||
for (u64 pos = ALIGN(entry->physical_start, SZ_4M);
|
||||
pos <= end; pos += SZ_4M) {
|
||||
struct efi_system_table_pointer *systab_pointer =
|
||||
(void *)(uintptr_t)pos;
|
||||
|
||||
/* check for overflow */
|
||||
if (pos < entry->physical_start)
|
||||
break;
|
||||
if (systab_pointer->signature ==
|
||||
EFI_SYSTEM_TABLE_SIGNATURE) {
|
||||
if (systab_pointer->efi_system_table_base !=
|
||||
(uintptr_t)st_systable) {
|
||||
efi_st_error("Wrong system table address\n");
|
||||
ret = EFI_ST_FAILURE;
|
||||
goto out;
|
||||
}
|
||||
ret = EFI_ST_SUCCESS;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
}
|
||||
efi_st_error("System table pointer not found\n");
|
||||
ret = EFI_ST_FAILURE;
|
||||
|
||||
out:
|
||||
st_boottime->free_pool(memory_map);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
EFI_UNIT_TEST(debug_support) = {
|
||||
|
||||
@@ -69,10 +69,12 @@ EFIAPI efi_test_fmp_get_image_info(struct efi_firmware_management_protocol *this
|
||||
if (package_version_name)
|
||||
*package_version_name = NULL;
|
||||
|
||||
if (*image_info_size < sizeof(*image_info)) {
|
||||
*image_info_size = *descriptor_size * *descriptor_count;
|
||||
if (*image_info_size < sizeof(*image_info) * TEST_ESRT_NUM_ENTRIES) {
|
||||
*image_info_size = sizeof(*image_info) * TEST_ESRT_NUM_ENTRIES;
|
||||
return EFI_BUFFER_TOO_SMALL;
|
||||
}
|
||||
if (!image_info)
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
||||
for (int idx = 0; idx < TEST_ESRT_NUM_ENTRIES; idx++)
|
||||
image_info[idx] = static_img_info[idx];
|
||||
|
||||
@@ -94,7 +94,7 @@ static const struct {
|
||||
"system", "EFI System Partition",
|
||||
PARTITION_SYSTEM_GUID,
|
||||
},
|
||||
#if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI)
|
||||
#if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI_CLIENT)
|
||||
{
|
||||
NULL, "Device Path",
|
||||
PARTITION_SYSTEM_GUID,
|
||||
@@ -281,7 +281,7 @@ static const struct {
|
||||
EFI_CERT_TYPE_PKCS7_GUID,
|
||||
},
|
||||
#endif
|
||||
#if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI)
|
||||
#if defined(CONFIG_CMD_EFIDEBUG) || defined(CONFIG_EFI_CLIENT)
|
||||
{ "EFI_LZMA_COMPRESSED", NULL, EFI_LZMA_COMPRESSED },
|
||||
{ "EFI_DXE_SERVICES", NULL, EFI_DXE_SERVICES },
|
||||
{ "EFI_HOB_LIST", NULL, EFI_HOB_LIST },
|
||||
|
||||
Reference in New Issue
Block a user