1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Menu-driven UEFI Variable maintenance
5 * Copyright (c) 2022 Masahisa Kojima, Linaro Limited
11 #include <efi_loader.h>
13 #define EFICONFIG_ENTRY_NUM_MAX 99
14 #define EFICONFIG_VOLUME_PATH_MAX 512
15 #define EFICONFIG_FILE_PATH_MAX 512
16 #define EFICONFIG_FILE_PATH_BUF_SIZE (EFICONFIG_FILE_PATH_MAX * sizeof(u16))
18 typedef efi_status_t (*eficonfig_entry_func)(void *data);
21 * struct eficonfig_entry - menu entry structure
23 * @num: menu entry index
24 * @title: title of entry
26 * @efi_menu: pointer to the menu structure
27 * @func: callback function to be called when this entry is selected
28 * @data: data to be passed to the callback function, caller must free() this pointer
29 * @list: list structure
31 struct eficonfig_entry {
35 struct efimenu *efi_menu;
36 eficonfig_entry_func func;
38 struct list_head list;
42 * struct efimenu - efi menu structure
44 * @delay: delay for autoboot
45 * @active: active menu entry index
46 * @count: total count of menu entry
47 * @menu_header: menu header string
48 * @list: menu entry list structure
55 struct list_head list;
59 * struct eficonfig_item - structure to construct eficonfig_entry
61 * @title: title of entry
62 * @func: callback function to be called when this entry is selected
63 * @data: data to be passed to the callback function
65 struct eficonfig_item {
67 eficonfig_entry_func func;
72 * struct eficonfig_select_file_info - structure to be used for file selection
74 * @current_volume: pointer to the efi_simple_file_system_protocol
75 * @dp_volume: pointer to device path of the selected device
76 * @current_path: pointer to the selected file path string
77 * @filepath_list: list_head structure for file path list
78 * @file_selectred: flag indicates file selecting status
80 struct eficonfig_select_file_info {
81 struct efi_simple_file_system_protocol *current_volume;
82 struct efi_device_path *dp_volume;
84 struct list_head filepath_list;
88 void eficonfig_print_msg(char *msg);
89 void eficonfig_destroy(struct efimenu *efi_menu);
90 efi_status_t eficonfig_process_quit(void *data);
91 efi_status_t eficonfig_process_common(struct efimenu *efi_menu, char *menu_header);
92 efi_status_t eficonfig_process_select_file(void *data);
93 efi_status_t eficonfig_get_unused_bootoption(u16 *buf,
94 efi_uintn_t buf_size, u32 *index);
95 efi_status_t eficonfig_append_bootorder(u16 index);
96 efi_status_t eficonfig_generate_media_device_boot_option(void);
98 efi_status_t eficonfig_append_menu_entry(struct efimenu *efi_menu,
99 char *title, eficonfig_entry_func func,
101 efi_status_t eficonfig_append_quit_entry(struct efimenu *efi_menu);