aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2024-04-13 10:18:38 -0600
committerTom Rini <trini@konsulko.com>2024-04-13 10:18:38 -0600
commit266603d8c39cf4d194e2cfe8d86d870590e150e0 (patch)
tree409a82b720c8845ba8a2ff3289f3801ee4b6d258
parent977fc15e9806ce3af2c20228acc3c744f9c3ed0c (diff)
parentf1f4b0e6f37d801f01d043a1ed44b88e7fdd1d92 (diff)
downloadu-boot-WIP/13Apr2024.zip
u-boot-WIP/13Apr2024.tar.gz
u-boot-WIP/13Apr2024.tar.bz2
Merge tag 'efi-2024-07-rc1-2' of https://source.denx.de/u-boot/custodians/u-boot-efiWIP/13Apr2024
Pull request efi-2024-07-rc1-2 Documentation: * bump build dependency idna to 3.7 * update docker image reference to latest * fix section levels in gen_compile_commands * fix references to trace doc UEFI: * eliminate duplicate runtime section definitions * let 'EFI using ACPI tables at' be a debug message * sanitize efi_tcg2_final_events_table definition * move efi_var_collect to common functions * improve error messages in variables unit test by using EFI_UNSUPPORTED for private authenticated variables
-rw-r--r--cmd/Kconfig4
-rw-r--r--doc/build/docker.rst2
-rw-r--r--doc/build/gen_compile_commands.rst4
-rw-r--r--doc/develop/tests_sandbox.rst4
-rw-r--r--doc/sphinx/requirements.txt2
-rw-r--r--include/efi_loader.h3
-rw-r--r--include/efi_tcg2.h8
-rw-r--r--lib/Kconfig2
-rw-r--r--lib/efi_loader/Makefile2
-rw-r--r--lib/efi_loader/efi_acpi.c2
-rw-r--r--lib/efi_loader/efi_memory.c1
-rw-r--r--lib/efi_loader/efi_var_common.c74
-rw-r--r--lib/efi_loader/efi_var_file.c64
-rw-r--r--lib/efi_loader/efi_variable.c1
14 files changed, 90 insertions, 83 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index 3830519..f9f2716 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -2832,8 +2832,8 @@ config CMD_TRACE
Enables a command to control using of function tracing within
U-Boot. This allows recording of call traces including timing
information. The command can write data to memory for exporting
- for analysis (e.g. using bootchart). See doc/README.trace for full
- details.
+ for analysis (e.g. using bootchart). See doc/develop/trace.rst
+ for full details.
config CMD_AVB
bool "avb - Android Verified Boot 2.0 operations"
diff --git a/doc/build/docker.rst b/doc/build/docker.rst
index 953d1b2..45659b3 100644
--- a/doc/build/docker.rst
+++ b/doc/build/docker.rst
@@ -11,4 +11,4 @@ Or to use an existing container
.. code-block:: bash
- sudo docker pull trini/u-boot-gitlab-ci-runner:bionic-20200807-02Sep2020
+ sudo docker pull trini/u-boot-gitlab-ci-runner:jammy-20240227-14Mar2024
diff --git a/doc/build/gen_compile_commands.rst b/doc/build/gen_compile_commands.rst
index 50305ce..d503764 100644
--- a/doc/build/gen_compile_commands.rst
+++ b/doc/build/gen_compile_commands.rst
@@ -42,7 +42,7 @@ needed for it to be usable by the LSP, unless you set a name for the database
other than it's default one (compile_commands.json).
Compatible IDEs
-===============
+---------------
Several popular integrated development environments (IDEs) support the use
of JSON compilation databases for C/C++ development, making it easier to
@@ -73,7 +73,7 @@ compile_commands.json in the root of the repository should suffice to enable
code navigation.
Usage
-=====
+-----
For further details on the script's options, please refer to its help message,
as in the example below.
diff --git a/doc/develop/tests_sandbox.rst b/doc/develop/tests_sandbox.rst
index bfd3bdb..7292307 100644
--- a/doc/develop/tests_sandbox.rst
+++ b/doc/develop/tests_sandbox.rst
@@ -28,8 +28,8 @@ Some of the available tests are:
- test/image/test-imagetools.sh - multi-file images
- test/py/tests/test-fit.py - FIT images
- - tracing: test/trace/test-trace.sh tests the tracing system (see
- README.trace)
+ - tracing: test/trace/test-trace.sh tests the tracing system
+ (see :doc:`trace`).
- verified boot: test/py/tests/test_vboot.py
If you change or enhance any U-Boot subsystem, you should write or expand a
diff --git a/doc/sphinx/requirements.txt b/doc/sphinx/requirements.txt
index 840c6ce..5b4df36 100644
--- a/doc/sphinx/requirements.txt
+++ b/doc/sphinx/requirements.txt
@@ -3,7 +3,7 @@ Babel==2.14.0
certifi==2023.11.17
charset-normalizer==3.3.2
docutils==0.20.1
-idna==3.6
+idna==3.7
imagesize==1.4.1
Jinja2==3.1.3
MarkupSafe==2.1.3
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 7daca0a..bb51c02 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -345,9 +345,6 @@ extern const efi_guid_t smbios3_guid;
extern const efi_guid_t efi_guid_text_input_protocol;
extern const efi_guid_t efi_guid_text_output_protocol;
-extern char __efi_runtime_start[], __efi_runtime_stop[];
-extern char __efi_runtime_rel_start[], __efi_runtime_rel_stop[];
-
/**
* struct efi_open_protocol_info_item - open protocol info item
*
diff --git a/include/efi_tcg2.h b/include/efi_tcg2.h
index b21c5cb..a75b5a3 100644
--- a/include/efi_tcg2.h
+++ b/include/efi_tcg2.h
@@ -150,16 +150,14 @@ struct efi_tcg2_final_events_table {
* the variable.
* @variable_data_length: The size of the variable data.
* @unicode_name: The CHAR16 unicode name of the variable
- * without NULL-terminator.
- * @variable_data: The data parameter of the efi variable
- * in the GetVariable() API.
+ * without NULL-terminator followed by data.
*/
struct efi_tcg2_uefi_variable_data {
efi_guid_t variable_name;
u64 unicode_name_length;
u64 variable_data_length;
- u16 unicode_name[1];
- u8 variable_data[1];
+ u16 unicode_name[];
+ // u8 variable_data[];
};
/**
diff --git a/lib/Kconfig b/lib/Kconfig
index 37ac14f..efb7797 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -348,7 +348,7 @@ config TRACE
Enables function tracing within U-Boot. This allows recording of call
traces including timing information. The command can write data to
memory for exporting for analysis (e.g. using bootchart).
- See doc/README.trace for full details.
+ See doc/develop/trace.rst for full details.
config TRACE_BUFFER_SIZE
hex "Size of trace buffer in U-Boot"
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
index 086521f..034e366 100644
--- a/lib/efi_loader/Makefile
+++ b/lib/efi_loader/Makefile
@@ -71,11 +71,11 @@ obj-y += efi_string.o
obj-$(CONFIG_EFI_UNICODE_COLLATION_PROTOCOL2) += efi_unicode_collation.o
obj-y += efi_var_common.o
obj-y += efi_var_mem.o
-obj-y += efi_var_file.o
ifeq ($(CONFIG_EFI_MM_COMM_TEE),y)
obj-y += efi_variable_tee.o
else
obj-y += efi_variable.o
+obj-y += efi_var_file.o
obj-$(CONFIG_EFI_VARIABLES_PRESEED) += efi_var_seed.o
endif
obj-y += efi_watchdog.o
diff --git a/lib/efi_loader/efi_acpi.c b/lib/efi_loader/efi_acpi.c
index 67bbd2a..67bd7f8 100644
--- a/lib/efi_loader/efi_acpi.c
+++ b/lib/efi_loader/efi_acpi.c
@@ -41,7 +41,7 @@ efi_status_t efi_acpi_register(void)
}
addr = gd_acpi_start();
- printf("EFI using ACPI tables at %lx\n", addr);
+ log_debug("EFI using ACPI tables at %lx\n", addr);
/* And expose them to our EFI payload */
return efi_install_configuration_table(&acpi_guid,
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index aba3100..12cf23f 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -15,6 +15,7 @@
#include <watchdog.h>
#include <asm/cache.h>
#include <asm/global_data.h>
+#include <asm/sections.h>
#include <linux/list_sort.h>
#include <linux/sizes.h>
diff --git a/lib/efi_loader/efi_var_common.c b/lib/efi_loader/efi_var_common.c
index 16b2c3d..aa8feff 100644
--- a/lib/efi_loader/efi_var_common.c
+++ b/lib/efi_loader/efi_var_common.c
@@ -9,6 +9,7 @@
#include <efi_loader.h>
#include <efi_variable.h>
#include <stdlib.h>
+#include <u-boot/crc.h>
enum efi_secure_mode {
EFI_MODE_SETUP,
@@ -416,3 +417,76 @@ void *efi_get_var(const u16 *name, const efi_guid_t *vendor, efi_uintn_t *size)
return buf;
}
+
+/**
+ * efi_var_collect() - Copy EFI variables mstching attributes mask
+ *
+ * @bufp: buffer containing variable collection
+ * @lenp: buffer length
+ * @attr_mask: mask of matched attributes
+ *
+ * Return: Status code
+ */
+efi_status_t __maybe_unused efi_var_collect(struct efi_var_file **bufp, loff_t *lenp,
+ u32 check_attr_mask)
+{
+ size_t len = EFI_VAR_BUF_SIZE;
+ struct efi_var_file *buf;
+ struct efi_var_entry *var, *old_var;
+ size_t old_var_name_length = 2;
+
+ *bufp = NULL; /* Avoid double free() */
+ buf = calloc(1, len);
+ if (!buf)
+ return EFI_OUT_OF_RESOURCES;
+ var = buf->var;
+ old_var = var;
+ for (;;) {
+ efi_uintn_t data_length, var_name_length;
+ u8 *data;
+ efi_status_t ret;
+
+ if ((uintptr_t)buf + len <=
+ (uintptr_t)var->name + old_var_name_length)
+ return EFI_BUFFER_TOO_SMALL;
+
+ var_name_length = (uintptr_t)buf + len - (uintptr_t)var->name;
+ memcpy(var->name, old_var->name, old_var_name_length);
+ guidcpy(&var->guid, &old_var->guid);
+ ret = efi_get_next_variable_name_int(
+ &var_name_length, var->name, &var->guid);
+ if (ret == EFI_NOT_FOUND)
+ break;
+ if (ret != EFI_SUCCESS) {
+ free(buf);
+ return ret;
+ }
+ old_var_name_length = var_name_length;
+ old_var = var;
+
+ data = (u8 *)var->name + old_var_name_length;
+ data_length = (uintptr_t)buf + len - (uintptr_t)data;
+ ret = efi_get_variable_int(var->name, &var->guid,
+ &var->attr, &data_length, data,
+ &var->time);
+ if (ret != EFI_SUCCESS) {
+ free(buf);
+ return ret;
+ }
+ if ((var->attr & check_attr_mask) == check_attr_mask) {
+ var->length = data_length;
+ var = (struct efi_var_entry *)ALIGN((uintptr_t)data + data_length, 8);
+ }
+ }
+
+ buf->reserved = 0;
+ buf->magic = EFI_VAR_FILE_MAGIC;
+ len = (uintptr_t)var - (uintptr_t)buf;
+ buf->crc32 = crc32(0, (u8 *)buf->var,
+ len - sizeof(struct efi_var_file));
+ buf->length = len;
+ *bufp = buf;
+ *lenp = len;
+
+ return EFI_SUCCESS;
+}
diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c
index 532b6b4..413e179 100644
--- a/lib/efi_loader/efi_var_file.c
+++ b/lib/efi_loader/efi_var_file.c
@@ -52,70 +52,6 @@ static efi_status_t __maybe_unused efi_set_blk_dev_to_system_partition(void)
return EFI_SUCCESS;
}
-efi_status_t __maybe_unused efi_var_collect(struct efi_var_file **bufp, loff_t *lenp,
- u32 check_attr_mask)
-{
- size_t len = EFI_VAR_BUF_SIZE;
- struct efi_var_file *buf;
- struct efi_var_entry *var, *old_var;
- size_t old_var_name_length = 2;
-
- *bufp = NULL; /* Avoid double free() */
- buf = calloc(1, len);
- if (!buf)
- return EFI_OUT_OF_RESOURCES;
- var = buf->var;
- old_var = var;
- for (;;) {
- efi_uintn_t data_length, var_name_length;
- u8 *data;
- efi_status_t ret;
-
- if ((uintptr_t)buf + len <=
- (uintptr_t)var->name + old_var_name_length)
- return EFI_BUFFER_TOO_SMALL;
-
- var_name_length = (uintptr_t)buf + len - (uintptr_t)var->name;
- memcpy(var->name, old_var->name, old_var_name_length);
- guidcpy(&var->guid, &old_var->guid);
- ret = efi_get_next_variable_name_int(
- &var_name_length, var->name, &var->guid);
- if (ret == EFI_NOT_FOUND)
- break;
- if (ret != EFI_SUCCESS) {
- free(buf);
- return ret;
- }
- old_var_name_length = var_name_length;
- old_var = var;
-
- data = (u8 *)var->name + old_var_name_length;
- data_length = (uintptr_t)buf + len - (uintptr_t)data;
- ret = efi_get_variable_int(var->name, &var->guid,
- &var->attr, &data_length, data,
- &var->time);
- if (ret != EFI_SUCCESS) {
- free(buf);
- return ret;
- }
- if ((var->attr & check_attr_mask) == check_attr_mask) {
- var->length = data_length;
- var = (struct efi_var_entry *)ALIGN((uintptr_t)data + data_length, 8);
- }
- }
-
- buf->reserved = 0;
- buf->magic = EFI_VAR_FILE_MAGIC;
- len = (uintptr_t)var - (uintptr_t)buf;
- buf->crc32 = crc32(0, (u8 *)buf->var,
- len - sizeof(struct efi_var_file));
- buf->length = len;
- *bufp = buf;
- *lenp = len;
-
- return EFI_SUCCESS;
-}
-
/**
* efi_var_to_file() - save non-volatile variables as file
*
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index 2951dc7..e6c1219 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -163,6 +163,7 @@ static efi_status_t efi_variable_authenticate(const u16 *variable,
break;
default:
/* TODO: support private authenticated variables */
+ ret = EFI_UNSUPPORTED;
goto err;
}