summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2020-08-07 17:47:13 +0200
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2020-08-08 19:03:24 +0200
commit1064d04920beba5564c84fde1993dd39c809ed49 (patch)
treeff82f9fd5ef885e6f2f9d567cacf882c8706ca44 /lib
parentdd92aad81c8e3f3adaeaf0ca793fbfa06edec712 (diff)
downloadu-boot-1064d04920beba5564c84fde1993dd39c809ed49.tar.gz
u-boot-1064d04920beba5564c84fde1993dd39c809ed49.tar.bz2
u-boot-1064d04920beba5564c84fde1993dd39c809ed49.zip
efi_loader: factor out efi_set_load_options()
The bootefi bootmgr command has to set the load options for a loaded image from the value of BootXXXX variable. If the boot manager is not used, the value is set from the environment variable bootargs (or efi_selftest). Factor out a common function efi_set_load_options(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_bootmgr.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
index e03198b57a..a4bc272c34 100644
--- a/lib/efi_loader/efi_bootmgr.c
+++ b/lib/efi_loader/efi_bootmgr.c
@@ -30,6 +30,38 @@ static const struct efi_runtime_services *rs;
* should do normal or recovery boot.
*/
+/**
+ * efi_set_load_options() - set the load options of a loaded image
+ *
+ * @handle: the image handle
+ * @load_options_size: size of load options
+ * @load_options: pointer to load options
+ * Return: status code
+ */
+efi_status_t efi_set_load_options(efi_handle_t handle,
+ efi_uintn_t load_options_size,
+ void *load_options)
+{
+ struct efi_loaded_image *loaded_image_info;
+ efi_status_t ret;
+
+ ret = EFI_CALL(systab.boottime->open_protocol(
+ handle,
+ &efi_guid_loaded_image,
+ (void **)&loaded_image_info,
+ efi_root, NULL,
+ EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL));
+ if (ret != EFI_SUCCESS)
+ return EFI_INVALID_PARAMETER;
+
+ loaded_image_info->load_options = load_options;
+ loaded_image_info->load_options_size = load_options_size;
+
+ return EFI_CALL(systab.boottime->close_protocol(handle,
+ &efi_guid_loaded_image,
+ efi_root, NULL));
+}
+
/**
* efi_deserialize_load_option() - parse serialized data