Pull request for efi-2023-04-rc2

Documentation:
 
 * Provide page with links to talks on U-Boot
 
 UEFI:
 
 * Enable CTRL+S to save the boot order in eficonfig command
 * Run attribute check for QueryVariableInfo() only for the file store
 * Bug fixes
 
 Others:
 
 * Improve output formatting of the coninfo command
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmPme8EACgkQxIHbvCwF
 GsTJ6RAAiDVG2OFTodxLFVhzxoorrIf/piMZDxtc1ClRxF7CPe5CET18bHp0hvvw
 qKJW+dk3aCUSr+E1Ma9ndAHI+/mKmEXudZj/XuUyxlVhm9P8Fw2EQRGZFeogdp0v
 /tMB8c7DjW5kTg39/U3z3F7qo6ifs1I8rGcxAhvU38iuOmmIai6AZH1cEq2P2zY9
 JdHPzSCVz4TOGzmhJD3wxYMn+DjsLxIT0tggGPRJzXGaAdZdLS7cl/X52rabV/Tq
 aJXhjpWNl7RUiNiQbKMtltbmkJQ2MpHkhLGDj2/3H2W5sbpIx0GwDs7r0GSKJ0Ba
 6ycn5NBjP3C3gcl91oWJXrzux6LN2aWqe45lgOLpL2H2pPaRlDebBEdDA+oNQKoo
 mqX8pMbLfpb3nhg/fOXo/YDZ5Uug42fmpjj3Vu5+imjq9jL+tr5lxZ2oDpsUyT51
 MvQXohYTfsYNHQm7M4BzGIuA66WwCJ5TJ3D/YmwdDWPnCCN+QAUMI2/d8Osbct6W
 OBGaoZQoRpPZV62+mrHloXW9j8sapcQfJGejdby7S1bxagF/KG/BLXGCWH/HdWCc
 TsnW+bOOF4N9gIyyyu3yRfHyE7pIyszWlNwRAuPzjwG0dxEbkboA/JdLIFic3Qsj
 fk/65FSvvAeOuvNYEgsEA5VYXJzhD4oNtcNQZHIHjhSTGKBrJF4=
 =HVHT
 -----END PGP SIGNATURE-----

Merge tag 'efi-2023-04-rc2' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023-04-rc2

Documentation:

* Provide page with links to talks on U-Boot

UEFI:

* Enable CTRL+S to save the boot order in eficonfig command
* Run attribute check for QueryVariableInfo() only for the file store
* Bug fixes

Others:

* Improve output formatting of the coninfo command

# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 10 Feb 2023 12:15:45 PM EST
# gpg:                using RSA key 6DC4F9C71F29A6FA06B76D33C481DBBC2C051AC4
# gpg: Good signature from "Heinrich Schuchardt <xypron.glpk@gmx.de>" [unknown]
# gpg:                 aka "[jpeg image of size 1389]" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 6DC4 F9C7 1F29 A6FA 06B7  6D33 C481 DBBC 2C05 1AC4
This commit is contained in:
Tom Rini 2023-02-10 13:45:15 -05:00
commit c34009d5a9
26 changed files with 119 additions and 41 deletions

View File

@ -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.

View File

@ -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);

View File

@ -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;
}

View File

@ -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) {

View File

@ -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;

View File

@ -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

9
doc/learn/index.rst Normal file
View File

@ -0,0 +1,9 @@
.. SPDX-License-Identifier: GPL-2.0+
Learn about U-Boot
==================
.. toctree::
:maxdepth: 1
talks

11
doc/learn/talks.rst Normal file
View File

@ -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

View File

@ -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.

View File

@ -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
------------

View File

@ -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)

View File

@ -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

View File

@ -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))

View File

@ -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 */

View File

@ -53,6 +53,7 @@ enum bootmenu_key {
BKEY_PLUS,
BKEY_MINUS,
BKEY_SPACE,
BKEY_SAVE,
BKEY_COUNT,
};

View File

@ -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,

View File

@ -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;

View File

@ -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) {

View File

@ -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;

View File

@ -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,

View File

@ -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

View File

@ -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,

View File

@ -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,

View File

@ -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)
{

View File

@ -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;

View File

@ -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 = []