Merge pull request #42 from zandrey/2021.07+fslc

Update 2021.07+fslc to v2021.07
This commit is contained in:
Otavio Salvador 2021-07-06 08:22:14 -03:00 committed by GitHub
commit 691e634bfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 250 additions and 56 deletions

View File

@ -3,7 +3,7 @@
VERSION = 2021
PATCHLEVEL = 07
SUBLEVEL =
EXTRAVERSION = -rc5
EXTRAVERSION =
NAME =
# *DOCUMENTATION*

View File

@ -1340,7 +1340,7 @@ static int show_efi_boot_order(void)
num = size / sizeof(u16);
for (i = 0; i < num; i++) {
efi_create_indexed_name(var_name16, sizeof(var_name16),
"Boot", i);
"Boot", bootorder[i]);
size = 0;
ret = EFI_CALL(efi_get_variable(var_name16,

View File

@ -48,7 +48,7 @@ static int menukey;
#endif
#ifdef CONFIG_AUTOBOOT_USE_MENUKEY
#define AUTOBOOT_MENUKEY CONFIG_AUTOBOOT_USE_MENUKEY
#define AUTOBOOT_MENUKEY CONFIG_AUTOBOOT_MENUKEY
#else
#define AUTOBOOT_MENUKEY 0
#endif

View File

@ -39,6 +39,7 @@ CONFIG_MMC_MESON_GX=y
CONFIG_MTD=y
CONFIG_DM_MTD=y
CONFIG_DM_SPI_FLASH=y
CONFIG_SF_DEFAULT_MODE=0x0
CONFIG_SPI_FLASH_GIGADEVICE=y
CONFIG_SPI_FLASH_SPANSION=y
CONFIG_PHY_MESON_GXL=y

View File

@ -35,6 +35,7 @@ CONFIG_MMC_MESON_GX=y
CONFIG_MTD=y
CONFIG_DM_MTD=y
CONFIG_DM_SPI_FLASH=y
CONFIG_SF_DEFAULT_MODE=0x0
CONFIG_SPI_FLASH_GIGADEVICE=y
CONFIG_PHY_MESON_GXL=y
CONFIG_DM_ETH=y

View File

@ -36,6 +36,7 @@ CONFIG_SARADC_MESON=y
CONFIG_MMC_MESON_GX=y
CONFIG_MTD=y
CONFIG_DM_SPI_FLASH=y
CONFIG_SF_DEFAULT_MODE=0x0
CONFIG_SPI_FLASH_GIGADEVICE=y
CONFIG_PHY_REALTEK=y
CONFIG_DM_ETH=y

View File

@ -35,6 +35,7 @@ CONFIG_SARADC_MESON=y
CONFIG_MMC_MESON_GX=y
CONFIG_MTD=y
CONFIG_DM_SPI_FLASH=y
CONFIG_SF_DEFAULT_MODE=0x0
CONFIG_SPI_FLASH_GIGADEVICE=y
CONFIG_PHY_REALTEK=y
CONFIG_DM_ETH=y

View File

@ -187,5 +187,4 @@ CONFIG_OF_LIBFDT_OVERLAY=y
CONFIG_EFI_SET_TIME=y
CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
CONFIG_EFI_CAPSULE_ON_DISK=y
CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y
CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y

87
doc/usage/askenv.rst Normal file
View File

@ -0,0 +1,87 @@
.. SPDX-License-Identifier: GPL-2.0+:
askenv command
===============
Synopsis
--------
::
askenv name [message] [size]
Description
-----------
Display message and get environment variable name of max size characters
from stdin.
name
name of the environment variable
message
message is displayed while the command waits for the value to be
entered from stdin.if no message is specified,a default message
"Please enter name:" will be displayed.
size
maximum number of characters that will be stored in environment
variable name.this is in decimal number format (unlike in
other commands where size values are in hexa-decimal). Default
value of size is 1023 (CONFIG_SYS_CBSIZE - 1).
Example
-------
Value of a environment variable env1 without message and size parameters:
::
=> askenv env1;echo $?
Please enter 'env1': val1
0
=> printenv env1
env1=val1
Value of a environment variable env2 with message and size parameters:
::
=> askenv env2 Please type-in a value for env2: 10;echo $?
Please type-in a value for env2: 1234567890123
0
=> printenv env2
env2=1234567890
Value of a environment variable env3 with size parameter only:
::
=> askenv env3 10;echo $?
Please enter 'env3': val3
0
=> printenv env3
env3=val3
Return Value of askenv command, when used without any other arguments:
::
=> askenv;echo $?
askenv - get environment variables from stdin
Usage:
askenv name [message] [size]
- display 'message' and get environment variable 'name' from stdin (max 'size' chars)
1
Configuration
-------------
The askenv command is only available if CMD_ASKENV=y
Return value
------------
The return value $? is set to 0 (true).
If no other arguments are specified (along with askenv), it is set to 1 (false).

View File

@ -17,6 +17,7 @@ Shell commands
:maxdepth: 1
addrmap
askenv
base
bootefi
booti

View File

@ -391,6 +391,8 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
} else if (ret) {
dev_err(bus, "Invalid chip select %d:%d (err=%d)\n", busnum, cs, ret);
return ret;
} else if (dev) {
plat = dev_get_parent_plat(dev);
}
if (!device_active(dev)) {
@ -416,12 +418,22 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
goto err;
}
/* In case bus frequency or mode changed, update it. */
if ((speed && bus_data->speed && bus_data->speed != speed) ||
(plat && plat->mode != mode)) {
ret = spi_set_speed_mode(bus, speed, mode);
if (ret)
goto err_speed_mode;
}
*busp = bus;
*devp = slave;
log_debug("%s: bus=%p, slave=%p\n", __func__, bus, *devp);
return 0;
err_speed_mode:
spi_release_bus(slave);
err:
log_debug("%s: Error path, created=%d, device '%s'\n", __func__,
created, dev->name);

View File

@ -972,4 +972,5 @@ efi_status_t efi_esrt_register(void);
* - error code otherwise.
*/
efi_status_t efi_esrt_populate(void);
efi_status_t efi_load_capsule_drivers(void);
#endif /* _EFI_LOADER_H */

View File

@ -60,7 +60,7 @@ struct __packed smbios_entry {
#define BIOS_CHARACTERISTICS_SELECTABLE_BOOT (1 << 16)
#define BIOS_CHARACTERISTICS_EXT1_ACPI (1 << 0)
#define BIOS_CHARACTERISTICS_EXT1_UEFI (1 << 3)
#define BIOS_CHARACTERISTICS_EXT2_UEFI (1 << 3)
#define BIOS_CHARACTERISTICS_EXT2_TARGET (1 << 2)
struct __packed smbios_type0 {

View File

@ -137,6 +137,16 @@ config EFI_CAPSULE_ON_DISK
under a specific directory on UEFI system partition instead of
via UpdateCapsule API.
config EFI_IGNORE_OSINDICATIONS
bool "Ignore OsIndications for CapsuleUpdate on-disk"
depends on EFI_CAPSULE_ON_DISK
default n
help
There are boards where U-Boot does not support SetVariable at runtime.
Select this option if you want to use the capsule-on-disk feature
without setting the EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED
flag in variable OsIndications.
config EFI_CAPSULE_ON_DISK_EARLY
bool "Initiate capsule-on-disk at U-Boot boottime"
depends on EFI_CAPSULE_ON_DISK
@ -161,6 +171,28 @@ config EFI_CAPSULE_FIRMWARE_MANAGEMENT
Select this option if you want to enable capsule-based
firmware update using Firmware Management Protocol.
config EFI_CAPSULE_FIRMWARE_FIT
bool "FMP driver for FIT images"
depends on FIT
depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
select UPDATE_FIT
select DFU
select EFI_CAPSULE_FIRMWARE
help
Select this option if you want to enable firmware management protocol
driver for FIT image
config EFI_CAPSULE_FIRMWARE_RAW
bool "FMP driver for raw images"
depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
depends on SANDBOX || (!SANDBOX && !EFI_CAPSULE_FIRMWARE_FIT)
select DFU_WRITE_ALT
select DFU
select EFI_CAPSULE_FIRMWARE
help
Select this option if you want to enable firmware management protocol
driver for raw image
config EFI_CAPSULE_AUTHENTICATE
bool "Update Capsule authentication"
depends on EFI_CAPSULE_FIRMWARE
@ -181,29 +213,6 @@ config EFI_CAPSULE_AUTHENTICATE
Select this option if you want to enable capsule
authentication
config EFI_CAPSULE_FIRMWARE_FIT
bool "FMP driver for FIT image"
depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
depends on FIT
select UPDATE_FIT
select DFU
select EFI_CAPSULE_FIRMWARE
default n
help
Select this option if you want to enable firmware management protocol
driver for FIT image
config EFI_CAPSULE_FIRMWARE_RAW
bool "FMP driver for raw image"
depends on EFI_CAPSULE_FIRMWARE_MANAGEMENT
select DFU
select DFU_WRITE_ALT
select EFI_CAPSULE_FIRMWARE
default n
help
Select this option if you want to enable firmware management protocol
driver for raw image
config EFI_DEVICE_PATH_TO_TEXT
bool "Device path to text protocol"
default y

View File

@ -264,7 +264,6 @@ efi_status_t is_valid_tpl(efi_uintn_t tpl)
case TPL_APPLICATION:
case TPL_CALLBACK:
case TPL_NOTIFY:
case TPL_HIGH_LEVEL:
return EFI_SUCCESS;
default:
return EFI_INVALID_PARAMETER;

View File

@ -919,13 +919,13 @@ static void efi_capsule_scan_done(void)
}
/**
* arch_efi_load_capsule_drivers - initialize capsule drivers
* efi_load_capsule_drivers - initialize capsule drivers
*
* Architecture or board specific initialization routine
* Generic FMP drivers backed by DFU
*
* Return: status code
*/
efi_status_t __weak arch_efi_load_capsule_drivers(void)
efi_status_t __weak efi_load_capsule_drivers(void)
{
__maybe_unused efi_handle_t handle;
efi_status_t ret = EFI_SUCCESS;
@ -940,7 +940,7 @@ efi_status_t __weak arch_efi_load_capsule_drivers(void)
if (IS_ENABLED(CONFIG_EFI_CAPSULE_FIRMWARE_RAW)) {
handle = NULL;
ret = EFI_CALL(efi_install_multiple_protocol_interfaces(
&efi_root,
&handle,
&efi_guid_firmware_management_protocol,
&efi_fmp_raw, NULL));
}
@ -948,6 +948,33 @@ efi_status_t __weak arch_efi_load_capsule_drivers(void)
return ret;
}
/**
* check_run_capsules - Check whether capsule update should run
*
* The spec says OsIndications must be set in order to run the capsule update
* on-disk. Since U-Boot doesn't support runtime SetVariable, allow capsules to
* run explicitly if CONFIG_EFI_IGNORE_OSINDICATIONS is selected
*/
static bool check_run_capsules(void)
{
u64 os_indications;
efi_uintn_t size;
efi_status_t ret;
if (IS_ENABLED(CONFIG_EFI_IGNORE_OSINDICATIONS))
return true;
size = sizeof(os_indications);
ret = efi_get_variable_int(L"OsIndications", &efi_global_variable_guid,
NULL, &size, &os_indications, NULL);
if (ret == EFI_SUCCESS &&
(os_indications
& EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED))
return true;
return false;
}
/**
* efi_launch_capsule - launch capsules
*
@ -958,29 +985,17 @@ efi_status_t __weak arch_efi_load_capsule_drivers(void)
*/
efi_status_t efi_launch_capsules(void)
{
u64 os_indications;
efi_uintn_t size;
struct efi_capsule_header *capsule = NULL;
u16 **files;
unsigned int nfiles, index, i;
u16 variable_name16[12];
efi_status_t ret;
size = sizeof(os_indications);
ret = efi_get_variable_int(L"OsIndications", &efi_global_variable_guid,
NULL, &size, &os_indications, NULL);
if (ret != EFI_SUCCESS ||
!(os_indications
& EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED))
if (!check_run_capsules())
return EFI_SUCCESS;
index = get_last_capsule();
/* Load capsule drivers */
ret = arch_efi_load_capsule_drivers();
if (ret != EFI_SUCCESS)
return ret;
/*
* Find capsules on disk.
* All the capsules are collected at the beginning because

View File

@ -342,7 +342,7 @@ static void query_console_size(void)
int rows = 25, cols = 80;
int ret = -ENODEV;
if IS_ENABLED(CONFIG_DM_VIDEO)
if (IS_ENABLED(CONFIG_DM_VIDEO))
ret = query_vidconsole(&rows, &cols);
if (ret)
ret = query_console_serial(&rows, &cols);

View File

@ -5,9 +5,12 @@
* Copyright (c) 2016-2018 Alexander Graf et al.
*/
#define LOG_CATEGORY LOGC_EFI
#include <common.h>
#include <efi_loader.h>
#include <efi_variable.h>
#include <log.h>
#define OBJ_LIST_NOT_INITIALIZED 1
@ -171,6 +174,37 @@ static efi_status_t efi_init_os_indications(void)
&os_indications_supported, false);
}
/**
* efi_clear_os_indications() - clear OsIndications
*
* Clear EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED
*/
static efi_status_t efi_clear_os_indications(void)
{
efi_uintn_t size;
u64 os_indications;
efi_status_t ret;
size = sizeof(os_indications);
ret = efi_get_variable_int(L"OsIndications", &efi_global_variable_guid,
NULL, &size, &os_indications, NULL);
if (ret != EFI_SUCCESS)
os_indications = 0;
else
os_indications &=
~EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED;
ret = efi_set_variable_int(L"OsIndications", &efi_global_variable_guid,
EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
sizeof(os_indications), &os_indications,
false);
if (ret != EFI_SUCCESS)
log_err("Setting %ls failed\n", L"OsIndications");
return ret;
}
/**
* efi_init_obj_list() - Initialize and populate EFI object list
*
@ -178,7 +212,7 @@ static efi_status_t efi_init_os_indications(void)
*/
efi_status_t efi_init_obj_list(void)
{
efi_status_t ret = EFI_SUCCESS;
efi_status_t r, ret = EFI_SUCCESS;
/* Initialize once only */
if (efi_obj_list_initialized != OBJ_LIST_NOT_INITIALIZED)
@ -254,6 +288,12 @@ efi_status_t efi_init_obj_list(void)
if (ret != EFI_SUCCESS)
goto out;
if (IS_ENABLED(CONFIG_EFI_HAVE_CAPSULE_SUPPORT)) {
ret = efi_load_capsule_drivers();
if (ret != EFI_SUCCESS)
goto out;
}
#if defined(CONFIG_LCD) || defined(CONFIG_DM_VIDEO)
ret = efi_gop_register();
if (ret != EFI_SUCCESS)
@ -291,7 +331,11 @@ efi_status_t efi_init_obj_list(void)
if (IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK) &&
!IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK_EARLY))
ret = efi_launch_capsules();
out:
r = efi_clear_os_indications();
if (ret == EFI_SUCCESS)
ret = r;
efi_obj_list_initialized = ret;
return ret;
}

View File

@ -163,6 +163,19 @@ efi_status_t EFIAPI efi_query_variable_info(
EFI_ENTRY("%x %p %p %p", attributes, maximum_variable_storage_size,
remaining_variable_storage_size, maximum_variable_size);
if (!maximum_variable_storage_size ||
!remaining_variable_storage_size ||
!maximum_variable_size ||
!(attributes & EFI_VARIABLE_BOOTSERVICE_ACCESS))
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

@ -55,7 +55,7 @@ static int setup(const efi_handle_t handle,
return EFI_ST_FAILURE;
}
ret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_WAIT,
TPL_HIGH_LEVEL, notify, NULL, &event_wait);
TPL_NOTIFY, notify, NULL, &event_wait);
if (ret != EFI_SUCCESS) {
efi_st_error("could not create event\n");
return EFI_ST_FAILURE;

View File

@ -47,7 +47,7 @@ struct smbios_ctx {
* @addr: start address to write the structure
* @handle: the structure's handle, a unique 16-bit number
* @ctx: context for writing the tables
* @return: size of the structure
* Return: size of the structure
*/
typedef int (*smbios_write_type)(ulong *addr, int handle,
struct smbios_ctx *ctx);
@ -72,7 +72,7 @@ struct smbios_write_method {
*
* @ctx: SMBIOS context
* @str: string to add
* @return: string number in the string area (1 or more)
* Return: string number in the string area (1 or more)
*/
static int smbios_add_string(struct smbios_ctx *ctx, const char *str)
{
@ -111,7 +111,7 @@ static int smbios_add_string(struct smbios_ctx *ctx, const char *str)
*
* @ctx: context for writing the tables
* @prop: property to write
* @return 0 if not found, else SMBIOS string number (1 or more)
* Return: 0 if not found, else SMBIOS string number (1 or more)
*/
static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop,
int sysinfo_id)
@ -139,7 +139,7 @@ static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop,
* smbios_add_prop() - Add a property from the devicetree
*
* @prop: property to write
* @return 0 if not found, else SMBIOS string number (1 or more)
* Return: 0 if not found, else SMBIOS string number (1 or more)
*/
static int smbios_add_prop(struct smbios_ctx *ctx, const char *prop)
{
@ -187,7 +187,7 @@ int smbios_update_version(const char *version)
* This computes the size of the string area including the string terminator.
*
* @ctx: SMBIOS context
* @return: string area size
* Return: string area size
*/
static int smbios_string_table_len(const struct smbios_ctx *ctx)
{
@ -229,9 +229,9 @@ static int smbios_write_type0(ulong *current, int handle,
t->bios_characteristics_ext1 = BIOS_CHARACTERISTICS_EXT1_ACPI;
#endif
#ifdef CONFIG_EFI_LOADER
t->bios_characteristics_ext1 |= BIOS_CHARACTERISTICS_EXT1_UEFI;
t->bios_characteristics_ext2 |= BIOS_CHARACTERISTICS_EXT2_UEFI;
#endif
t->bios_characteristics_ext2 = BIOS_CHARACTERISTICS_EXT2_TARGET;
t->bios_characteristics_ext2 |= BIOS_CHARACTERISTICS_EXT2_TARGET;
/* bios_major_release has only one byte, so drop century */
t->bios_major_release = U_BOOT_VERSION_NUM % 100;
@ -258,7 +258,11 @@ static int smbios_write_type1(ulong *current, int handle,
fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle);
smbios_set_eos(ctx, t->eos);
t->manufacturer = smbios_add_prop(ctx, "manufacturer");
if (!t->manufacturer)
t->manufacturer = smbios_add_string(ctx, "Unknown");
t->product_name = smbios_add_prop(ctx, "product");
if (!t->product_name)
t->product_name = smbios_add_string(ctx, "Unknown Product");
t->version = smbios_add_prop_si(ctx, "version",
SYSINFO_ID_SMBIOS_SYSTEM_VERSION);
if (serial_str) {
@ -288,7 +292,11 @@ static int smbios_write_type2(ulong *current, int handle,
fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle);
smbios_set_eos(ctx, t->eos);
t->manufacturer = smbios_add_prop(ctx, "manufacturer");
if (!t->manufacturer)
t->manufacturer = smbios_add_string(ctx, "Unknown");
t->product_name = smbios_add_prop(ctx, "product");
if (!t->product_name)
t->product_name = smbios_add_string(ctx, "Unknown Product");
t->version = smbios_add_prop_si(ctx, "version",
SYSINFO_ID_SMBIOS_BASEBOARD_VERSION);
t->asset_tag_number = smbios_add_prop(ctx, "asset-tag");
@ -313,6 +321,8 @@ static int smbios_write_type3(ulong *current, int handle,
fill_smbios_header(t, SMBIOS_SYSTEM_ENCLOSURE, len, handle);
smbios_set_eos(ctx, t->eos);
t->manufacturer = smbios_add_prop(ctx, "manufacturer");
if (!t->manufacturer)
t->manufacturer = smbios_add_string(ctx, "Unknown");
t->chassis_type = SMBIOS_ENCLOSURE_DESKTOP;
t->bootup_state = SMBIOS_STATE_SAFE;
t->power_supply_state = SMBIOS_STATE_SAFE;