diff options
-rw-r--r-- | cmd/Kconfig | 2 | ||||
-rw-r--r-- | cmd/bootmenu.c | 2 | ||||
-rw-r--r-- | cmd/console.c | 14 | ||||
-rw-r--r-- | cmd/eficonfig.c | 10 | ||||
-rw-r--r-- | common/menu.c | 3 | ||||
-rw-r--r-- | doc/index.rst | 1 | ||||
-rw-r--r-- | doc/learn/index.rst | 9 | ||||
-rw-r--r-- | doc/learn/talks.rst | 11 | ||||
-rw-r--r-- | doc/usage/cmd/bootmenu.rst | 2 | ||||
-rw-r--r-- | doc/usage/cmd/setexpr.rst | 5 | ||||
-rw-r--r-- | include/efi.h | 11 | ||||
-rw-r--r-- | include/efi_api.h | 12 | ||||
-rw-r--r-- | include/efi_config.h | 2 | ||||
-rw-r--r-- | include/efi_loader.h | 7 | ||||
-rw-r--r-- | include/menu.h | 1 | ||||
-rw-r--r-- | lib/efi_loader/efi_boottime.c | 6 | ||||
-rw-r--r-- | lib/efi_loader/efi_conformance.c | 2 | ||||
-rw-r--r-- | lib/efi_loader/efi_console.c | 2 | ||||
-rw-r--r-- | lib/efi_loader/efi_gop.c | 11 | ||||
-rw-r--r-- | lib/efi_loader/efi_runtime.c | 4 | ||||
-rw-r--r-- | lib/efi_loader/efi_setup.c | 1 | ||||
-rw-r--r-- | lib/efi_loader/efi_var_common.c | 10 | ||||
-rw-r--r-- | lib/efi_loader/efi_variable.c | 25 | ||||
-rw-r--r-- | lib/efi_loader/helloworld.c | 3 | ||||
-rw-r--r-- | lib/efi_loader/initrddump.c | 2 | ||||
-rw-r--r-- | tools/buildman/toolchain.py | 2 |
26 files changed, 119 insertions, 41 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig index c7344ee1f66..2caa4af71cb 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -2000,7 +2000,9 @@ config CMD_EFIDEBUG config CMD_EFICONFIG bool "eficonfig - provide menu-driven uefi variables maintenance interface" + default y if !HAS_BOARD_SIZE_LIMIT depends on CMD_BOOTEFI_BOOTMGR + select MENU help Enable the 'eficonfig' command which provides the menu-driven UEFI variable maintenance interface. diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c index ef196bd504f..6baeedc69f9 100644 --- a/cmd/bootmenu.c +++ b/cmd/bootmenu.c @@ -437,7 +437,7 @@ static void menu_display_statusline(struct menu *m) printf(ANSI_CURSOR_POSITION, menu->count + 5, 1); puts(ANSI_CLEAR_LINE); printf(ANSI_CURSOR_POSITION, menu->count + 6, 3); - puts("Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit"); + puts("Press UP/DOWN to move, ENTER to select, ESC to quit"); puts(ANSI_CLEAR_LINE_TO_END); printf(ANSI_CURSOR_POSITION, menu->count + 7, 1); puts(ANSI_CLEAR_LINE); diff --git a/cmd/console.c b/cmd/console.c index 9a1db83c7c3..620a961cdef 100644 --- a/cmd/console.c +++ b/cmd/console.c @@ -22,23 +22,21 @@ static int do_coninfo(struct cmd_tbl *cmd, int flag, int argc, /* Scan for valid output and input devices */ - puts ("List of available devices:\n"); + puts("List of available devices\n"); list_for_each(pos, list) { dev = list_entry(pos, struct stdio_dev, list); - printf ("%-8s %08x %c%c ", - dev->name, - dev->flags, - (dev->flags & DEV_FLAGS_INPUT) ? 'I' : '.', - (dev->flags & DEV_FLAGS_OUTPUT) ? 'O' : '.'); + printf("|-- %s (%s%s)\n", + dev->name, + (dev->flags & DEV_FLAGS_INPUT) ? "I" : "", + (dev->flags & DEV_FLAGS_OUTPUT) ? "O" : ""); for (l = 0; l < MAX_FILES; l++) { if (stdio_devices[l] == dev) { - printf ("%s ", stdio_names[l]); + printf("| |-- %s\n", stdio_names[l]); } } - putc ('\n'); } return 0; } diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index 5b1f2a7731a..720f52b48b8 100644 --- a/cmd/eficonfig.c +++ b/cmd/eficonfig.c @@ -23,12 +23,12 @@ static struct efi_simple_text_input_protocol *cin; const char *eficonfig_menu_desc = - " Press UP/DOWN to move, ENTER to select, ESC/CTRL+C to quit"; + " Press UP/DOWN to move, ENTER to select, ESC to quit"; static const char *eficonfig_change_boot_order_desc = " Press UP/DOWN to move, +/- to change orde\n" " Press SPACE to activate or deactivate the entry\n" - " Select [Save] to complete, ESC/CTRL+C to quit"; + " CTRL+S to save, ESC to quit"; static struct efi_simple_text_output_protocol *cout; static int avail_row; @@ -927,7 +927,7 @@ static efi_status_t handle_user_input(u16 *buf, int buf_size, ANSI_CURSOR_POSITION "%s" ANSI_CURSOR_POSITION - " Press ENTER to complete, ESC/CTRL+C to quit", + " Press ENTER to complete, ESC to quit", 0, 1, msg, 8, 1); /* tmp is used to accept user cancel */ @@ -1983,6 +1983,10 @@ char *eficonfig_choice_change_boot_order(void *data) eficonfig_menu_down(efi_menu); return NULL; + case BKEY_SAVE: + /* force to select "Save" entry */ + efi_menu->active = efi_menu->count - 2; + fallthrough; case BKEY_SELECT: /* "Save" */ if (efi_menu->active == efi_menu->count - 2) { diff --git a/common/menu.c b/common/menu.c index cdcdbb2a185..94514177e4e 100644 --- a/common/menu.c +++ b/common/menu.c @@ -503,6 +503,9 @@ enum bootmenu_key bootmenu_conv_key(int ichar) case CTL_CH('n'): key = BKEY_DOWN; break; + case CTL_CH('s'): + key = BKEY_SAVE; + break; case '+': key = BKEY_PLUS; break; diff --git a/doc/index.rst b/doc/index.rst index 02de1d46842..57b42c68e44 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -25,6 +25,7 @@ trying to get it to work optimally on a given system. :maxdepth: 2 build/index + learn/index usage/index Developer-oriented documentation diff --git a/doc/learn/index.rst b/doc/learn/index.rst new file mode 100644 index 00000000000..8075c01d1df --- /dev/null +++ b/doc/learn/index.rst @@ -0,0 +1,9 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Learn about U-Boot +================== + +.. toctree:: + :maxdepth: 1 + + talks diff --git a/doc/learn/talks.rst b/doc/learn/talks.rst new file mode 100644 index 00000000000..33bac483e17 --- /dev/null +++ b/doc/learn/talks.rst @@ -0,0 +1,11 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +U-Boot Talks +============ + +U-Boot is a topic at various conferences each year. These talkes might help you +learn a bit about U-Boot. + +See elinux_talks_ for a list. + +.. _elinux_talks: https://elinux.org/Boot_Loaders#U-Boot diff --git a/doc/usage/cmd/bootmenu.rst b/doc/usage/cmd/bootmenu.rst index cb3c8d2f93c..684a18d8e14 100644 --- a/doc/usage/cmd/bootmenu.rst +++ b/doc/usage/cmd/bootmenu.rst @@ -122,7 +122,7 @@ Example bootmenu is as below:: Default behavior when user exits from the bootmenu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ User can exit from bootmenu by selecting the last entry -"U-Boot console"/"Quit" or ESC/CTRL+C key. +"U-Boot console"/"Quit" or ESC key. When the CONFIG_BOOTMENU_DISABLE_UBOOT_CONSOLE is disabled, user exits from the bootmenu and returns to the U-Boot console. diff --git a/doc/usage/cmd/setexpr.rst b/doc/usage/cmd/setexpr.rst index 2e511b12905..4d19fa340d1 100644 --- a/doc/usage/cmd/setexpr.rst +++ b/doc/usage/cmd/setexpr.rst @@ -138,7 +138,10 @@ Example Configuration ------------- -The setexpr gsub and sub operations are only available if CONFIG_REGEX=y. +* The *setexpr* command is only available if CMD_SETEXPR=y. +* The *setexpr fmt* sub-command is only available if CMD_SETEXPR_FMT=y. +* The *setexpr gsub* and *setexpr sub* sub-commands are only available if + CONFIG_REGEX=y. Return value ------------ diff --git a/include/efi.h b/include/efi.h index 42f4e58a917..c3087d3da28 100644 --- a/include/efi.h +++ b/include/efi.h @@ -54,9 +54,18 @@ struct efi_device_path; +/* + * The EFI spec defines the EFI_GUID as + * "128-bit buffer containing a unique identifier value. Unless otherwise specified, + * aligned on a 64-bit boundary". + * Page 163 of the UEFI specification v2.10 and + * EDK2 reference implementation both define EFI_GUID as + * struct { u32 a; u16; b; u16 c; u8 d[8]; }; which is 4-byte + * aligned. + */ typedef struct { u8 b[16]; -} efi_guid_t __attribute__((aligned(8))); +} efi_guid_t __attribute__((aligned(4))); #define EFI_BITS_PER_LONG (sizeof(long) * 8) diff --git a/include/efi_api.h b/include/efi_api.h index 9bd70b0f18c..2d18d25a713 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -513,6 +513,16 @@ struct efi_system_table { struct efi_configuration_table *tables; }; +/** + * efi_main() - entry point of EFI applications + * + * @image_handle: handle with the Loaded Image Protocol + * @systab: pointer to the system table + * Return: status code + */ +efi_status_t EFIAPI efi_main(efi_handle_t image_handle, + struct efi_system_table *systab); + #define EFI_LOADED_IMAGE_PROTOCOL_GUID \ EFI_GUID(0x5b1b31a1, 0x9562, 0x11d2, \ 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b) @@ -817,7 +827,7 @@ struct efi_simple_text_output_protocol { struct efi_input_key { u16 scan_code; - s16 unicode_char; + u16 unicode_char; }; #define EFI_SHIFT_STATE_INVALID 0x00000000 diff --git a/include/efi_config.h b/include/efi_config.h index e5edbb5e090..01ce9b2b06d 100644 --- a/include/efi_config.h +++ b/include/efi_config.h @@ -11,7 +11,7 @@ #include <efi_loader.h> #include <menu.h> -#define EFICONFIG_ENTRY_NUM_MAX INT_MAX +#define EFICONFIG_ENTRY_NUM_MAX (INT_MAX - 1) #define EFICONFIG_VOLUME_PATH_MAX 512 #define EFICONFIG_FILE_PATH_MAX 512 #define EFICONFIG_FILE_PATH_BUF_SIZE (EFICONFIG_FILE_PATH_MAX * sizeof(u16)) diff --git a/include/efi_loader.h b/include/efi_loader.h index 4560b0d04cb..c664d6cdf2c 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -1137,4 +1137,11 @@ efi_status_t efi_console_get_u16_string efi_status_t efi_disk_get_device_name(const efi_handle_t handle, char *buf, int size); +/** + * efi_add_known_memory() - add memory banks to EFI memory map + * + * This weak function may be overridden for specific architectures. + */ +void efi_add_known_memory(void); + #endif /* _EFI_LOADER_H */ diff --git a/include/menu.h b/include/menu.h index 1e88141d6bf..64ce89b7d26 100644 --- a/include/menu.h +++ b/include/menu.h @@ -53,6 +53,7 @@ enum bootmenu_key { BKEY_PLUS, BKEY_MINUS, BKEY_SPACE, + BKEY_SAVE, BKEY_COUNT, }; diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c index ba28989f36a..caaab685ee0 100644 --- a/lib/efi_loader/efi_boottime.c +++ b/lib/efi_loader/efi_boottime.c @@ -264,7 +264,7 @@ static void efi_queue_event(struct efi_event *event) * @tpl: TPL level to check * Return: status code */ -efi_status_t is_valid_tpl(efi_uintn_t tpl) +static efi_status_t is_valid_tpl(efi_uintn_t tpl) { switch (tpl) { case TPL_APPLICATION: @@ -592,7 +592,7 @@ efi_status_t efi_remove_protocol(const efi_handle_t handle, * * Return: status code */ -efi_status_t efi_remove_all_protocols(const efi_handle_t handle) +static efi_status_t efi_remove_all_protocols(const efi_handle_t handle) { struct efi_object *efiobj; struct efi_handler *protocol; @@ -728,6 +728,7 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl, /* * efi_create_event_ex() - create an event in a group + * * @type: type of the event to create * @notify_tpl: task priority level of the event * @notify_function: notification function of the event @@ -742,6 +743,7 @@ efi_status_t efi_create_event(uint32_t type, efi_uintn_t notify_tpl, * * Return: status code */ +static efi_status_t EFIAPI efi_create_event_ex(uint32_t type, efi_uintn_t notify_tpl, void (EFIAPI *notify_function) ( struct efi_event *event, diff --git a/lib/efi_loader/efi_conformance.c b/lib/efi_loader/efi_conformance.c index 3036d46349a..0ca26f57a7f 100644 --- a/lib/efi_loader/efi_conformance.c +++ b/lib/efi_loader/efi_conformance.c @@ -22,7 +22,7 @@ static const efi_guid_t efi_ebbr_2_1_guid = */ efi_status_t efi_ecpt_register(void) { - int num_entries = 0; + u16 num_entries = 0; struct efi_conformance_profiles_table *ecpt; efi_status_t ret; size_t ecpt_size; diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index 1ed8c7aa36e..43176309077 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -669,7 +669,7 @@ static LIST_HEAD(cin_notify_functions); * @mod: Xterm shift mask * @key_state: receives the state of the shift, alt, control, and logo keys */ -void set_shift_mask(int mod, struct efi_key_state *key_state) +static void set_shift_mask(int mod, struct efi_key_state *key_state) { key_state->key_shift_state = EFI_SHIFT_STATE_VALID; if (mod) { diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c index d1dc2f22d0f..778b693f983 100644 --- a/lib/efi_loader/efi_gop.c +++ b/lib/efi_loader/efi_gop.c @@ -400,11 +400,12 @@ out: * @delta: length in bytes of a line in the pixel buffer (optional) * Return: status code */ -efi_status_t EFIAPI gop_blt(struct efi_gop *this, struct efi_gop_pixel *buffer, - u32 operation, efi_uintn_t sx, - efi_uintn_t sy, efi_uintn_t dx, - efi_uintn_t dy, efi_uintn_t width, - efi_uintn_t height, efi_uintn_t delta) +static efi_status_t EFIAPI gop_blt(struct efi_gop *this, + struct efi_gop_pixel *buffer, + u32 operation, efi_uintn_t sx, + efi_uintn_t sy, efi_uintn_t dx, + efi_uintn_t dy, efi_uintn_t width, + efi_uintn_t height, efi_uintn_t delta) { efi_status_t ret = EFI_INVALID_PARAMETER; efi_uintn_t vid_bpp; diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index ad2ab825d19..cee96bfc7fc 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -462,7 +462,7 @@ efi_status_t __weak __efi_runtime EFIAPI efi_set_time(struct efi_time *time) * @scatter_gather_list: pointer to array of physical pointers * Returns: status code */ -efi_status_t __efi_runtime EFIAPI efi_update_capsule_unsupported( +static efi_status_t __efi_runtime EFIAPI efi_update_capsule_unsupported( struct efi_capsule_header **capsule_header_array, efi_uintn_t capsule_count, u64 scatter_gather_list) @@ -484,7 +484,7 @@ efi_status_t __efi_runtime EFIAPI efi_update_capsule_unsupported( * @reset_type: type of reset needed for capsule update * Returns: status code */ -efi_status_t __efi_runtime EFIAPI efi_query_capsule_caps_unsupported( +static efi_status_t __efi_runtime EFIAPI efi_query_capsule_caps_unsupported( struct efi_capsule_header **capsule_header_array, efi_uintn_t capsule_count, u64 *maximum_capsule_size, diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c index f0f01d3b1d5..69aaefab633 100644 --- a/lib/efi_loader/efi_setup.c +++ b/lib/efi_loader/efi_setup.c @@ -11,6 +11,7 @@ #include <efi_loader.h> #include <efi_variable.h> #include <log.h> +#include <asm-generic/unaligned.h> #define OBJ_LIST_NOT_INITIALIZED 1 diff --git a/lib/efi_loader/efi_var_common.c b/lib/efi_loader/efi_var_common.c index eb837027818..ad50bffd2b2 100644 --- a/lib/efi_loader/efi_var_common.c +++ b/lib/efi_loader/efi_var_common.c @@ -165,17 +165,9 @@ efi_status_t EFIAPI efi_query_variable_info( if (!maximum_variable_storage_size || !remaining_variable_storage_size || - !maximum_variable_size || - !(attributes & EFI_VARIABLE_BOOTSERVICE_ACCESS)) + !maximum_variable_size) return EFI_EXIT(EFI_INVALID_PARAMETER); - if ((attributes & ~(u32)EFI_VARIABLE_MASK) || - (attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) || - (attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) || - (!IS_ENABLED(CONFIG_EFI_SECURE_BOOT) && - (attributes & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS))) - return EFI_EXIT(EFI_UNSUPPORTED); - ret = efi_query_variable_info_int(attributes, maximum_variable_storage_size, remaining_variable_storage_size, diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c index 7c32adf6e5b..4c85cfa607e 100644 --- a/lib/efi_loader/efi_variable.c +++ b/lib/efi_loader/efi_variable.c @@ -349,6 +349,29 @@ efi_status_t efi_query_variable_info_int(u32 attributes, u64 *remaining_variable_storage_size, u64 *maximum_variable_size) { + if (attributes == 0) + return EFI_INVALID_PARAMETER; + + /* EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated */ + if ((attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) || + ((attributes & EFI_VARIABLE_MASK) == 0)) + return EFI_UNSUPPORTED; + + if ((attributes & EFI_VARIABLE_MASK) == EFI_VARIABLE_NON_VOLATILE) + return EFI_INVALID_PARAMETER; + + /* Make sure if runtime bit is set, boot service bit is set also. */ + if ((attributes & + (EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS)) == + EFI_VARIABLE_RUNTIME_ACCESS) + return EFI_INVALID_PARAMETER; + + if (attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD) + return EFI_UNSUPPORTED; + + if (attributes & ~(u32)EFI_VARIABLE_MASK) + return EFI_INVALID_PARAMETER; + *maximum_variable_storage_size = EFI_VAR_BUF_SIZE - sizeof(struct efi_var_file); *remaining_variable_storage_size = efi_var_mem_free(); @@ -372,7 +395,7 @@ efi_status_t efi_query_variable_info_int(u32 attributes, * selected type * Returns: status code */ -efi_status_t __efi_runtime EFIAPI efi_query_variable_info_runtime( +static efi_status_t __efi_runtime EFIAPI efi_query_variable_info_runtime( u32 attributes, u64 *maximum_variable_storage_size, u64 *remaining_variable_storage_size, diff --git a/lib/efi_loader/helloworld.c b/lib/efi_loader/helloworld.c index d565f327457..49fa8cc2f00 100644 --- a/lib/efi_loader/helloworld.c +++ b/lib/efi_loader/helloworld.c @@ -125,7 +125,7 @@ static void print_config_tables(void) * @systable: system table * @con_out: simple text output protocol */ -void print_load_options(struct efi_loaded_image *loaded_image) +static void print_load_options(struct efi_loaded_image *loaded_image) { /* Output the load options */ con_out->output_string(con_out, u"Load options: "); @@ -143,6 +143,7 @@ void print_load_options(struct efi_loaded_image *loaded_image) * @device_path: device path to print * @dp2txt: device path to text protocol */ +static efi_status_t print_device_path(struct efi_device_path *device_path, struct efi_device_path_to_text_protocol *dp2txt) { diff --git a/lib/efi_loader/initrddump.c b/lib/efi_loader/initrddump.c index 98721069816..971a3b6236c 100644 --- a/lib/efi_loader/initrddump.c +++ b/lib/efi_loader/initrddump.c @@ -439,7 +439,7 @@ out: * * Return: load options or NULL */ -u16 *get_load_options(void) +static u16 *get_load_options(void) { efi_status_t ret; struct efi_loaded_image *loaded_image; diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 38b0dea8c70..ea1ad1bcb83 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -265,7 +265,7 @@ class Toolchains: print(("Warning: No tool chains. Please run 'buildman " "--fetch-arch all' to download all available toolchains, or " "add a [toolchain] section to your buildman config file " - "%s. See README for details" % + "%s. See buildman.rst for details" % bsettings.config_fname)) paths = [] |