* [PATCH v2 0/2] efi_selftest: unit test for EFI Conformance Profile Table
@ 2022-09-03 15:01 Heinrich Schuchardt
2022-09-03 15:01 ` [PATCH v2 1/2] efi_selftest: export efi_st_get_config_table() Heinrich Schuchardt
2022-09-03 15:01 ` [PATCH v2 2/2] efi_selftest: unit test for EFI Conformance Profile Table Heinrich Schuchardt
0 siblings, 2 replies; 7+ messages in thread
From: Heinrich Schuchardt @ 2022-09-03 15:01 UTC (permalink / raw)
To: Ilias Apalodimas; +Cc: u-boot, Jose Marinho, Heinrich Schuchardt
Add a new unit test to test the integrity of the
EFI Conformance Profile Table.
The first patch contains the prerequisite refactoring.
v2:
add missing efi_selftest_ecpt.c
Heinrich Schuchardt (2):
efi_selftest: export efi_st_get_config_table()
efi_selftest: unit test for EFI Conformance Profile Table
include/efi_selftest.h | 11 ++++
lib/efi_selftest/Makefile | 1 +
lib/efi_selftest/efi_selftest.c | 38 +++++++-------
lib/efi_selftest/efi_selftest_ecpt.c | 76 ++++++++++++++++++++++++++++
lib/efi_selftest/efi_selftest_fdt.c | 17 -------
lib/efi_selftest/efi_selftest_util.c | 11 ++++
6 files changed, 118 insertions(+), 36 deletions(-)
create mode 100644 lib/efi_selftest/efi_selftest_ecpt.c
--
2.37.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/2] efi_selftest: export efi_st_get_config_table()
2022-09-03 15:01 [PATCH v2 0/2] efi_selftest: unit test for EFI Conformance Profile Table Heinrich Schuchardt
@ 2022-09-03 15:01 ` Heinrich Schuchardt
2022-09-04 5:08 ` Ilias Apalodimas
2022-09-03 15:01 ` [PATCH v2 2/2] efi_selftest: unit test for EFI Conformance Profile Table Heinrich Schuchardt
1 sibling, 1 reply; 7+ messages in thread
From: Heinrich Schuchardt @ 2022-09-03 15:01 UTC (permalink / raw)
To: Ilias Apalodimas; +Cc: u-boot, Jose Marinho, Heinrich Schuchardt
We can use efi_st_get_config_table() in multiple unit tests.
Export the function.
Export system-table and boot-services.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
v2:
no change
---
include/efi_selftest.h | 11 ++++++++
lib/efi_selftest/efi_selftest.c | 38 ++++++++++++++--------------
lib/efi_selftest/efi_selftest_fdt.c | 17 -------------
lib/efi_selftest/efi_selftest_util.c | 11 ++++++++
4 files changed, 41 insertions(+), 36 deletions(-)
diff --git a/include/efi_selftest.h b/include/efi_selftest.h
index 5340cefbb6..e900cb85a9 100644
--- a/include/efi_selftest.h
+++ b/include/efi_selftest.h
@@ -18,6 +18,9 @@
#define EFI_ST_FAILURE 1
#define EFI_ST_SUCCESS_STR u"SUCCESS"
+extern const struct efi_system_table *st_systable;
+extern const struct efi_boot_services *st_boottime;
+
/**
* efi_st_printf() - print a message
*
@@ -130,6 +133,14 @@ u16 *efi_st_translate_code(u16 code);
*/
int efi_st_strcmp_16_8(const u16 *buf1, const char *buf2);
+/**
+ * efi_st_get_config_table() - get configuration table
+ *
+ * @guid: GUID of the configuration table
+ * Return: pointer to configuration table or NULL
+ */
+void *efi_st_get_config_table(const efi_guid_t *guid);
+
/**
* efi_st_get_key() - reads an Unicode character from the input device
*
diff --git a/lib/efi_selftest/efi_selftest.c b/lib/efi_selftest/efi_selftest.c
index 8e427b9e51..191da7fc45 100644
--- a/lib/efi_selftest/efi_selftest.c
+++ b/lib/efi_selftest/efi_selftest.c
@@ -14,8 +14,8 @@
#define EFI_ST_EXECUTE 2
#define EFI_ST_TEARDOWN 4
-static const struct efi_system_table *systable;
-static const struct efi_boot_services *boottime;
+const struct efi_system_table *st_systable;
+const struct efi_boot_services *st_boottime;
static const struct efi_runtime_services *runtime;
static efi_handle_t handle;
static u16 reset_message[] = u"Selftest completed";
@@ -41,7 +41,7 @@ void efi_st_exit_boot_services(void)
/* Do not detach devices in ExitBootServices. We need the console. */
efi_st_keep_devices = true;
- ret = boottime->get_memory_map(&map_size, NULL, &map_key, &desc_size,
+ ret = st_boottime->get_memory_map(&map_size, NULL, &map_key, &desc_size,
&desc_version);
if (ret != EFI_BUFFER_TOO_SMALL) {
efi_st_error(
@@ -50,19 +50,19 @@ void efi_st_exit_boot_services(void)
}
/* Allocate extra space for newly allocated memory */
map_size += sizeof(struct efi_mem_desc);
- ret = boottime->allocate_pool(EFI_BOOT_SERVICES_DATA, map_size,
+ ret = st_boottime->allocate_pool(EFI_BOOT_SERVICES_DATA, map_size,
(void **)&memory_map);
if (ret != EFI_SUCCESS) {
efi_st_error("AllocatePool did not return EFI_SUCCESS\n");
return;
}
- ret = boottime->get_memory_map(&map_size, memory_map, &map_key,
+ ret = st_boottime->get_memory_map(&map_size, memory_map, &map_key,
&desc_size, &desc_version);
if (ret != EFI_SUCCESS) {
efi_st_error("GetMemoryMap did not return EFI_SUCCESS\n");
return;
}
- ret = boottime->exit_boot_services(handle, map_key);
+ ret = st_boottime->exit_boot_services(handle, map_key);
if (ret != EFI_SUCCESS) {
efi_st_error("ExitBootServices did not return EFI_SUCCESS\n");
return;
@@ -84,7 +84,7 @@ static int setup(struct efi_unit_test *test, unsigned int *failures)
if (!test->setup)
return EFI_ST_SUCCESS;
efi_st_printc(EFI_LIGHTBLUE, "\nSetting up '%s'\n", test->name);
- ret = test->setup(handle, systable);
+ ret = test->setup(handle, st_systable);
if (ret != EFI_ST_SUCCESS) {
efi_st_error("Setting up '%s' failed\n", test->name);
++*failures;
@@ -240,8 +240,8 @@ void efi_st_do_tests(const u16 *testname, unsigned int phase,
* All tests use a driver model and are run in three phases:
* setup, execute, teardown.
*
- * A test may be setup and executed at boottime,
- * it may be setup at boottime and executed at runtime,
+ * A test may be setup and executed at st_boottime,
+ * it may be setup at st_boottime and executed at runtime,
* or it may be setup and executed at runtime.
*
* After executing all tests the system is reset.
@@ -257,14 +257,14 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle,
struct efi_loaded_image *loaded_image;
efi_status_t ret;
- systable = systab;
- boottime = systable->boottime;
- runtime = systable->runtime;
+ st_systable = systab;
+ st_boottime = st_systable->boottime;
+ runtime = st_systable->runtime;
handle = image_handle;
- con_out = systable->con_out;
- con_in = systable->con_in;
+ con_out = st_systable->con_out;
+ con_in = st_systable->con_in;
- ret = boottime->handle_protocol(image_handle, &efi_guid_loaded_image,
+ ret = st_boottime->handle_protocol(image_handle, &efi_guid_loaded_image,
(void **)&loaded_image);
if (ret != EFI_SUCCESS) {
efi_st_error("Cannot open loaded image protocol\n");
@@ -280,9 +280,9 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle,
list_all_tests();
/*
* TODO:
- * Once the Exit boottime service is correctly
+ * Once the Exit st_boottime service is correctly
* implemented we should call
- * boottime->exit(image_handle, EFI_SUCCESS, 0, NULL);
+ * st_boottime->exit(image_handle, EFI_SUCCESS, 0, NULL);
* here, cf.
* https://lists.denx.de/pipermail/u-boot/2017-October/308720.html
*/
@@ -300,7 +300,7 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle,
efi_unit_test));
/* Allocate buffer for setup results */
- ret = boottime->allocate_pool(EFI_RUNTIME_SERVICES_DATA, sizeof(int) *
+ ret = st_boottime->allocate_pool(EFI_RUNTIME_SERVICES_DATA, sizeof(int) *
ll_entry_count(struct efi_unit_test,
efi_unit_test),
(void **)&setup_status);
@@ -309,7 +309,7 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle,
return ret;
}
- /* Execute boottime tests */
+ /* Execute st_boottime tests */
efi_st_do_tests(testname, EFI_EXECUTE_BEFORE_BOOTTIME_EXIT,
EFI_ST_SETUP | EFI_ST_EXECUTE | EFI_ST_TEARDOWN,
&failures);
diff --git a/lib/efi_selftest/efi_selftest_fdt.c b/lib/efi_selftest/efi_selftest_fdt.c
index 114ac58bf5..aa3b13ae3a 100644
--- a/lib/efi_selftest/efi_selftest_fdt.c
+++ b/lib/efi_selftest/efi_selftest_fdt.c
@@ -144,23 +144,6 @@ static char *get_property(const u16 *property, const u16 *node)
return NULL;
}
-/**
- * efi_st_get_config_table() - get configuration table
- *
- * @guid: GUID of the configuration table
- * Return: pointer to configuration table or NULL
- */
-static void *efi_st_get_config_table(const efi_guid_t *guid)
-{
- size_t i;
-
- for (i = 0; i < systab.nr_tables; i++) {
- if (!guidcmp(guid, &systemtab->tables[i].guid))
- return systemtab->tables[i].table;
- }
- return NULL;
-}
-
/*
* Setup unit test.
*
diff --git a/lib/efi_selftest/efi_selftest_util.c b/lib/efi_selftest/efi_selftest_util.c
index dba02d6b56..7e03e0c939 100644
--- a/lib/efi_selftest/efi_selftest_util.c
+++ b/lib/efi_selftest/efi_selftest_util.c
@@ -110,3 +110,14 @@ int efi_st_strcmp_16_8(const u16 *buf1, const char *buf2)
}
return 0;
}
+
+void *efi_st_get_config_table(const efi_guid_t *guid)
+{
+ size_t i;
+
+ for (i = 0; i < st_systable->nr_tables; i++) {
+ if (!guidcmp(guid, &st_systable->tables[i].guid))
+ return st_systable->tables[i].table;
+ }
+ return NULL;
+}
--
2.37.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] efi_selftest: unit test for EFI Conformance Profile Table
2022-09-03 15:01 [PATCH v2 0/2] efi_selftest: unit test for EFI Conformance Profile Table Heinrich Schuchardt
2022-09-03 15:01 ` [PATCH v2 1/2] efi_selftest: export efi_st_get_config_table() Heinrich Schuchardt
@ 2022-09-03 15:01 ` Heinrich Schuchardt
2022-09-04 5:08 ` Ilias Apalodimas
1 sibling, 1 reply; 7+ messages in thread
From: Heinrich Schuchardt @ 2022-09-03 15:01 UTC (permalink / raw)
To: Ilias Apalodimas; +Cc: u-boot, Jose Marinho, Heinrich Schuchardt
Add a new unit test to test the integrity of the
EFI Conformance Profile Table.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
v2:
add missing efi_selftest_ecpt.c
---
lib/efi_selftest/Makefile | 1 +
lib/efi_selftest/efi_selftest_ecpt.c | 76 ++++++++++++++++++++++++++++
2 files changed, 77 insertions(+)
create mode 100644 lib/efi_selftest/efi_selftest_ecpt.c
diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile
index 33536c9ec0..daac6c3968 100644
--- a/lib/efi_selftest/Makefile
+++ b/lib/efi_selftest/Makefile
@@ -49,6 +49,7 @@ efi_selftest_variables.o \
efi_selftest_variables_runtime.o \
efi_selftest_watchdog.o
+obj-$(CONFIG_EFI_ECPT) += efi_selftest_ecpt.o
obj-$(CONFIG_NET) += efi_selftest_snp.o
obj-$(CONFIG_EFI_DEVICE_PATH_TO_TEXT) += efi_selftest_devicepath.o
diff --git a/lib/efi_selftest/efi_selftest_ecpt.c b/lib/efi_selftest/efi_selftest_ecpt.c
new file mode 100644
index 0000000000..e8cc13545d
--- /dev/null
+++ b/lib/efi_selftest/efi_selftest_ecpt.c
@@ -0,0 +1,76 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * efi_selftest_fdt
+ *
+ * Copyright (c) 2022 Heinrich Schuchardt <xypron.glpk@gmx.de>
+ *
+ * Check the EFI_CONFORMANCE_PROFILE_TABLE
+ */
+
+#include <efi_selftest.h>
+
+static const efi_guid_t guid_ecpt = EFI_CONFORMANCE_PROFILES_TABLE_GUID;
+static const efi_guid_t guid_ebbr_2_0 = EFI_CONFORMANCE_PROFILE_EBBR_2_0_GUID;
+
+/*
+ * ecpt_find_guid() - find GUID in EFI Conformance Profile Table
+ *
+ * @ecpt: EFI Conformance Profile Table
+ * @guid: GUID to find
+ * Return: EFI_ST_SUCCESS for success
+ */
+static int ecpt_find_guid(struct efi_conformance_profiles_table *ecpt,
+ const efi_guid_t *guid) {
+ int i;
+
+ for (i = 0; i < ecpt->number_of_profiles; ++i) {
+ if (!memcmp(&ecpt->conformance_profiles[i], guid, 16))
+ return EFI_ST_SUCCESS;
+ }
+ efi_st_error("GUID %pU not found\n", guid);
+ return EFI_ST_FAILURE;
+}
+
+/*
+ * Execute unit test.
+ *
+ * Return: EFI_ST_SUCCESS for success
+ */
+static int execute(void)
+{
+ struct efi_conformance_profiles_table *ecpt;
+ int expected_entries = 0;
+
+ ecpt = efi_st_get_config_table(&guid_ecpt);
+
+ if (!ecpt) {
+ efi_st_error("Missing EFI Conformance Profile Table\n");
+ return EFI_ST_FAILURE;
+ }
+
+ if (ecpt->version != EFI_CONFORMANCE_PROFILES_TABLE_VERSION) {
+ efi_st_error("Wrong table version\n");
+ return EFI_ST_FAILURE;
+ }
+
+ if (CONFIG_IS_ENABLED(EFI_EBBR_2_0_CONFORMANCE)) {
+ ++expected_entries;
+ if (ecpt_find_guid(ecpt, &guid_ebbr_2_0))
+ return EFI_ST_FAILURE;
+ }
+
+ if (ecpt->number_of_profiles != expected_entries) {
+ efi_st_error("Expected %d entries, found %d\n",
+ expected_entries, ecpt->number_of_profiles);
+ return EFI_ST_FAILURE;
+ }
+
+ return EFI_ST_SUCCESS;
+}
+
+
+EFI_UNIT_TEST(ecpt) = {
+ .name = "conformance profile table",
+ .phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT,
+ .execute = execute,
+};
--
2.37.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] efi_selftest: unit test for EFI Conformance Profile Table
2022-09-03 15:01 ` [PATCH v2 2/2] efi_selftest: unit test for EFI Conformance Profile Table Heinrich Schuchardt
@ 2022-09-04 5:08 ` Ilias Apalodimas
2022-09-04 7:53 ` Heinrich Schuchardt
0 siblings, 1 reply; 7+ messages in thread
From: Ilias Apalodimas @ 2022-09-04 5:08 UTC (permalink / raw)
To: Heinrich Schuchardt; +Cc: u-boot, Jose Marinho
Hi Heinrich,
[...]
> + */
> +static int ecpt_find_guid(struct efi_conformance_profiles_table *ecpt,
> + const efi_guid_t *guid) {
> + int i;
> +
> + for (i = 0; i < ecpt->number_of_profiles; ++i) {
> + if (!memcmp(&ecpt->conformance_profiles[i], guid, 16))
> + return EFI_ST_SUCCESS;
Can't we use guidcmp here?
> + }
> + efi_st_error("GUID %pU not found\n", guid);
> + return EFI_ST_FAILURE;
> +}
> +
> +/*
[...]
Thanks
/Ilias
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] efi_selftest: export efi_st_get_config_table()
2022-09-03 15:01 ` [PATCH v2 1/2] efi_selftest: export efi_st_get_config_table() Heinrich Schuchardt
@ 2022-09-04 5:08 ` Ilias Apalodimas
0 siblings, 0 replies; 7+ messages in thread
From: Ilias Apalodimas @ 2022-09-04 5:08 UTC (permalink / raw)
To: Heinrich Schuchardt; +Cc: u-boot, Jose Marinho
On Sat, 3 Sept 2022 at 18:01, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> We can use efi_st_get_config_table() in multiple unit tests.
> Export the function.
>
> Export system-table and boot-services.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
> v2:
> no change
> ---
> include/efi_selftest.h | 11 ++++++++
> lib/efi_selftest/efi_selftest.c | 38 ++++++++++++++--------------
> lib/efi_selftest/efi_selftest_fdt.c | 17 -------------
> lib/efi_selftest/efi_selftest_util.c | 11 ++++++++
> 4 files changed, 41 insertions(+), 36 deletions(-)
>
> diff --git a/include/efi_selftest.h b/include/efi_selftest.h
> index 5340cefbb6..e900cb85a9 100644
> --- a/include/efi_selftest.h
> +++ b/include/efi_selftest.h
> @@ -18,6 +18,9 @@
> #define EFI_ST_FAILURE 1
> #define EFI_ST_SUCCESS_STR u"SUCCESS"
>
> +extern const struct efi_system_table *st_systable;
> +extern const struct efi_boot_services *st_boottime;
> +
> /**
> * efi_st_printf() - print a message
> *
> @@ -130,6 +133,14 @@ u16 *efi_st_translate_code(u16 code);
> */
> int efi_st_strcmp_16_8(const u16 *buf1, const char *buf2);
>
> +/**
> + * efi_st_get_config_table() - get configuration table
> + *
> + * @guid: GUID of the configuration table
> + * Return: pointer to configuration table or NULL
> + */
> +void *efi_st_get_config_table(const efi_guid_t *guid);
> +
> /**
> * efi_st_get_key() - reads an Unicode character from the input device
> *
> diff --git a/lib/efi_selftest/efi_selftest.c b/lib/efi_selftest/efi_selftest.c
> index 8e427b9e51..191da7fc45 100644
> --- a/lib/efi_selftest/efi_selftest.c
> +++ b/lib/efi_selftest/efi_selftest.c
> @@ -14,8 +14,8 @@
> #define EFI_ST_EXECUTE 2
> #define EFI_ST_TEARDOWN 4
>
> -static const struct efi_system_table *systable;
> -static const struct efi_boot_services *boottime;
> +const struct efi_system_table *st_systable;
> +const struct efi_boot_services *st_boottime;
> static const struct efi_runtime_services *runtime;
> static efi_handle_t handle;
> static u16 reset_message[] = u"Selftest completed";
> @@ -41,7 +41,7 @@ void efi_st_exit_boot_services(void)
> /* Do not detach devices in ExitBootServices. We need the console. */
> efi_st_keep_devices = true;
>
> - ret = boottime->get_memory_map(&map_size, NULL, &map_key, &desc_size,
> + ret = st_boottime->get_memory_map(&map_size, NULL, &map_key, &desc_size,
> &desc_version);
> if (ret != EFI_BUFFER_TOO_SMALL) {
> efi_st_error(
> @@ -50,19 +50,19 @@ void efi_st_exit_boot_services(void)
> }
> /* Allocate extra space for newly allocated memory */
> map_size += sizeof(struct efi_mem_desc);
> - ret = boottime->allocate_pool(EFI_BOOT_SERVICES_DATA, map_size,
> + ret = st_boottime->allocate_pool(EFI_BOOT_SERVICES_DATA, map_size,
> (void **)&memory_map);
> if (ret != EFI_SUCCESS) {
> efi_st_error("AllocatePool did not return EFI_SUCCESS\n");
> return;
> }
> - ret = boottime->get_memory_map(&map_size, memory_map, &map_key,
> + ret = st_boottime->get_memory_map(&map_size, memory_map, &map_key,
> &desc_size, &desc_version);
> if (ret != EFI_SUCCESS) {
> efi_st_error("GetMemoryMap did not return EFI_SUCCESS\n");
> return;
> }
> - ret = boottime->exit_boot_services(handle, map_key);
> + ret = st_boottime->exit_boot_services(handle, map_key);
> if (ret != EFI_SUCCESS) {
> efi_st_error("ExitBootServices did not return EFI_SUCCESS\n");
> return;
> @@ -84,7 +84,7 @@ static int setup(struct efi_unit_test *test, unsigned int *failures)
> if (!test->setup)
> return EFI_ST_SUCCESS;
> efi_st_printc(EFI_LIGHTBLUE, "\nSetting up '%s'\n", test->name);
> - ret = test->setup(handle, systable);
> + ret = test->setup(handle, st_systable);
> if (ret != EFI_ST_SUCCESS) {
> efi_st_error("Setting up '%s' failed\n", test->name);
> ++*failures;
> @@ -240,8 +240,8 @@ void efi_st_do_tests(const u16 *testname, unsigned int phase,
> * All tests use a driver model and are run in three phases:
> * setup, execute, teardown.
> *
> - * A test may be setup and executed at boottime,
> - * it may be setup at boottime and executed at runtime,
> + * A test may be setup and executed at st_boottime,
> + * it may be setup at st_boottime and executed at runtime,
> * or it may be setup and executed at runtime.
> *
> * After executing all tests the system is reset.
> @@ -257,14 +257,14 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle,
> struct efi_loaded_image *loaded_image;
> efi_status_t ret;
>
> - systable = systab;
> - boottime = systable->boottime;
> - runtime = systable->runtime;
> + st_systable = systab;
> + st_boottime = st_systable->boottime;
> + runtime = st_systable->runtime;
> handle = image_handle;
> - con_out = systable->con_out;
> - con_in = systable->con_in;
> + con_out = st_systable->con_out;
> + con_in = st_systable->con_in;
>
> - ret = boottime->handle_protocol(image_handle, &efi_guid_loaded_image,
> + ret = st_boottime->handle_protocol(image_handle, &efi_guid_loaded_image,
> (void **)&loaded_image);
> if (ret != EFI_SUCCESS) {
> efi_st_error("Cannot open loaded image protocol\n");
> @@ -280,9 +280,9 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle,
> list_all_tests();
> /*
> * TODO:
> - * Once the Exit boottime service is correctly
> + * Once the Exit st_boottime service is correctly
> * implemented we should call
> - * boottime->exit(image_handle, EFI_SUCCESS, 0, NULL);
> + * st_boottime->exit(image_handle, EFI_SUCCESS, 0, NULL);
> * here, cf.
> * https://lists.denx.de/pipermail/u-boot/2017-October/308720.html
> */
> @@ -300,7 +300,7 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle,
> efi_unit_test));
>
> /* Allocate buffer for setup results */
> - ret = boottime->allocate_pool(EFI_RUNTIME_SERVICES_DATA, sizeof(int) *
> + ret = st_boottime->allocate_pool(EFI_RUNTIME_SERVICES_DATA, sizeof(int) *
> ll_entry_count(struct efi_unit_test,
> efi_unit_test),
> (void **)&setup_status);
> @@ -309,7 +309,7 @@ efi_status_t EFIAPI efi_selftest(efi_handle_t image_handle,
> return ret;
> }
>
> - /* Execute boottime tests */
> + /* Execute st_boottime tests */
> efi_st_do_tests(testname, EFI_EXECUTE_BEFORE_BOOTTIME_EXIT,
> EFI_ST_SETUP | EFI_ST_EXECUTE | EFI_ST_TEARDOWN,
> &failures);
> diff --git a/lib/efi_selftest/efi_selftest_fdt.c b/lib/efi_selftest/efi_selftest_fdt.c
> index 114ac58bf5..aa3b13ae3a 100644
> --- a/lib/efi_selftest/efi_selftest_fdt.c
> +++ b/lib/efi_selftest/efi_selftest_fdt.c
> @@ -144,23 +144,6 @@ static char *get_property(const u16 *property, const u16 *node)
> return NULL;
> }
>
> -/**
> - * efi_st_get_config_table() - get configuration table
> - *
> - * @guid: GUID of the configuration table
> - * Return: pointer to configuration table or NULL
> - */
> -static void *efi_st_get_config_table(const efi_guid_t *guid)
> -{
> - size_t i;
> -
> - for (i = 0; i < systab.nr_tables; i++) {
> - if (!guidcmp(guid, &systemtab->tables[i].guid))
> - return systemtab->tables[i].table;
> - }
> - return NULL;
> -}
> -
> /*
> * Setup unit test.
> *
> diff --git a/lib/efi_selftest/efi_selftest_util.c b/lib/efi_selftest/efi_selftest_util.c
> index dba02d6b56..7e03e0c939 100644
> --- a/lib/efi_selftest/efi_selftest_util.c
> +++ b/lib/efi_selftest/efi_selftest_util.c
> @@ -110,3 +110,14 @@ int efi_st_strcmp_16_8(const u16 *buf1, const char *buf2)
> }
> return 0;
> }
> +
> +void *efi_st_get_config_table(const efi_guid_t *guid)
> +{
> + size_t i;
> +
> + for (i = 0; i < st_systable->nr_tables; i++) {
> + if (!guidcmp(guid, &st_systable->tables[i].guid))
> + return st_systable->tables[i].table;
> + }
> + return NULL;
> +}
> --
> 2.37.2
>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] efi_selftest: unit test for EFI Conformance Profile Table
2022-09-04 5:08 ` Ilias Apalodimas
@ 2022-09-04 7:53 ` Heinrich Schuchardt
2022-09-04 16:20 ` Ilias Apalodimas
0 siblings, 1 reply; 7+ messages in thread
From: Heinrich Schuchardt @ 2022-09-04 7:53 UTC (permalink / raw)
To: Ilias Apalodimas; +Cc: u-boot, Jose Marinho
On 9/4/22 07:08, Ilias Apalodimas wrote:
> Hi Heinrich,
>
> [...]
>
>> + */
>> +static int ecpt_find_guid(struct efi_conformance_profiles_table *ecpt,
>> + const efi_guid_t *guid) {
>> + int i;
>> +
>> + for (i = 0; i < ecpt->number_of_profiles; ++i) {
>> + if (!memcmp(&ecpt->conformance_profiles[i], guid, 16))
>> + return EFI_ST_SUCCESS;
>
> Can't we use guidcmp here?
I would prefer to keep the unit tests independent of U-Boot's library
functions so that we can opt to compile them as freestanding UEFI
application.
Best regards
Heinrich
>
>> + }
>> + efi_st_error("GUID %pU not found\n", guid);
>> + return EFI_ST_FAILURE;
>> +}
>> +
>> +/*
> [...]
>
> Thanks
> /Ilias
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] efi_selftest: unit test for EFI Conformance Profile Table
2022-09-04 7:53 ` Heinrich Schuchardt
@ 2022-09-04 16:20 ` Ilias Apalodimas
0 siblings, 0 replies; 7+ messages in thread
From: Ilias Apalodimas @ 2022-09-04 16:20 UTC (permalink / raw)
To: Heinrich Schuchardt; +Cc: u-boot, Jose Marinho
On Sun, Sep 04, 2022 at 09:53:03AM +0200, Heinrich Schuchardt wrote:
>
>
> On 9/4/22 07:08, Ilias Apalodimas wrote:
> > Hi Heinrich,
> >
> > [...]
> >
> > > + */
> > > +static int ecpt_find_guid(struct efi_conformance_profiles_table *ecpt,
> > > + const efi_guid_t *guid) {
> > > + int i;
> > > +
> > > + for (i = 0; i < ecpt->number_of_profiles; ++i) {
> > > + if (!memcmp(&ecpt->conformance_profiles[i], guid, 16))
> > > + return EFI_ST_SUCCESS;
> >
> > Can't we use guidcmp here?
>
> I would prefer to keep the unit tests independent of U-Boot's library
> functions so that we can opt to compile them as freestanding UEFI
> application.
>
> Best regards
Fair enough,
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
>
> Heinrich
>
> >
> > > + }
> > > + efi_st_error("GUID %pU not found\n", guid);
> > > + return EFI_ST_FAILURE;
> > > +}
> > > +
> > > +/*
> > [...]
> >
> > Thanks
> > /Ilias
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-09-04 16:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-03 15:01 [PATCH v2 0/2] efi_selftest: unit test for EFI Conformance Profile Table Heinrich Schuchardt
2022-09-03 15:01 ` [PATCH v2 1/2] efi_selftest: export efi_st_get_config_table() Heinrich Schuchardt
2022-09-04 5:08 ` Ilias Apalodimas
2022-09-03 15:01 ` [PATCH v2 2/2] efi_selftest: unit test for EFI Conformance Profile Table Heinrich Schuchardt
2022-09-04 5:08 ` Ilias Apalodimas
2022-09-04 7:53 ` Heinrich Schuchardt
2022-09-04 16:20 ` Ilias Apalodimas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox