Prepare v2021.07

-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmDjIUMACgkQFHw5/5Y0
 tyyEuQv9G2grWGZ8ySREjJdkScNmmu9LUjTlkmmcMA/SovnevG9qx/R1gCRJpl77
 bFGqUK6TYAByAzd+7HXPo9EGNGkA9uweD5uD5s+xbUdLfkcF1Eit3cmhd13AfZfO
 aoGlgPl6kaboht+wwcj8UWPVBuly/wyce7//bqf+4Goo4uVM9c1Rkmp2QZLi7lCP
 WeU92Le6b6+Sq9CBJpyooZvBKsbvu0EEvmw/inFyVzS1ScHRVNPWbnhQYq1axqlw
 H0AdNlJUW+L9vr+GSvJdnBeP8UsvZXG/Wk4GKjivtjA2+b7ZgQhFj0ek0R4MPNhe
 8bq3yMDVaY5ul8bQa6hMbzlPW3DiEhXe1hTdSPHHwOiZaVFJ2txsASVxwpb/nFf0
 S1y55NaVBJOLy2ueGMfijdFrvIsToYGwo+zek2q/YxYL0beFoMFaroR8c0VBBnVE
 sc9DOzdN69tssX8SkWHEkdVGaviOsRoP2SGw8erCezv+GroLfKBPMIXR3CTZyBEM
 buht72sv
 =BxIW
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdQaENiSDAlGTDEbB7G51OISzHs0FAmDkFuMACgkQ7G51OISz
 Hs0J7RAAlG26jJV+8y+EzINaPQvmxxtKcpXqJJw02aIinbgU5+jf6n7KGETzKvW1
 Rgh6ExLYiefJcUkdpQCM7LmRJtIPu/G5rMA06z6H42Opf2AuRBGwlSuysLn6z+SU
 cztc9nxLKP8xMlf2E9PuVG6tmv39gB9qEF14jv0gU9fjh8vbVpbWY69WD8DTdRsm
 WPkIVlgNS2kvTYh0dF//0Ir+QVGcYjbtAbRGhcj+VCpk9Mv7B5uSr3qBuxEBhW6U
 OWBgyRay5yPTmUnWX1iT9wwFyNJ3tQEo+kWkcoq5WCWK7AayQA+DndgUu6fYJPx6
 EF7/ppipyF0CD0eH9fQEOsdW8QNjULHa3KEM0RcM5Zb3NrwJV8LoDNSVzT34Z+eh
 UzNhbcAZUhZswlX50u8tr4r9wc0xfaULpXy1vv4KAWoZkxjtaSvQTbw1lkf5d6hK
 7UMZKbtSqaGntZAEyZC5Hb4vTHHGfvANzsVTD4nJ6QjLDuwOq/w9SUvjz8yUmhtX
 o/ujlZBo61BI9zwtIEDOhO8wYE/sOB9i7tkden2aen2zAlSW5/HFPUfvRcr3KO4D
 4Qwo7baRLmJJvn9BTmmFLphZ2IIHfyUg2OwyINZeXO0KtGjX2q3x492jhtCjmVi/
 1oqsqUb6heklRqZMnCJwgJrYNNXYRfiypSKbGGTTuuRGVwPyvGQ=
 =P5k7
 -----END PGP SIGNATURE-----

Merge tag 'v2021.07' into 2021.07+fslc

Prepare v2021.07

Signed-off-by: Andrey Zhizhikin <andrey.z@gmail.com>
This commit is contained in:
Andrey Zhizhikin 2021-07-06 08:40:00 +00:00
commit 1fcb783fdc
21 changed files with 250 additions and 56 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -187,5 +187,4 @@ CONFIG_OF_LIBFDT_OVERLAY=y
CONFIG_EFI_SET_TIME=y CONFIG_EFI_SET_TIME=y
CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
CONFIG_EFI_CAPSULE_ON_DISK=y CONFIG_EFI_CAPSULE_ON_DISK=y
CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y
CONFIG_EFI_CAPSULE_FIRMWARE_RAW=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 :maxdepth: 1
addrmap addrmap
askenv
base base
bootefi bootefi
booti booti

View File

@ -391,6 +391,8 @@ int spi_get_bus_and_cs(int busnum, int cs, int speed, int mode,
} else if (ret) { } else if (ret) {
dev_err(bus, "Invalid chip select %d:%d (err=%d)\n", busnum, cs, ret); dev_err(bus, "Invalid chip select %d:%d (err=%d)\n", busnum, cs, ret);
return ret; return ret;
} else if (dev) {
plat = dev_get_parent_plat(dev);
} }
if (!device_active(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; 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; *busp = bus;
*devp = slave; *devp = slave;
log_debug("%s: bus=%p, slave=%p\n", __func__, bus, *devp); log_debug("%s: bus=%p, slave=%p\n", __func__, bus, *devp);
return 0; return 0;
err_speed_mode:
spi_release_bus(slave);
err: err:
log_debug("%s: Error path, created=%d, device '%s'\n", __func__, log_debug("%s: Error path, created=%d, device '%s'\n", __func__,
created, dev->name); created, dev->name);

View File

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

View File

@ -60,7 +60,7 @@ struct __packed smbios_entry {
#define BIOS_CHARACTERISTICS_SELECTABLE_BOOT (1 << 16) #define BIOS_CHARACTERISTICS_SELECTABLE_BOOT (1 << 16)
#define BIOS_CHARACTERISTICS_EXT1_ACPI (1 << 0) #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) #define BIOS_CHARACTERISTICS_EXT2_TARGET (1 << 2)
struct __packed smbios_type0 { 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 under a specific directory on UEFI system partition instead of
via UpdateCapsule API. 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 config EFI_CAPSULE_ON_DISK_EARLY
bool "Initiate capsule-on-disk at U-Boot boottime" bool "Initiate capsule-on-disk at U-Boot boottime"
depends on EFI_CAPSULE_ON_DISK 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 Select this option if you want to enable capsule-based
firmware update using Firmware Management Protocol. 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 config EFI_CAPSULE_AUTHENTICATE
bool "Update Capsule authentication" bool "Update Capsule authentication"
depends on EFI_CAPSULE_FIRMWARE depends on EFI_CAPSULE_FIRMWARE
@ -181,29 +213,6 @@ config EFI_CAPSULE_AUTHENTICATE
Select this option if you want to enable capsule Select this option if you want to enable capsule
authentication 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 config EFI_DEVICE_PATH_TO_TEXT
bool "Device path to text protocol" bool "Device path to text protocol"
default y default y

View File

@ -264,7 +264,6 @@ efi_status_t is_valid_tpl(efi_uintn_t tpl)
case TPL_APPLICATION: case TPL_APPLICATION:
case TPL_CALLBACK: case TPL_CALLBACK:
case TPL_NOTIFY: case TPL_NOTIFY:
case TPL_HIGH_LEVEL:
return EFI_SUCCESS; return EFI_SUCCESS;
default: default:
return EFI_INVALID_PARAMETER; 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 * 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; __maybe_unused efi_handle_t handle;
efi_status_t ret = EFI_SUCCESS; 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)) { if (IS_ENABLED(CONFIG_EFI_CAPSULE_FIRMWARE_RAW)) {
handle = NULL; handle = NULL;
ret = EFI_CALL(efi_install_multiple_protocol_interfaces( ret = EFI_CALL(efi_install_multiple_protocol_interfaces(
&efi_root, &handle,
&efi_guid_firmware_management_protocol, &efi_guid_firmware_management_protocol,
&efi_fmp_raw, NULL)); &efi_fmp_raw, NULL));
} }
@ -948,6 +948,33 @@ efi_status_t __weak arch_efi_load_capsule_drivers(void)
return ret; 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 * 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) efi_status_t efi_launch_capsules(void)
{ {
u64 os_indications;
efi_uintn_t size;
struct efi_capsule_header *capsule = NULL; struct efi_capsule_header *capsule = NULL;
u16 **files; u16 **files;
unsigned int nfiles, index, i; unsigned int nfiles, index, i;
u16 variable_name16[12]; u16 variable_name16[12];
efi_status_t ret; efi_status_t ret;
size = sizeof(os_indications); if (!check_run_capsules())
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 EFI_SUCCESS; return EFI_SUCCESS;
index = get_last_capsule(); index = get_last_capsule();
/* Load capsule drivers */
ret = arch_efi_load_capsule_drivers();
if (ret != EFI_SUCCESS)
return ret;
/* /*
* Find capsules on disk. * Find capsules on disk.
* All the capsules are collected at the beginning because * 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 rows = 25, cols = 80;
int ret = -ENODEV; int ret = -ENODEV;
if IS_ENABLED(CONFIG_DM_VIDEO) if (IS_ENABLED(CONFIG_DM_VIDEO))
ret = query_vidconsole(&rows, &cols); ret = query_vidconsole(&rows, &cols);
if (ret) if (ret)
ret = query_console_serial(&rows, &cols); ret = query_console_serial(&rows, &cols);

View File

@ -5,9 +5,12 @@
* Copyright (c) 2016-2018 Alexander Graf et al. * Copyright (c) 2016-2018 Alexander Graf et al.
*/ */
#define LOG_CATEGORY LOGC_EFI
#include <common.h> #include <common.h>
#include <efi_loader.h> #include <efi_loader.h>
#include <efi_variable.h> #include <efi_variable.h>
#include <log.h>
#define OBJ_LIST_NOT_INITIALIZED 1 #define OBJ_LIST_NOT_INITIALIZED 1
@ -171,6 +174,37 @@ static efi_status_t efi_init_os_indications(void)
&os_indications_supported, false); &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 * 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 efi_init_obj_list(void)
{ {
efi_status_t ret = EFI_SUCCESS; efi_status_t r, ret = EFI_SUCCESS;
/* Initialize once only */ /* Initialize once only */
if (efi_obj_list_initialized != OBJ_LIST_NOT_INITIALIZED) 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) if (ret != EFI_SUCCESS)
goto out; 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) #if defined(CONFIG_LCD) || defined(CONFIG_DM_VIDEO)
ret = efi_gop_register(); ret = efi_gop_register();
if (ret != EFI_SUCCESS) if (ret != EFI_SUCCESS)
@ -291,7 +331,11 @@ efi_status_t efi_init_obj_list(void)
if (IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK) && if (IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK) &&
!IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK_EARLY)) !IS_ENABLED(CONFIG_EFI_CAPSULE_ON_DISK_EARLY))
ret = efi_launch_capsules(); ret = efi_launch_capsules();
out: out:
r = efi_clear_os_indications();
if (ret == EFI_SUCCESS)
ret = r;
efi_obj_list_initialized = ret; efi_obj_list_initialized = ret;
return 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, EFI_ENTRY("%x %p %p %p", attributes, maximum_variable_storage_size,
remaining_variable_storage_size, maximum_variable_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, ret = efi_query_variable_info_int(attributes,
maximum_variable_storage_size, maximum_variable_storage_size,
remaining_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; return EFI_ST_FAILURE;
} }
ret = boottime->create_event(EVT_TIMER | EVT_NOTIFY_WAIT, 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) { if (ret != EFI_SUCCESS) {
efi_st_error("could not create event\n"); efi_st_error("could not create event\n");
return EFI_ST_FAILURE; return EFI_ST_FAILURE;

View File

@ -47,7 +47,7 @@ struct smbios_ctx {
* @addr: start address to write the structure * @addr: start address to write the structure
* @handle: the structure's handle, a unique 16-bit number * @handle: the structure's handle, a unique 16-bit number
* @ctx: context for writing the tables * @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, typedef int (*smbios_write_type)(ulong *addr, int handle,
struct smbios_ctx *ctx); struct smbios_ctx *ctx);
@ -72,7 +72,7 @@ struct smbios_write_method {
* *
* @ctx: SMBIOS context * @ctx: SMBIOS context
* @str: string to add * @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) 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 * @ctx: context for writing the tables
* @prop: property to write * @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, static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop,
int sysinfo_id) 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 * smbios_add_prop() - Add a property from the devicetree
* *
* @prop: property to write * @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) 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. * This computes the size of the string area including the string terminator.
* *
* @ctx: SMBIOS context * @ctx: SMBIOS context
* @return: string area size * Return: string area size
*/ */
static int smbios_string_table_len(const struct smbios_ctx *ctx) 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; t->bios_characteristics_ext1 = BIOS_CHARACTERISTICS_EXT1_ACPI;
#endif #endif
#ifdef CONFIG_EFI_LOADER #ifdef CONFIG_EFI_LOADER
t->bios_characteristics_ext1 |= BIOS_CHARACTERISTICS_EXT1_UEFI; t->bios_characteristics_ext2 |= BIOS_CHARACTERISTICS_EXT2_UEFI;
#endif #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 */ /* bios_major_release has only one byte, so drop century */
t->bios_major_release = U_BOOT_VERSION_NUM % 100; 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); fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle);
smbios_set_eos(ctx, t->eos); smbios_set_eos(ctx, t->eos);
t->manufacturer = smbios_add_prop(ctx, "manufacturer"); 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"); 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", t->version = smbios_add_prop_si(ctx, "version",
SYSINFO_ID_SMBIOS_SYSTEM_VERSION); SYSINFO_ID_SMBIOS_SYSTEM_VERSION);
if (serial_str) { 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); fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle);
smbios_set_eos(ctx, t->eos); smbios_set_eos(ctx, t->eos);
t->manufacturer = smbios_add_prop(ctx, "manufacturer"); 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"); 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", t->version = smbios_add_prop_si(ctx, "version",
SYSINFO_ID_SMBIOS_BASEBOARD_VERSION); SYSINFO_ID_SMBIOS_BASEBOARD_VERSION);
t->asset_tag_number = smbios_add_prop(ctx, "asset-tag"); 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); fill_smbios_header(t, SMBIOS_SYSTEM_ENCLOSURE, len, handle);
smbios_set_eos(ctx, t->eos); smbios_set_eos(ctx, t->eos);
t->manufacturer = smbios_add_prop(ctx, "manufacturer"); t->manufacturer = smbios_add_prop(ctx, "manufacturer");
if (!t->manufacturer)
t->manufacturer = smbios_add_string(ctx, "Unknown");
t->chassis_type = SMBIOS_ENCLOSURE_DESKTOP; t->chassis_type = SMBIOS_ENCLOSURE_DESKTOP;
t->bootup_state = SMBIOS_STATE_SAFE; t->bootup_state = SMBIOS_STATE_SAFE;
t->power_supply_state = SMBIOS_STATE_SAFE; t->power_supply_state = SMBIOS_STATE_SAFE;