Pull request for efi-2023-04-rc4

Documentation:

* man-page for panic command

UEFI:

* Correct parameter check for SetVariable()

Other:

 * Provide unit test for crc8
This commit is contained in:
Tom Rini
2023-03-13 11:39:21 -04:00
8 changed files with 101 additions and 9 deletions
+2 -1
View File
@@ -27,7 +27,8 @@ metadata. Individual drivers can be added based on the type of storage
media, and its partitioning method. Details of the storage device
containing the FWU metadata partitions are specified through a U-Boot
specific device tree property `fwu-mdata-store`. Please refer to
U-Boot `doc <doc/device-tree-bindings/firmware/fwu-mdata-gpt.yaml>`__
U-Boot :download:`fwu-mdata-gpt.yaml
</device-tree-bindings/firmware/fwu-mdata-gpt.yaml>`
for the device tree bindings.
Enabling the FWU Multi Bank Update feature
+2 -2
View File
@@ -386,8 +386,8 @@ is because the FWU feature supports multiple partitions(banks) of
updatable images, and the actual dfu alt number to which the image is
to be written to is determined at runtime, based on the value of the
update bank to which the image is to be written. For more information
on the FWU Multi Bank Update feature, please refer `doc
<doc/develop/uefi/fwu_updates.rst>`__.
on the FWU Multi Bank Update feature, please refer to
:doc:`/develop/uefi/fwu_updates`.
When using the FMP for FIT images, the image index value needs to be
set to 1.
+33
View File
@@ -0,0 +1,33 @@
.. SPDX-License-Identifier: GPL-2.0+:
panic command
=============
Synopis
-------
::
panic [message]
Description
-----------
Display a message and reset the board.
message
text to be displayed
Examples
--------
::
=> panic 'Unrecoverable error'
Unrecoverable error
resetting ...
Configuration
-------------
If CONFIG_PANIC_HANG=y, the user has to reset the board manually.
+1
View File
@@ -65,6 +65,7 @@ Shell commands
cmd/md
cmd/mmc
cmd/mtest
cmd/panic
cmd/part
cmd/pause
cmd/pinmux
+8
View File
@@ -77,6 +77,14 @@ static struct simple_text_output_mode efi_con_mode = {
.cursor_visible = 1,
};
/**
* term_get_char() - read a character from the console
*
* Wait for up to 100 ms to read a character from the console.
*
* @c: pointer to the buffer to receive the character
* Return: 0 on success, 1 otherwise
*/
static int term_get_char(s32 *c)
{
u64 timeout;
+25 -6
View File
@@ -230,8 +230,30 @@ efi_status_t efi_set_variable_int(const u16 *variable_name,
u64 time = 0;
enum efi_auth_var_type var_type;
if (!variable_name || !*variable_name || !vendor ||
((attributes & EFI_VARIABLE_RUNTIME_ACCESS) &&
if (!variable_name || !*variable_name || !vendor)
return EFI_INVALID_PARAMETER;
if (data_size && !data)
return EFI_INVALID_PARAMETER;
/* EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated */
if (attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)
return EFI_UNSUPPORTED;
/* 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;
/* only EFI_VARIABLE_NON_VOLATILE attribute is invalid */
if ((attributes & EFI_VARIABLE_MASK) == EFI_VARIABLE_NON_VOLATILE)
return EFI_INVALID_PARAMETER;
/* Make sure HR is set with NV, BS and RT */
if (attributes & EFI_VARIABLE_HARDWARE_ERROR_RECORD &&
(!(attributes & EFI_VARIABLE_NON_VOLATILE) ||
!(attributes & EFI_VARIABLE_RUNTIME_ACCESS) ||
!(attributes & EFI_VARIABLE_BOOTSERVICE_ACCESS)))
return EFI_INVALID_PARAMETER;
@@ -281,8 +303,6 @@ efi_status_t efi_set_variable_int(const u16 *variable_name,
/* authenticate a variable */
if (IS_ENABLED(CONFIG_EFI_SECURE_BOOT)) {
if (attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)
return EFI_INVALID_PARAMETER;
if (attributes &
EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) {
u32 env_attr;
@@ -300,8 +320,7 @@ efi_status_t efi_set_variable_int(const u16 *variable_name,
}
} else {
if (attributes &
(EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS |
EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS)) {
EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) {
EFI_PRINT("Secure boot is not configured\n");
return EFI_INVALID_PARAMETER;
}
+1
View File
@@ -20,6 +20,7 @@ obj-$(CONFIG_UT_LIB_ASN1) += asn1.o
obj-$(CONFIG_UT_LIB_RSA) += rsa.o
obj-$(CONFIG_AES) += test_aes.o
obj-$(CONFIG_GETOPT) += getopt.o
obj-$(CONFIG_CRC8) += test_crc8.o
obj-$(CONFIG_UT_LIB_CRYPT) += test_crypt.o
else
obj-$(CONFIG_SANDBOX) += kconfig_spl.o
+29
View File
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2023, Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
*
* Unit test for crc8
*/
#include <test/lib.h>
#include <test/ut.h>
#include <u-boot/crc.h>
static int lib_crc8(struct unit_test_state *uts) {
const char str[] = {0x20, 0xf4, 0xd8, 0x24, 0x6f, 0x41, 0x91, 0xae,
0x46, 0x61, 0xf6, 0x55, 0xeb, 0x38, 0x47, 0x0f,
0xec, 0xd8};
int actual1, actual2, actual3;
int expected1 = 0x47, expected2 = 0xea, expected3 = expected1;
actual1 = crc8(0, str, sizeof(str));
ut_asserteq(expected1, actual1);
actual2 = crc8(0, str, 7);
ut_asserteq(expected2, actual2);
actual3 = crc8(actual2, str + 7, sizeof(str) - 7);
ut_asserteq(expected3, actual3);
return 0;
}
LIB_TEST(lib_crc8, 0);