* should do normal or recovery boot.
*/
-/**
- * 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
*
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;
}
/* 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;