summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_bootmgr.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-04-10 16:56:59 -0400
committerTom Rini <trini@konsulko.com>2021-04-10 16:56:59 -0400
commit59e84da0b88e4465f15d196bba59f22c906fa50d (patch)
treeba62f7bab206bd44dfd516c5689b7d87ab2b064f /lib/efi_loader/efi_bootmgr.c
parent3f2e3c7845df11ca8359a6cc804bfd6eb5ce215b (diff)
parentf8cd72d1ac6aac8cfa48777b5c0681ee2f9e3671 (diff)
Merge tag 'efi-2021-07-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi
Pull request for efi-2021-07-rc1 Bug fixes: * support EFI, HOST, VIRTIO in fsinfo command * simplify efi_get_device_path_text() * add missing EFI_UNACCEPTED_MEMORY_TYPE * mkeficapsule: improve online help * avoid several build warnings Documentation: * UEFI documentation for initrd loading options * describe building OP-TEE with for UEFI variables * mmc man-page
Diffstat (limited to 'lib/efi_loader/efi_bootmgr.c')
-rw-r--r--lib/efi_loader/efi_bootmgr.c36
1 files changed, 2 insertions, 34 deletions
diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
index 46c8011344b..1fe19237f9a 100644
--- a/lib/efi_loader/efi_bootmgr.c
+++ b/lib/efi_loader/efi_bootmgr.c
@@ -31,38 +31,6 @@ static const struct efi_runtime_services *rs;
*/
/**
- * get_var() - get UEFI variable
- *
- * It is the caller's duty to free the returned buffer.
- *
- * @name: name of variable
- * @vendor: vendor GUID of variable
- * @size: size of allocated buffer
- * Return: buffer with variable data or NULL
- */
-static void *get_var(u16 *name, const efi_guid_t *vendor,
- efi_uintn_t *size)
-{
- efi_status_t ret;
- void *buf = NULL;
-
- *size = 0;
- ret = efi_get_variable_int(name, vendor, NULL, size, buf, NULL);
- if (ret == EFI_BUFFER_TOO_SMALL) {
- buf = malloc(*size);
- ret = efi_get_variable_int(name, vendor, NULL, size, buf, NULL);
- }
-
- if (ret != EFI_SUCCESS) {
- free(buf);
- *size = 0;
- return NULL;
- }
-
- return buf;
-}
-
-/**
* try_load_entry() - try to load image for boot option
*
* Attempt to load load-option number 'n', returning device_path and file_path
@@ -89,7 +57,7 @@ static efi_status_t try_load_entry(u16 n, efi_handle_t *handle,
varname[6] = hexmap[(n & 0x00f0) >> 4];
varname[7] = hexmap[(n & 0x000f) >> 0];
- load_option = get_var(varname, &efi_global_variable_guid, &size);
+ load_option = efi_get_var(varname, &efi_global_variable_guid, &size);
if (!load_option)
return EFI_LOAD_ERROR;
@@ -210,7 +178,7 @@ efi_status_t efi_bootmgr_load(efi_handle_t *handle, void **load_options)
}
/* BootOrder */
- bootorder = get_var(L"BootOrder", &efi_global_variable_guid, &size);
+ bootorder = efi_get_var(L"BootOrder", &efi_global_variable_guid, &size);
if (!bootorder) {
log_info("BootOrder not defined\n");
ret = EFI_NOT_FOUND;