mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-14 00:47:26 +00:00
Pull request for UEFI sub-system for efi-2020-07-rc2-3
This series contains bug fixes and code simplifications. Following clarification in the discussion of the EBBR specification device trees will be passed as EfiACPIReclaimMemory to UEFI applications. -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAl60T3UACgkQxIHbvCwF GsR85Q/9Eu9IFl1T8Ti83/O0M9N2xGrisvLmG2N1fIRHJgLAAHpIzijieVVba4Wo axmEO0WMwbUZsScxDPSsCdkExnbTrU8mt7aHepdSa8D+KJK9kymARxBE+bMa1mXJ 5b5fpUL/GAKKDcV5j8Yio7JpsrCagB1YtS9yURxhSBPwXKahhdIx1ajWZOZojEPe LwSupV4IlHKw85gfM/KSSKKIw8CftKSBpJynGr/H6T6z3ikH43MLvqQ+654wOx9A DPxchW2Op8SXuARXgDhpLScCxpAkZgLLTMMoD5FO8RLS/LDHp6f+/AOjXtbbmX4G RGOF3bHL2rBn8IHkE969l5gswvUtqQEF4lnG44ocjkKEw4R0+2oNCDYH7SHxUQjg pksVDJDMuBU1Fg9HtHlkm7kQ7lxC1IQV6yr/Sx2yah0TrP6+r/gPox41RpAQA6dv f9pqdzChCLReDrwQlth++dQ5yEKGZ+cxXNB0YkcUZkrNamh/4sNoccVbVCoTfoMm dx5W6KFyf89HwLr1RW5NBAR1vJrapfuam2iOdE2fxVEUScrMFmUVS0SbksthH6qf PkYD+tNdF1w2+XXMjOj05zwsLn/iF5pcUxi4S92bZfcxqoCkVP3ym71rwRyD8hSv qoRv1F22wUIvWJal6XtsAkWy/6kNP9/gpmqpAyjNEsAr3VvEEHY= =PVDs -----END PGP SIGNATURE----- Merge tag 'efi-2020-07-rc2-3' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi Pull request for UEFI sub-system for efi-2020-07-rc2-3 This series contains bug fixes and code simplifications. Following clarification in the discussion of the EBBR specification device trees will be passed as EfiACPIReclaimMemory to UEFI applications.
This commit is contained in:
commit
a5e609b982
8 changed files with 34 additions and 26 deletions
|
@ -127,13 +127,13 @@ static efi_status_t copy_fdt(void **fdtp)
|
||||||
new_fdt_addr = (uintptr_t)map_sysmem(fdt_ram_start + 0x7f00000 +
|
new_fdt_addr = (uintptr_t)map_sysmem(fdt_ram_start + 0x7f00000 +
|
||||||
fdt_size, 0);
|
fdt_size, 0);
|
||||||
ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
|
ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
|
||||||
EFI_BOOT_SERVICES_DATA, fdt_pages,
|
EFI_ACPI_RECLAIM_MEMORY, fdt_pages,
|
||||||
&new_fdt_addr);
|
&new_fdt_addr);
|
||||||
if (ret != EFI_SUCCESS) {
|
if (ret != EFI_SUCCESS) {
|
||||||
/* If we can't put it there, put it somewhere */
|
/* If we can't put it there, put it somewhere */
|
||||||
new_fdt_addr = (ulong)memalign(EFI_PAGE_SIZE, fdt_size);
|
new_fdt_addr = (ulong)memalign(EFI_PAGE_SIZE, fdt_size);
|
||||||
ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
|
ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS,
|
||||||
EFI_BOOT_SERVICES_DATA, fdt_pages,
|
EFI_ACPI_RECLAIM_MEMORY, fdt_pages,
|
||||||
&new_fdt_addr);
|
&new_fdt_addr);
|
||||||
if (ret != EFI_SUCCESS) {
|
if (ret != EFI_SUCCESS) {
|
||||||
printf("ERROR: Failed to reserve space for FDT\n");
|
printf("ERROR: Failed to reserve space for FDT\n");
|
||||||
|
|
|
@ -298,7 +298,7 @@ int do_env_print_efi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
|
|
||||||
/* -a already specified */
|
/* -a already specified */
|
||||||
if (!default_guid & guid_any)
|
if (!default_guid && guid_any)
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
|
|
||||||
argc--;
|
argc--;
|
||||||
|
|
|
@ -17,6 +17,7 @@ CFLAGS_REMOVE_helloworld.o := $(CFLAGS_NON_EFI)
|
||||||
|
|
||||||
ifneq ($(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),)
|
ifneq ($(CONFIG_CMD_BOOTEFI_HELLO_COMPILE),)
|
||||||
always += helloworld.efi
|
always += helloworld.efi
|
||||||
|
targets += helloworld.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
|
obj-$(CONFIG_CMD_BOOTEFI_HELLO) += helloworld_efi.o
|
||||||
|
|
|
@ -530,7 +530,7 @@ __maybe_unused static void *dp_fill(void *buf, struct udevice *dev)
|
||||||
#ifdef CONFIG_SANDBOX
|
#ifdef CONFIG_SANDBOX
|
||||||
case UCLASS_ROOT: {
|
case UCLASS_ROOT: {
|
||||||
/* stop traversing parents at this point: */
|
/* stop traversing parents at this point: */
|
||||||
struct efi_device_path_vendor *dp = buf;
|
struct efi_device_path_vendor *dp;
|
||||||
struct blk_desc *desc = dev_get_uclass_platdata(dev);
|
struct blk_desc *desc = dev_get_uclass_platdata(dev);
|
||||||
|
|
||||||
dp_fill(buf, dev->parent);
|
dp_fill(buf, dev->parent);
|
||||||
|
|
|
@ -13,7 +13,8 @@
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <pe.h>
|
#include <pe.h>
|
||||||
#include <sort.h>
|
#include <sort.h>
|
||||||
#include "crypto/pkcs7_parser.h"
|
#include <crypto/pkcs7_parser.h>
|
||||||
|
#include <linux/err.h>
|
||||||
|
|
||||||
const efi_guid_t efi_global_variable_guid = EFI_GLOBAL_VARIABLE_GUID;
|
const efi_guid_t efi_global_variable_guid = EFI_GLOBAL_VARIABLE_GUID;
|
||||||
const efi_guid_t efi_guid_device_path = EFI_DEVICE_PATH_PROTOCOL_GUID;
|
const efi_guid_t efi_guid_device_path = EFI_DEVICE_PATH_PROTOCOL_GUID;
|
||||||
|
@ -538,8 +539,9 @@ static bool efi_image_authenticate(void *efi, size_t efi_size)
|
||||||
}
|
}
|
||||||
msg = pkcs7_parse_message((void *)wincert + sizeof(*wincert),
|
msg = pkcs7_parse_message((void *)wincert + sizeof(*wincert),
|
||||||
wincert->dwLength - sizeof(*wincert));
|
wincert->dwLength - sizeof(*wincert));
|
||||||
if (!msg) {
|
if (IS_ERR(msg)) {
|
||||||
debug("Parsing image's signature failed\n");
|
debug("Parsing image's signature failed\n");
|
||||||
|
msg = NULL;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,18 @@ static u8 efi_vendor_keys;
|
||||||
|
|
||||||
#define READ_ONLY BIT(31)
|
#define READ_ONLY BIT(31)
|
||||||
|
|
||||||
|
static efi_status_t efi_get_variable_common(u16 *variable_name,
|
||||||
|
const efi_guid_t *vendor,
|
||||||
|
u32 *attributes,
|
||||||
|
efi_uintn_t *data_size, void *data);
|
||||||
|
|
||||||
|
static efi_status_t efi_set_variable_common(u16 *variable_name,
|
||||||
|
const efi_guid_t *vendor,
|
||||||
|
u32 attributes,
|
||||||
|
efi_uintn_t data_size,
|
||||||
|
const void *data,
|
||||||
|
bool ro_check);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mapping between EFI variables and u-boot variables:
|
* Mapping between EFI variables and u-boot variables:
|
||||||
*
|
*
|
||||||
|
@ -169,13 +181,6 @@ static const char *parse_attr(const char *str, u32 *attrp, u64 *timep)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
static efi_status_t efi_set_variable_common(u16 *variable_name,
|
|
||||||
const efi_guid_t *vendor,
|
|
||||||
u32 attributes,
|
|
||||||
efi_uintn_t data_size,
|
|
||||||
const void *data,
|
|
||||||
bool ro_check);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* efi_set_secure_state - modify secure boot state variables
|
* efi_set_secure_state - modify secure boot state variables
|
||||||
* @sec_boot: value of SecureBoot
|
* @sec_boot: value of SecureBoot
|
||||||
|
@ -300,8 +305,8 @@ static efi_status_t efi_init_secure_state(void)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
size = 0;
|
size = 0;
|
||||||
ret = EFI_CALL(efi_get_variable(L"PK", &efi_global_variable_guid,
|
ret = efi_get_variable_common(L"PK", &efi_global_variable_guid,
|
||||||
NULL, &size, NULL));
|
NULL, &size, NULL);
|
||||||
if (ret == EFI_BUFFER_TOO_SMALL) {
|
if (ret == EFI_BUFFER_TOO_SMALL) {
|
||||||
if (IS_ENABLED(CONFIG_EFI_SECURE_BOOT))
|
if (IS_ENABLED(CONFIG_EFI_SECURE_BOOT))
|
||||||
mode = EFI_MODE_USER;
|
mode = EFI_MODE_USER;
|
||||||
|
@ -519,9 +524,8 @@ static efi_status_t efi_variable_authenticate(u16 *variable,
|
||||||
var_sig = efi_variable_parse_signature(auth->auth_info.cert_data,
|
var_sig = efi_variable_parse_signature(auth->auth_info.cert_data,
|
||||||
auth->auth_info.hdr.dwLength
|
auth->auth_info.hdr.dwLength
|
||||||
- sizeof(auth->auth_info));
|
- sizeof(auth->auth_info));
|
||||||
if (IS_ERR(var_sig)) {
|
if (!var_sig) {
|
||||||
debug("Parsing variable's signature failed\n");
|
debug("Parsing variable's signature failed\n");
|
||||||
var_sig = NULL;
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,8 +591,7 @@ static efi_status_t efi_variable_authenticate(u16 *variable,
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_EFI_SECURE_BOOT */
|
#endif /* CONFIG_EFI_SECURE_BOOT */
|
||||||
|
|
||||||
static
|
static efi_status_t efi_get_variable_common(u16 *variable_name,
|
||||||
efi_status_t EFIAPI efi_get_variable_common(u16 *variable_name,
|
|
||||||
const efi_guid_t *vendor,
|
const efi_guid_t *vendor,
|
||||||
u32 *attributes,
|
u32 *attributes,
|
||||||
efi_uintn_t *data_size, void *data)
|
efi_uintn_t *data_size, void *data)
|
||||||
|
@ -893,8 +896,8 @@ static efi_status_t efi_set_variable_common(u16 *variable_name,
|
||||||
/* check if a variable exists */
|
/* check if a variable exists */
|
||||||
old_size = 0;
|
old_size = 0;
|
||||||
attr = 0;
|
attr = 0;
|
||||||
ret = EFI_CALL(efi_get_variable(variable_name, vendor, &attr,
|
ret = efi_get_variable_common(variable_name, vendor, &attr,
|
||||||
&old_size, NULL));
|
&old_size, NULL);
|
||||||
append = !!(attributes & EFI_VARIABLE_APPEND_WRITE);
|
append = !!(attributes & EFI_VARIABLE_APPEND_WRITE);
|
||||||
attributes &= ~(u32)EFI_VARIABLE_APPEND_WRITE;
|
attributes &= ~(u32)EFI_VARIABLE_APPEND_WRITE;
|
||||||
delete = !append && (!data_size || !attributes);
|
delete = !append && (!data_size || !attributes);
|
||||||
|
@ -981,11 +984,11 @@ static efi_status_t efi_set_variable_common(u16 *variable_name,
|
||||||
if (append) {
|
if (append) {
|
||||||
old_data = malloc(old_size);
|
old_data = malloc(old_size);
|
||||||
if (!old_data) {
|
if (!old_data) {
|
||||||
return EFI_OUT_OF_RESOURCES;
|
ret = EFI_OUT_OF_RESOURCES;
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
ret = EFI_CALL(efi_get_variable(variable_name, vendor,
|
ret = efi_get_variable_common(variable_name, vendor,
|
||||||
&attr, &old_size, old_data));
|
&attr, &old_size, old_data);
|
||||||
if (ret != EFI_SUCCESS)
|
if (ret != EFI_SUCCESS)
|
||||||
goto err;
|
goto err;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -176,9 +176,9 @@ static int execute(void)
|
||||||
/* Check memory reservation for the device tree */
|
/* Check memory reservation for the device tree */
|
||||||
if (fdt_addr &&
|
if (fdt_addr &&
|
||||||
find_in_memory_map(map_size, memory_map, desc_size, fdt_addr,
|
find_in_memory_map(map_size, memory_map, desc_size, fdt_addr,
|
||||||
EFI_BOOT_SERVICES_DATA) != EFI_ST_SUCCESS) {
|
EFI_ACPI_RECLAIM_MEMORY) != EFI_ST_SUCCESS) {
|
||||||
efi_st_error
|
efi_st_error
|
||||||
("Device tree not marked as boot services data\n");
|
("Device tree not marked as ACPI reclaim memory\n");
|
||||||
return EFI_ST_FAILURE;
|
return EFI_ST_FAILURE;
|
||||||
}
|
}
|
||||||
return EFI_ST_SUCCESS;
|
return EFI_ST_SUCCESS;
|
||||||
|
|
|
@ -418,6 +418,8 @@ $(obj)/efi_reloc.o: $(srctree)/arch/$(ARCH)/lib/$(EFI_RELOC:.o=.c) $(recordmcoun
|
||||||
$(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o
|
$(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o
|
||||||
$(call cmd,efi_ld)
|
$(call cmd,efi_ld)
|
||||||
|
|
||||||
|
targets += $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o
|
||||||
|
|
||||||
# ACPI
|
# ACPI
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue