[U-Boot] [PATCH 1/1] efi_selftest: do not run FDT test with ACPI table.

Heinrich Schuchardt xypron.glpk at gmx.de
Mon Apr 22 18:03:08 UTC 2019


The EBBR specification prescribes that we should have either an ACPI table
or a device tree but not both.

So do not run the device tree unit test on boards with an ACPI table.
Hence there is no need any longer to make it 'on request' only.
Do not pass $fdtcontroladdr to `bootefi selftest`.

Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
---
 lib/efi_selftest/Makefile           |  4 +++
 lib/efi_selftest/efi_selftest_fdt.c | 41 +++++++++++++++++++++--------
 test/py/tests/test_efi_selftest.py  |  3 ++-
 3 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile
index c9720c9da8..fb82e71976 100644
--- a/lib/efi_selftest/Makefile
+++ b/lib/efi_selftest/Makefile
@@ -42,6 +42,10 @@ efi_selftest_watchdog.o
 obj-$(CONFIG_CPU_V7) += efi_selftest_unaligned.o
 obj-$(CONFIG_EFI_LOADER_HII) += efi_selftest_hii.o

+ifeq ($(CONFIG_GENERATE_ACPI_TABLE),)
+obj-y += efi_selftest_fdt.o
+endif
+
 ifeq ($(CONFIG_BLK)$(CONFIG_PARTITIONS),yy)
 obj-y += efi_selftest_block_device.o
 endif
diff --git a/lib/efi_selftest/efi_selftest_fdt.c b/lib/efi_selftest/efi_selftest_fdt.c
index d545d51812..94d72d3f6d 100644
--- a/lib/efi_selftest/efi_selftest_fdt.c
+++ b/lib/efi_selftest/efi_selftest_fdt.c
@@ -13,13 +13,15 @@
 #include <efi_selftest.h>
 #include <linux/libfdt.h>

-static struct efi_boot_services *boottime;
+static const struct efi_system_table *systemtab;
+static const struct efi_boot_services *boottime;
 static const char *fdt;

 /* This should be sufficient for */
 #define BUFFERSIZE 0x100000

-static efi_guid_t fdt_guid = EFI_FDT_GUID;
+static const efi_guid_t fdt_guid = EFI_FDT_GUID;
+static const efi_guid_t acpi_guid = EFI_ACPI_TABLE_GUID;

 /*
  * Convert FDT value to host endianness.
@@ -115,6 +117,23 @@ static char *get_property(const u16 *property)
 	}
 }

+/**
+ * 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.
  *
@@ -125,21 +144,22 @@ static char *get_property(const u16 *property)
 static int setup(const efi_handle_t img_handle,
 		 const struct efi_system_table *systable)
 {
-	efi_uintn_t i;
+	void *acpi;

+	systemtab = systable;
 	boottime = systable->boottime;

-	/* Find configuration tables */
-	for (i = 0; i < systable->nr_tables; ++i) {
-		if (!efi_st_memcmp(&systable->tables[i].guid, &fdt_guid,
-				   sizeof(efi_guid_t)))
-			fdt = systable->tables[i].table;
-	}
+	acpi = efi_st_get_config_table(&acpi_guid);
+	fdt = efi_st_get_config_table(&fdt_guid);
+
 	if (!fdt) {
 		efi_st_error("Missing device tree\n");
 		return EFI_ST_FAILURE;
 	}
-
+	if (acpi) {
+		efi_st_error("Found ACPI table and device tree\n");
+		return EFI_ST_FAILURE;
+	}
 	return EFI_ST_SUCCESS;
 }

@@ -183,5 +203,4 @@ EFI_UNIT_TEST(fdt) = {
 	.phase = EFI_EXECUTE_BEFORE_BOOTTIME_EXIT,
 	.setup = setup,
 	.execute = execute,
-	.on_request = true,
 };
diff --git a/test/py/tests/test_efi_selftest.py b/test/py/tests/test_efi_selftest.py
index bc226a8e63..07e4db0452 100644
--- a/test/py/tests/test_efi_selftest.py
+++ b/test/py/tests/test_efi_selftest.py
@@ -15,7 +15,7 @@ def test_efi_selftest(u_boot_console):
 	This function executes all selftests that are not marked as on request.
 	"""
 	u_boot_console.run_command(cmd='setenv efi_selftest')
-	u_boot_console.run_command(cmd='bootefi selftest ${fdtcontroladdr}', wait_for_prompt=False)
+	u_boot_console.run_command(cmd='bootefi selftest', wait_for_prompt=False)
 	m = u_boot_console.p.expect(['Summary: 0 failures', 'Press any key'])
 	if m != 0:
 		raise Exception('Failures occurred during the EFI selftest')
@@ -27,6 +27,7 @@ def test_efi_selftest(u_boot_console):

 @pytest.mark.buildconfigspec('cmd_bootefi_selftest')
 @pytest.mark.buildconfigspec('of_control')
+ at pytest.mark.notbuildconfigspec('generate_acpi_table')
 def test_efi_selftest_device_tree(u_boot_console):
 	u_boot_console.run_command(cmd='setenv efi_selftest list')
 	output = u_boot_console.run_command('bootefi selftest')
--
2.20.1



More information about the U-Boot mailing list