summaryrefslogtreecommitdiff
path: root/lib/efi_loader/efi_bootmgr.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/efi_loader/efi_bootmgr.c')
-rw-r--r--lib/efi_loader/efi_bootmgr.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
index 8c04ecbdc83..52bea4d5411 100644
--- a/lib/efi_loader/efi_bootmgr.c
+++ b/lib/efi_loader/efi_bootmgr.c
@@ -46,16 +46,12 @@ static efi_status_t try_load_entry(u16 n, efi_handle_t *handle,
void **load_options)
{
struct efi_load_option lo;
- u16 varname[] = u"Boot0000";
- u16 hexmap[] = u"0123456789ABCDEF";
+ u16 varname[9];
void *load_option;
efi_uintn_t size;
efi_status_t ret;
- varname[4] = hexmap[(n & 0xf000) >> 12];
- varname[5] = hexmap[(n & 0x0f00) >> 8];
- varname[6] = hexmap[(n & 0x00f0) >> 4];
- varname[7] = hexmap[(n & 0x000f) >> 0];
+ efi_create_indexed_name(varname, sizeof(varname), "Boot", n);
load_option = efi_get_var(varname, &efi_global_variable_guid, &size);
if (!load_option)
@@ -70,8 +66,8 @@ static efi_status_t try_load_entry(u16 n, efi_handle_t *handle,
if (lo.attributes & LOAD_OPTION_ACTIVE) {
u32 attributes;
- log_debug("%s: trying to load \"%ls\" from %pD\n",
- __func__, lo.label, lo.file_path);
+ log_debug("trying to load \"%ls\" from %pD\n", lo.label,
+ lo.file_path);
ret = EFI_CALL(efi_load_image(true, efi_root, lo.file_path,
NULL, 0, handle));
@@ -187,8 +183,7 @@ efi_status_t efi_bootmgr_load(efi_handle_t *handle, void **load_options)
num = size / sizeof(uint16_t);
for (i = 0; i < num; i++) {
- log_debug("%s trying to load Boot%04X\n", __func__,
- bootorder[i]);
+ log_debug("trying to load Boot%04X\n", bootorder[i]);
ret = try_load_entry(bootorder[i], handle, load_options);
if (ret == EFI_SUCCESS)
break;