From 1a82b3413cb577cd52cf8a1dc22dd306e4ce0772 Mon Sep 17 00:00:00 2001 From: AKASHI Takahiro Date: Mon, 5 Nov 2018 18:06:41 +0900 Subject: efi_loader: bootmgr: add load option helper functions In this patch, helper functions for an load option variable (BootXXXX) are added: * efi_deserialize_load_option(): parse a string into load_option data (renamed from parse_load_option and exported) * efi_serialize_load_option(): convert load_option data into a string Those functions will be used to implement efishell command. Signed-off-by: AKASHI Takahiro Signed-off-by: Alexander Graf --- include/efi_loader.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'include/efi_loader.h') diff --git a/include/efi_loader.h b/include/efi_loader.h index 3c90515fef..53f08161ab 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -518,6 +518,29 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name, efi_guid_t *vendor, u32 attributes, efi_uintn_t data_size, void *data); +/* + * See section 3.1.3 in the v2.7 UEFI spec for more details on + * the layout of EFI_LOAD_OPTION. In short it is: + * + * typedef struct _EFI_LOAD_OPTION { + * UINT32 Attributes; + * UINT16 FilePathListLength; + * // CHAR16 Description[]; <-- variable length, NULL terminated + * // EFI_DEVICE_PATH_PROTOCOL FilePathList[]; + * <-- FilePathListLength bytes + * // UINT8 OptionalData[]; + * } EFI_LOAD_OPTION; + */ +struct efi_load_option { + u32 attributes; + u16 file_path_length; + u16 *label; + struct efi_device_path *file_path; + u8 *optional_data; +}; + +void efi_deserialize_load_option(struct efi_load_option *lo, u8 *data); +unsigned long efi_serialize_load_option(struct efi_load_option *lo, u8 **data); void *efi_bootmgr_load(struct efi_device_path **device_path, struct efi_device_path **file_path); -- cgit