Pull request efi-2024-04-rc1-4

Documentation:
 
 * uefi: remove ".py" suffix for pytest.py command
 * correct date in migration plan for CONFIG_DM
 
 UEFI:
 
 * fix conflicting SPDX license in RISC-V EFI linker scripts
 * page align EFI binary section in RISC-V EFI binaries
 * separate .data and .text sections of RISC-V EFI binaries
 * use common function to get EFI configuration table
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEK7wKXt3/btL6/yA+hO4vgnE3U0sFAmW4FP0ACgkQhO4vgnE3
 U0ubIQ//b8nZf1lBTesAWjeLeiTrnRkr/yfSlikppDQBaq4kogcU8j5OM4xetVMa
 qtmTZLLVRbJuTVAZSWYm8oPN4+EfSRYzdcQuFTIHS9ZHeVovJ0zwtEp6TG0csPcF
 p1KgWFZuACM4OhYjQvNqUms9oCQbRGsn/GJd1pLacy4oX9cKojM8n9SBJc4x5FSH
 LiN8Fu/Jw10yGwyEL6lkuQUCHysItFRkcc5wVrcQm8oOt+RoT41SgmYmzWZJEoaP
 zGYErYGKNVXmFPFEn3gSzoSisPhuPLf/oYU03kYYmzlhnzUVeHf/V7XC034CCNoI
 V3YB9uHihgGzju9JfLsC5qdZ7QvtE+Pz6/OgJnY4DZMvGZHiziDJZucf/gb8Ms5o
 YXE4oKvEx68qO5rVc4aMtOdeaC4vV9D+ngt6zO70tXnXj108gQ7t74ln9NSwEOpM
 v3M4p9Q4j+md/uRarYjCnF9nXqtlL6G63E1lnIRLnqM8GEVS38RYvfB72hyrr+bb
 fnPGK85ga/z64EET8E2SdwrRkq/M8dr2jqsdUhCWzPBscEaR/8xipvelNpPzHwaC
 M7M8wZIA195FqEpxEXlvmWD2yjav3xIXfUfhttwwe+s/abNzkfi5bOvY67ZbhqE4
 ckRccC44Idh2HdCd+gXr/wFVqqU8wtlf0YpokwgoZHzgauJF7P8=
 =ZGn5
 -----END PGP SIGNATURE-----

Merge tag 'efi-2024-04-rc1-4' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request efi-2024-04-rc1-4

Documentation:

* uefi: remove ".py" suffix for pytest.py command
* correct date in migration plan for CONFIG_DM

UEFI:

* fix conflicting SPDX license in RISC-V EFI linker scripts
* page align EFI binary section in RISC-V EFI binaries
* separate .data and .text sections of RISC-V EFI binaries
* use common function to get EFI configuration table
This commit is contained in:
Tom Rini 2024-01-29 16:19:10 -05:00
commit d5c0c990c3
11 changed files with 76 additions and 63 deletions

View File

@ -53,7 +53,7 @@ pe_header:
.long IMAGE_NT_SIGNATURE /* 'PE' */
coff_header:
.short PE_MACHINE /* RISC-V 64/32-bit */
.short 2 /* nr_sections */
.short 3 /* nr_sections */
.long 0 /* TimeDateStamp */
.long 0 /* PointerToSymbolTable */
.long 0 /* NumberOfSymbols */
@ -144,18 +144,37 @@ section_table:
.byte 0
.byte 0
.byte 0 /* end of 0 padding of section name */
.long _edata - _start /* VirtualSize */
.long _etext - _start /* VirtualSize */
.long _start - ImageBase /* VirtualAddress */
.long _edata - _start /* SizeOfRawData */
.long _etext - _start /* SizeOfRawData */
.long _start - ImageBase /* PointerToRawData */
.long 0 /* PointerToRelocations (0 for executables) */
.long 0 /* PointerToLineNumbers (0 for executables) */
.short 0 /* NumberOfRelocations (0 for executables) */
.short 0 /* NumberOfLineNumbers (0 for executables) */
/* Characteristics (section flags) */
.long (IMAGE_SCN_MEM_READ | \
IMAGE_SCN_MEM_EXECUTE | \
IMAGE_SCN_CNT_CODE)
.long 0 /* PointerToRelocations (0 for executables) */
.long 0 /* PointerToLineNumbers (0 for executables) */
.short 0 /* NumberOfRelocations (0 for executables) */
.short 0 /* NumberOfLineNumbers (0 for executables) */
.long 0xe0500020 /* Characteristics (section flags) */
.ascii ".data"
.byte 0
.byte 0
.byte 0 /* end of 0 padding of section name */
.long _edata - _data /* VirtualSize */
.long _data - ImageBase /* VirtualAddress */
.long _edata - _data /* SizeOfRawData */
.long _data - ImageBase /* PointerToRawData */
.long 0 /* PointerToRelocations */
.long 0 /* PointerToLineNumbers */
.short 0 /* NumberOfRelocations */
.short 0 /* NumberOfLineNumbers */
/* Characteristics (section flags) */
.long (IMAGE_SCN_MEM_WRITE | \
IMAGE_SCN_MEM_READ | \
IMAGE_SCN_CNT_INITIALIZED_DATA)
.align 9
.align 12
_start:
addi sp, sp, -(SIZE_LONG * 3)
SAVE_LONG(a0, 0)

View File

@ -1,14 +1,18 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/* SPDX-License-Identifier: BSD-2-Clause */
/*
* U-Boot riscv32 EFI linker script
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Modified from arch/arm/lib/elf_aarch64_efi.lds
*/
OUTPUT_FORMAT("elf32-littleriscv", "elf32-littleriscv", "elf32-littleriscv")
OUTPUT_ARCH(riscv)
PHDRS
{
data PT_LOAD FLAGS(3); /* SHF_WRITE | SHF_ALLOC */
}
ENTRY(_start)
SECTIONS
{
@ -20,11 +24,17 @@ SECTIONS
*(.gnu.linkonce.t.*)
*(.srodata)
*(.rodata*)
. = ALIGN(16);
*(.dynamic);
. = ALIGN(512);
}
.rela.dyn : { *(.rela.dyn) }
.rela.plt : { *(.rela.plt) }
.rela.got : { *(.rela.got) }
.rela.data : { *(.rela.data) *(.rela.data*) }
_etext = .;
_text_size = . - _text;
.dynamic : { *(.dynamic) }
. = ALIGN(4096);
.data : {
_data = .;
*(.sdata)
@ -49,12 +59,8 @@ SECTIONS
. = ALIGN(512);
_bss_end = .;
_edata = .;
}
.rela.dyn : { *(.rela.dyn) }
.rela.plt : { *(.rela.plt) }
.rela.got : { *(.rela.got) }
.rela.data : { *(.rela.data) *(.rela.data*) }
_data_size = . - _etext;
} :data
_data_size = _edata - _data;
. = ALIGN(4096);
.dynsym : { *(.dynsym) }

View File

@ -1,14 +1,18 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/* SPDX-License-Identifier: BSD-2-Clause */
/*
* U-Boot riscv64 EFI linker script
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Modified from arch/arm/lib/elf_aarch64_efi.lds
*/
OUTPUT_FORMAT("elf64-littleriscv", "elf64-littleriscv", "elf64-littleriscv")
OUTPUT_ARCH(riscv)
PHDRS
{
data PT_LOAD FLAGS(3); /* SHF_WRITE | SHF_ALLOC */
}
ENTRY(_start)
SECTIONS
{
@ -20,11 +24,17 @@ SECTIONS
*(.gnu.linkonce.t.*)
*(.srodata)
*(.rodata*)
. = ALIGN(16);
*(.dynamic);
. = ALIGN(512);
}
.rela.dyn : { *(.rela.dyn) }
.rela.plt : { *(.rela.plt) }
.rela.got : { *(.rela.got) }
.rela.data : { *(.rela.data) *(.rela.data*) }
_etext = .;
_text_size = . - _text;
.dynamic : { *(.dynamic) }
. = ALIGN(4096);
.data : {
_data = .;
*(.sdata)
@ -49,12 +59,8 @@ SECTIONS
. = ALIGN(512);
_bss_end = .;
_edata = .;
}
.rela.dyn : { *(.rela.dyn) }
.rela.plt : { *(.rela.plt) }
.rela.got : { *(.rela.got) }
.rela.data : { *(.rela.data) *(.rela.data*) }
_data_size = . - _etext;
} :data
_data_size = _edata - _data;
. = ALIGN(4096);
.dynsym : { *(.dynsym) }

View File

@ -173,15 +173,12 @@ EFI_ESRT_UPDATE_STATUS_NUM > (idx) ? efi_update_status_str[(idx)] : "error"\
static int do_efi_capsule_esrt(struct cmd_tbl *cmdtp, int flag,
int argc, char * const argv[])
{
struct efi_system_resource_table *esrt = NULL;
struct efi_system_resource_table *esrt;
if (argc != 1)
return CMD_RET_USAGE;
for (int idx = 0; idx < systab.nr_tables; idx++)
if (!guidcmp(&efi_esrt_guid, &systab.tables[idx].guid))
esrt = (struct efi_system_resource_table *)systab.tables[idx].table;
esrt = efi_get_configuration_table(&efi_esrt_guid);
if (!esrt) {
log_info("ESRT: table not present\n");
return CMD_RET_SUCCESS;

View File

@ -13,7 +13,7 @@ CONFIG_DM
* Status: In progress
* Deadline: 2020.01
Starting with the 2010.01 release CONFIG_DM will be enabled for all boards.
Starting with the 2020.01 release CONFIG_DM will be enabled for all boards.
This does not concern CONFIG_DM_SPL and CONFIG_DM_TPL. The conversion date for
these configuration items still needs to be defined.

View File

@ -193,7 +193,7 @@ on the sandbox
.. code-block:: bash
cd <U-Boot source directory>
pytest.py test/py/tests/test_efi_secboot/test_signed.py --bd sandbox
pytest test/py/tests/test_efi_secboot/test_signed.py --bd sandbox
UEFI binaries may be signed by Microsoft using the following certificates:

View File

@ -546,6 +546,8 @@ void efi_setup_console_size(void);
/* Set up load options from environment variable */
efi_status_t efi_env_set_load_options(efi_handle_t handle, const char *env_var,
u16 **load_options);
/* Get EFI configuration table */
void *efi_get_configuration_table(const efi_guid_t *guid);
/* Install device tree */
efi_status_t efi_install_fdt(void *fdt);
/* Execute loaded UEFI image */

View File

@ -400,18 +400,18 @@ efi_status_t efi_firmware_set_fmp_state_var(struct fmp_state *state, u8 image_in
}
size = num_banks * sizeof(*var_state);
var_state = calloc(1, size);
var_state = malloc(size);
if (!var_state)
return EFI_OUT_OF_RESOURCES;
/*
* GetVariable may fail, EFI_NOT_FOUND is returned if FmpState
* variable has not been set yet.
* Ignore the error here since the correct FmpState variable
* is set later.
*/
efi_get_variable_int(varname, image_type_id, NULL, &size, var_state,
NULL);
ret = efi_get_variable_int(varname, image_type_id, NULL, &size,
var_state, NULL);
if (ret != EFI_SUCCESS)
memset(var_state, 0, num_banks * sizeof(*var_state));
/*
* Only the fw_version is set here.

View File

@ -380,12 +380,12 @@ done:
}
/**
* get_config_table() - get configuration table
* efi_get_configuration_table() - get configuration table
*
* @guid: GUID of the configuration table
* Return: pointer to configuration table or NULL
*/
static void *get_config_table(const efi_guid_t *guid)
void *efi_get_configuration_table(const efi_guid_t *guid)
{
size_t i;
@ -430,7 +430,7 @@ efi_status_t efi_install_fdt(void *fdt)
uintptr_t fdt_addr;
/* Look for device tree that is already installed */
if (get_config_table(&efi_guid_fdt))
if (efi_get_configuration_table(&efi_guid_fdt))
return EFI_SUCCESS;
/* Check if there is a hardware device tree */
fdt_opt = env_get("fdt_addr");

View File

@ -1128,23 +1128,6 @@ out:
return ret;
}
/**
* find_smbios_table() - find smbios table
*
* Return: pointer to the smbios table
*/
static void *find_smbios_table(void)
{
u32 i;
for (i = 0; i < systab.nr_tables; i++) {
if (!guidcmp(&smbios3_guid, &systab.tables[i].guid))
return systab.tables[i].table;
}
return NULL;
}
/**
* tcg2_measure_gpt_table() - measure gpt table
*
@ -1387,7 +1370,7 @@ efi_status_t efi_tcg2_measure_efi_app_invocation(struct efi_loaded_image_obj *ha
if (ret != EFI_SUCCESS)
goto out;
entry = (struct smbios3_entry *)find_smbios_table();
entry = efi_get_configuration_table(&smbios3_guid);
if (entry) {
ret = tcg2_measure_smbios(dev, entry);
if (ret != EFI_SUCCESS)

View File

@ -39,7 +39,7 @@ static efi_status_t EFIAPI check_loaded_image_protocol
NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (ret != EFI_SUCCESS) {
cout->output_string(cout,
u"Could not open loaded image protocol");
u"Could not open loaded image protocol\n");
return ret;
}
if ((void *)check_loaded_image_protocol <