Skip to contentSkip to conversation

Add an efidebug ecpt command

PATCH Superseded Vincent Stehlé 4 participants 22 messages Mar 5 – Mar 11

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Add an efidebug ecpt command

Hi,

This patch series adds an "efidebug ecpt" command to list the conformance profiles and a python unit test.

This should help verification when we will add more conformance profiles.

Best regards,
Vincent.

Vincent Stehlé (4):
lib: uuid: add EBBR 2.1 conformance profile GUID
efi_loader: export efi_ecpt_guid
cmd: efidebug: add ecpt command
test/py: add ECPT tests

 cmd/efidebug.c                   | 49 ++++++++++++++++++++++++++++++++
 include/efi_loader.h             |  4 +++
 lib/efi_loader/efi_conformance.c |  2 +-
 lib/uuid.c                       |  4 +++
 test/py/tests/test_efi_ecpt.py   | 42 +++++++++++++++++++++++++++
 5 files changed, 100 insertions(+), 1 deletion(-)
 create mode 100644 test/py/tests/test_efi_ecpt.py
Signature · 1 line
2.51.0
#1 lore raw

PATCH 1/4 lib: uuid: add EBBR 2.1 conformance profile GUID

Add support for printing the EFI_CONFORMANCE_PROFILE_EBBR_2_1_GUID as human readable text.

This is added in the GUIDs range, which is compiled in only when CONFIG_CMD_EFIDEBUG is set.

---
 lib/uuid.c | 4 ++++
 1 file changed, 4 insertions(+)
lib/uuid.c +4 -0
index 0a166320e07..d9d5414d4bf 100644
@@ -254,6 +254,10 @@ static const struct {
 		NULL, "EFI Conformance Profiles Table",
 		EFI_CONFORMANCE_PROFILES_TABLE_GUID,
 	},
+	{
+		NULL, "EFI EBBR 2.1 Conformance Profile",
+		EFI_CONFORMANCE_PROFILE_EBBR_2_1_GUID,
+	},
 #ifdef CONFIG_EFI_RISCV_BOOT_PROTOCOL
 	{
 		NULL, "RISC-V Boot",
Signature · 1 line
2.51.0
#2 lore raw

Re: [PATCH 1/4] lib: uuid: add EBBR 2.1 conformance profile GUID

Quoted 17 lines · Vincent Stehlé

Add support for printing the EFI_CONFORMANCE_PROFILE_EBBR_2_1_GUID as human readable text.

This is added in the GUIDs range, which is compiled in only when CONFIG_CMD_EFIDEBUG is set.

---
  lib/uuid.c | 4 ++++
  1 file changed, 4 insertions(+)
lib/uuid.c +0 -0
index 0a166320e07..d9d5414d4bf 100644

lib/uuid.c static const struct { · line 256

Quoted 3 lines
lib/uuid.c +0 -0
@@ -254,6 +254,10 @@ static const struct {
  		NULL, "EFI Conformance Profiles Table",
  		EFI_CONFORMANCE_PROFILES_TABLE_GUID,
  	},

Some boards have tight binary size restrictions.

If CONFIG_EFI_ECPT=n, we don't need the GUID text. I would suggest to hide it behind an #ifdef.

Best regards

Heinrich

Quoted 7 lines
lib/uuid.c +4 -0
+	{
+		NULL, "EFI EBBR 2.1 Conformance Profile",
+		EFI_CONFORMANCE_PROFILE_EBBR_2_1_GUID,
+	},
  #ifdef CONFIG_EFI_RISCV_BOOT_PROTOCOL
  	{
  		NULL, "RISC-V Boot",
#3 lore raw

Re: [PATCH 1/4] lib: uuid: add EBBR 2.1 conformance profile GUID

On Mon, Mar 09, 2026 at 01:19:32PM +0100, Heinrich Schuchardt wrote:

Hi Heinrich,

Thanks for your review; I will modify as per your suggestion and send a v2.

Best regards,
Vincent.

Quoted 39 lines · Vincent Stehlé
Quoted 17 lines

Add support for printing the EFI_CONFORMANCE_PROFILE_EBBR_2_1_GUID as human readable text.

This is added in the GUIDs range, which is compiled in only when CONFIG_CMD_EFIDEBUG is set.

---
  lib/uuid.c | 4 ++++
  1 file changed, 4 insertions(+)
lib/uuid.c +0 -0
index 0a166320e07..d9d5414d4bf 100644

lib/uuid.c static const struct { · line 256

Quoted 3 lines
lib/uuid.c +0 -0
@@ -254,6 +254,10 @@ static const struct {
  		NULL, "EFI Conformance Profiles Table",
  		EFI_CONFORMANCE_PROFILES_TABLE_GUID,
  	},

Some boards have tight binary size restrictions.

If CONFIG_EFI_ECPT=n, we don't need the GUID text. I would suggest to hide it behind an #ifdef.

Best regards

Heinrich

Quoted 7 lines
lib/uuid.c +4 -0
+	{
+		NULL, "EFI EBBR 2.1 Conformance Profile",
+		EFI_CONFORMANCE_PROFILE_EBBR_2_1_GUID,
+	},
  #ifdef CONFIG_EFI_RISCV_BOOT_PROTOCOL
  	{
  		NULL, "RISC-V Boot",
#4 lore raw

PATCH 2/4 efi_loader: export efi_ecpt_guid

In reply to Vincent Stehlé

Export the ECPT GUID, to prepare accessing it from more than one location.

The C file containing the GUID is compiled only when CONFIG_EFI_ECPT is set; gate the export accordingly.

Cc Heinrich Schuchardt <[email protected]>
Cc Ilias Apalodimas <[email protected]>
Cc Tom Rini <[email protected]>
---
 include/efi_loader.h             | 4 ++++
 lib/efi_loader/efi_conformance.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
include/efi_loader.h +4 -0
index 3e70ac07055..0ebc80e0af0 100644
@@ -387,6 +387,10 @@ extern const efi_guid_t efi_guid_capsule_report;
 extern const efi_guid_t efi_guid_firmware_management_protocol;
 /* GUID for the ESRT */
 extern const efi_guid_t efi_esrt_guid;
+/* GUID for the ECPT */
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+extern const efi_guid_t efi_ecpt_guid;
+#endif
 /* GUID of the SMBIOS table */
 extern const efi_guid_t smbios_guid;
 extern const efi_guid_t smbios3_guid;
lib/efi_loader/efi_conformance.c +1 -1
index 2d31800ccb8..470141af483 100644
@@ -12,7 +12,7 @@
 #include <efi_api.h>
 #include <malloc.h>
 
-static const efi_guid_t efi_ecpt_guid = EFI_CONFORMANCE_PROFILES_TABLE_GUID;
+const efi_guid_t efi_ecpt_guid = EFI_CONFORMANCE_PROFILES_TABLE_GUID;
 
 /**
  * efi_ecpt_register() - Install the ECPT system table.
Signature · 1 line
2.51.0
Reviewed-by on v1 2/4
#5 lore raw

Re: [PATCH 2/4] efi_loader: export efi_ecpt_guid

Quoted 9 lines · Vincent Stehlé

Export the ECPT GUID, to prepare accessing it from more than one location.

The C file containing the GUID is compiled only when CONFIG_EFI_ECPT is set; gate the export accordingly.

Cc Heinrich Schuchardt <[email protected]>
Cc Ilias Apalodimas <[email protected]>
Cc Tom Rini <[email protected]>
Quoted 33 lines
---
  include/efi_loader.h             | 4 ++++
  lib/efi_loader/efi_conformance.c | 2 +-
  2 files changed, 5 insertions(+), 1 deletion(-)
include/efi_loader.h +4 -0
index 3e70ac07055..0ebc80e0af0 100644
@@ -387,6 +387,10 @@ extern const efi_guid_t efi_guid_capsule_report;
  extern const efi_guid_t efi_guid_firmware_management_protocol;
  /* GUID for the ESRT */
  extern const efi_guid_t efi_esrt_guid;
+/* GUID for the ECPT */
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+extern const efi_guid_t efi_ecpt_guid;
+#endif
  /* GUID of the SMBIOS table */
  extern const efi_guid_t smbios_guid;
  extern const efi_guid_t smbios3_guid;
lib/efi_loader/efi_conformance.c +1 -1
index 2d31800ccb8..470141af483 100644
@@ -12,7 +12,7 @@
  #include <efi_api.h>
  #include <malloc.h>
 
-static const efi_guid_t efi_ecpt_guid = EFI_CONFORMANCE_PROFILES_TABLE_GUID;
+const efi_guid_t efi_ecpt_guid = EFI_CONFORMANCE_PROFILES_TABLE_GUID;
 
  /**
   * efi_ecpt_register() - Install the ECPT system table.
#6 lore raw

PATCH 3/4 cmd: efidebug: add ecpt command

In reply to Vincent Stehlé

Add an "efidebug ecpt" command, to print the conformance profiles in the ECPT:

=> efidebug ecpt
cce33c35-74ac-4087-bce7-8b29b02eeb27 EFI EBBR 2.1 Conformance Profile

Cc Heinrich Schuchardt <[email protected]>
Cc Ilias Apalodimas <[email protected]>
Cc Tom Rini <[email protected]>
---
 cmd/efidebug.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
cmd/efidebug.c +49 -0
index 109496d9e95..672214a54b7 100644
@@ -533,6 +533,47 @@ static int do_efi_show_defaults(struct cmd_tbl *cmdtp, int flag,
 	return CMD_RET_SUCCESS;
 }
 
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+/**
+ * do_efi_show_ecpt() - show UEFI conformance profiles in ECPT
+ *
+ * @cmdtp:	Command table
+ * @flag:	Command flag
+ * @argc:	Number of arguments
+ * @argv:	Argument array
+ * Return:	CMD_RET_SUCCESS on success,
+ *		CMD_RET_USAGE or CMD_RET_FAILURE on failure
+ *
+ * Implement efidebug "ecpt" sub-command.
+ * Show all the UEFI Conformance Profiles listed in the EFI Conformance Profiles
+ * Table (ECPT).
+ */
+static int do_efi_show_ecpt(struct cmd_tbl *cmdtp, int flag, int argc,
+			    char *const argv[])
+{
+	const struct efi_conformance_profiles_table *ecpt;
+	u16 n;
+
+	if (argc != 1)
+		return CMD_RET_USAGE;
+
+	ecpt = efi_get_configuration_table(&efi_ecpt_guid);
+	if (!ecpt) {
+		log_info("ECPT: table not present\n");
+		return CMD_RET_SUCCESS;
+	}
+
+	for (n = 0; n < ecpt->number_of_profiles; n++) {
+		const efi_guid_t *guid = &ecpt->conformance_profiles[n];
+
+		printf("%pUl  %s\n", guid->b,
+		       uuid_guid_get_str(guid->b) ?: "(unknown)");
+	}
+
+	return CMD_RET_SUCCESS;
+}
+#endif /* CONFIG_IS_ENABLED(EFI_ECPT) */
+
 static const char * const efi_mem_type_string[] = {
 	[EFI_RESERVED_MEMORY_TYPE] = "RESERVED",
 	[EFI_LOADER_CODE] = "LOADER CODE",
@@ -1586,6 +1627,10 @@ static struct cmd_tbl cmd_efidebug_sub[] = {
 			 "", ""),
 	U_BOOT_CMD_MKENT(defaults, CONFIG_SYS_MAXARGS, 1, do_efi_show_defaults,
 			 "", ""),
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+	U_BOOT_CMD_MKENT(ecpt, CONFIG_SYS_MAXARGS, 1, do_efi_show_ecpt,
+			 "", ""),
+#endif
 	U_BOOT_CMD_MKENT(images, CONFIG_SYS_MAXARGS, 1, do_efi_show_images,
 			 "", ""),
 	U_BOOT_CMD_MKENT(memmap, CONFIG_SYS_MAXARGS, 1, do_efi_show_memmap,
@@ -1680,6 +1725,10 @@ U_BOOT_LONGHELP(efidebug,
 	"  - show UEFI handles\n"
 	"efidebug defaults\n"
 	"  - show default EFI filename and PXE architecture\n"
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+	"efidebug ecpt\n"
+	"  - show conformance profiles in the ECPT\n"
+#endif
 	"efidebug images\n"
 	"  - show loaded images\n"
 	"efidebug memmap\n"
Signature · 1 line
2.51.0
#7 lore raw

Re: [PATCH 3/4] cmd: efidebug: add ecpt command

Quoted 39 lines · Vincent Stehlé

Add an "efidebug ecpt" command, to print the conformance profiles in the ECPT:

=> efidebug ecpt
cce33c35-74ac-4087-bce7-8b29b02eeb27 EFI EBBR 2.1 Conformance Profile

Cc Heinrich Schuchardt <[email protected]>
Cc Ilias Apalodimas <[email protected]>
Cc Tom Rini <[email protected]>
---
  cmd/efidebug.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 49 insertions(+)
cmd/efidebug.c +17 -0
index 109496d9e95..672214a54b7 100644
@@ -533,6 +533,47 @@ static int do_efi_show_defaults(struct cmd_tbl *cmdtp, int flag,
  	return CMD_RET_SUCCESS;
  }
 
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+/**
+ * do_efi_show_ecpt() - show UEFI conformance profiles in ECPT
+ *
+ * @cmdtp:	Command table
+ * @flag:	Command flag
+ * @argc:	Number of arguments
+ * @argv:	Argument array
+ * Return:	CMD_RET_SUCCESS on success,
+ *		CMD_RET_USAGE or CMD_RET_FAILURE on failure
+ *
+ * Implement efidebug "ecpt" sub-command.
+ * Show all the UEFI Conformance Profiles listed in the EFI Conformance Profiles
+ * Table (ECPT).
+ */
+static int do_efi_show_ecpt(struct cmd_tbl *cmdtp, int flag, int argc,
+			    char *const argv[])

cmd/efidebug.c static int do_efi_show_defaults(struct cmd_tbl *cmdtp, int flag, · line 562

Quoted 10 lines
cmd/efidebug.c +10 -0
+{
+	const struct efi_conformance_profiles_table *ecpt;
+	u16 n;
+
+	if (argc != 1)
+		return CMD_RET_USAGE;
+
+	ecpt = efi_get_configuration_table(&efi_ecpt_guid);
+	if (!ecpt) {
+		log_info("ECPT: table not present\n");

This looks like an error situation. Should this be:

	log_err("ECPT table missing\n");

cmd/efidebug.c static int do_efi_show_defaults(struct cmd_tbl *cmdtp, int flag, · line 570

Quoted 8 lines
cmd/efidebug.c +8 -0
+		return CMD_RET_SUCCESS;
+	}
+
+	for (n = 0; n < ecpt->number_of_profiles; n++) {
+		const efi_guid_t *guid = &ecpt->conformance_profiles[n];
+
+		printf("%pUl  %s\n", guid->b,
+		       uuid_guid_get_str(guid->b) ?: "(unknown)");

Isn't the following enough:

	printf("%pUs\n");

%pUs: GUID text representation if known or fallback to %pUl

Best regards

Heinrich

Quoted 31 lines
cmd/efidebug.c +14 -0
+	}
+
+	return CMD_RET_SUCCESS;
+}
+#endif /* CONFIG_IS_ENABLED(EFI_ECPT) */
+
  static const char * const efi_mem_type_string[] = {
  	[EFI_RESERVED_MEMORY_TYPE] = "RESERVED",
  	[EFI_LOADER_CODE] = "LOADER CODE",
@@ -1586,6 +1627,10 @@ static struct cmd_tbl cmd_efidebug_sub[] = {
  			 "", ""),
  	U_BOOT_CMD_MKENT(defaults, CONFIG_SYS_MAXARGS, 1, do_efi_show_defaults,
  			 "", ""),
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+	U_BOOT_CMD_MKENT(ecpt, CONFIG_SYS_MAXARGS, 1, do_efi_show_ecpt,
+			 "", ""),
+#endif
  	U_BOOT_CMD_MKENT(images, CONFIG_SYS_MAXARGS, 1, do_efi_show_images,
  			 "", ""),
  	U_BOOT_CMD_MKENT(memmap, CONFIG_SYS_MAXARGS, 1, do_efi_show_memmap,
@@ -1680,6 +1725,10 @@ U_BOOT_LONGHELP(efidebug,
  	"  - show UEFI handles\n"
  	"efidebug defaults\n"
  	"  - show default EFI filename and PXE architecture\n"
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+	"efidebug ecpt\n"
+	"  - show conformance profiles in the ECPT\n"
+#endif
  	"efidebug images\n"
  	"  - show loaded images\n"
  	"efidebug memmap\n"
#8 lore raw

Re: [PATCH 3/4] cmd: efidebug: add ecpt command

On Mon, Mar 09, 2026 at 01:23:53PM +0100, Heinrich Schuchardt wrote:

Hi Heinrich,

Thanks for your review, I will send a v2 adding your first suggestion; more comments below.

Best regards,
Vincent.

Quoted 52 lines · Vincent Stehlé
Quoted 38 lines

Add an "efidebug ecpt" command, to print the conformance profiles in the ECPT:

=> efidebug ecpt
cce33c35-74ac-4087-bce7-8b29b02eeb27 EFI EBBR 2.1 Conformance Profile

Cc Heinrich Schuchardt <[email protected]>
Cc Ilias Apalodimas <[email protected]>
Cc Tom Rini <[email protected]>
---
  cmd/efidebug.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 49 insertions(+)
cmd/efidebug.c +17 -0
index 109496d9e95..672214a54b7 100644
@@ -533,6 +533,47 @@ static int do_efi_show_defaults(struct cmd_tbl *cmdtp, int flag,
  	return CMD_RET_SUCCESS;
  }
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+/**
+ * do_efi_show_ecpt() - show UEFI conformance profiles in ECPT
+ *
+ * @cmdtp:	Command table
+ * @flag:	Command flag
+ * @argc:	Number of arguments
+ * @argv:	Argument array
+ * Return:	CMD_RET_SUCCESS on success,
+ *		CMD_RET_USAGE or CMD_RET_FAILURE on failure
+ *
+ * Implement efidebug "ecpt" sub-command.
+ * Show all the UEFI Conformance Profiles listed in the EFI Conformance Profiles
+ * Table (ECPT).
+ */
+static int do_efi_show_ecpt(struct cmd_tbl *cmdtp, int flag, int argc,
+			    char *const argv[])

cmd/efidebug.c static int do_efi_show_defaults(struct cmd_tbl *cmdtp, int flag, · line 561

Quoted 10 lines
cmd/efidebug.c +10 -0
+{
+	const struct efi_conformance_profiles_table *ecpt;
+	u16 n;
+
+	if (argc != 1)
+		return CMD_RET_USAGE;
+
+	ecpt = efi_get_configuration_table(&efi_ecpt_guid);
+	if (!ecpt) {
+		log_info("ECPT: table not present\n");

This looks like an error situation. Should this be:

Quoted 1 line
	log_err("ECPT table missing\n");

Ok, I will change this as you suggest and send a v2, returning CMD_RET_FAILURE, then.

Note that I did hesitate and finally opted to replicate what do_efi_capsule_esrt() was doing, but I think reporting an error as you suggest makes more sense as we know that we should have an ECPT when CONFIG_EFI_ECPT=y.

Quoted 12 lines

cmd/efidebug.c static int do_efi_show_defaults(struct cmd_tbl *cmdtp, int flag, · line 570

Quoted 9 lines
cmd/efidebug.c +8 -0
+		return CMD_RET_SUCCESS;
+	}
+
+	for (n = 0; n < ecpt->number_of_profiles; n++) {
+		const efi_guid_t *guid = &ecpt->conformance_profiles[n];
+
+		printf("%pUl  %s\n", guid->b,
+		       uuid_guid_get_str(guid->b) ?: "(unknown)");

Isn't the following enough:

Quoted 3 lines
	printf("%pUs\n");

%pUs: GUID text representation if known or fallback to %pUl

For this printing change I am not so sure; this is inspired from efi_show_tables()'s behaviour and the intention is to have the following outputs, depending on whether we know the GUID or not:

     cce33c35-74ac-4087-bce7-8b29b02eeb27  EFI EBBR 2.1 Conformance Profile

or cce33c35-74ac-4087-bce7-8b29b02eeb27 (unknown)

With the change you suggest, we would have:

EFI EBBR 2.1 Conformance Profile
or cce33c35-74ac-4087-bce7-8b29b02eeb27

I think I prefer the original solution, as it more in line with `efidebug tables' and it always shows the GUID in numerical form, but let me know if you insist, in which case I will send a v3 with this change as well.

Quoted 37 lines

Best regards

Heinrich

Quoted 31 lines
cmd/efidebug.c +14 -0
+	}
+
+	return CMD_RET_SUCCESS;
+}
+#endif /* CONFIG_IS_ENABLED(EFI_ECPT) */
+
  static const char * const efi_mem_type_string[] = {
  	[EFI_RESERVED_MEMORY_TYPE] = "RESERVED",
  	[EFI_LOADER_CODE] = "LOADER CODE",
@@ -1586,6 +1627,10 @@ static struct cmd_tbl cmd_efidebug_sub[] = {
  			 "", ""),
  	U_BOOT_CMD_MKENT(defaults, CONFIG_SYS_MAXARGS, 1, do_efi_show_defaults,
  			 "", ""),
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+	U_BOOT_CMD_MKENT(ecpt, CONFIG_SYS_MAXARGS, 1, do_efi_show_ecpt,
+			 "", ""),
+#endif
  	U_BOOT_CMD_MKENT(images, CONFIG_SYS_MAXARGS, 1, do_efi_show_images,
  			 "", ""),
  	U_BOOT_CMD_MKENT(memmap, CONFIG_SYS_MAXARGS, 1, do_efi_show_memmap,
@@ -1680,6 +1725,10 @@ U_BOOT_LONGHELP(efidebug,
  	"  - show UEFI handles\n"
  	"efidebug defaults\n"
  	"  - show default EFI filename and PXE architecture\n"
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+	"efidebug ecpt\n"
+	"  - show conformance profiles in the ECPT\n"
+#endif
  	"efidebug images\n"
  	"  - show loaded images\n"
  	"efidebug memmap\n"
#9 lore raw

PATCH 4/4 test/py: add ECPT tests

In reply to Vincent Stehlé

Add a couple of EFI Conformance Profiles Table (ECPT) tests, which exercise the "efidebug ecpt" command.

Cc Tom Rini <[email protected]>
Cc Heinrich Schuchardt <[email protected]>
Cc Ilias Apalodimas <[email protected]>
---
 test/py/tests/test_efi_ecpt.py | 42 ++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 test/py/tests/test_efi_ecpt.py
test/py/tests/test_efi_ecpt.py new file +42 -0
new file mode 100644
index 00000000000..5e7c79c4577
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+""" Unit test for the EFI Conformance Profiles Table (ECPT)
+"""
+
+import pytest
+
+
[email protected]('cmd_efidebug')
[email protected]('efi_ecpt')
+def test_efi_ecpt(ubman) -> None:
+    """ Unit test for the ECPT
+    This test assumes nothing about the ECPT contents, it just checks that the
+    ECPT table is there and that the efidebug ecpt command does not fail.
+
+    Args:
+        ubman -- U-Boot console
+    """
+    response = ubman.run_command('efidebug tables')
+    assert ('36122546-f7e7-4c8f-bd9b-eb8525b50c0b  '
+            'EFI Conformance Profiles Table') in response
+
+    response = ubman.run_command('efidebug ecpt')
+    assert 'Unknown command' not in response
+    assert 'Configure UEFI environment' not in response
+    assert 'Usage:' not in response
+    assert 'table not present' not in response
+
+
[email protected]('cmd_efidebug')
[email protected]('efi_ecpt')
[email protected]('efi_ebbr_2_1_conformance')
+def test_efi_ecpt_ebbr_2_1(ubman) -> None:
+    """ Unit test for the ECPT, with EBBR 2.1 profile
+    This test uses the efidebug ecpt command to dump the ECPT and check that
+    the EBBR 2.1 conformance profile is there.
+
+    Args:
+        ubman -- U-Boot console
+    """
+    response = ubman.run_command('efidebug ecpt')
+    assert ('cce33c35-74ac-4087-bce7-8b29b02eeb27  '
+            'EFI EBBR 2.1 Conformance Profile') in response
Signature · 1 line
2.51.0
#10 lore raw

Re: [PATCH 4/4] test/py: add ECPT tests

Quoted 38 lines · Vincent Stehlé

Add a couple of EFI Conformance Profiles Table (ECPT) tests, which exercise the "efidebug ecpt" command.

Cc Tom Rini <[email protected]>
Cc Heinrich Schuchardt <[email protected]>
Cc Ilias Apalodimas <[email protected]>
---
  test/py/tests/test_efi_ecpt.py | 42 ++++++++++++++++++++++++++++++++++
  1 file changed, 42 insertions(+)

create mode 100644 test/py/tests/test_efi_ecpt.py

test/py/tests/test_efi_ecpt.py new file +20 -0
new file mode 100644
index 00000000000..5e7c79c4577
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+""" Unit test for the EFI Conformance Profiles Table (ECPT)
+"""
+
+import pytest
+
+
[email protected]('cmd_efidebug')
[email protected]('efi_ecpt')
+def test_efi_ecpt(ubman) -> None:
+    """ Unit test for the ECPT
+    This test assumes nothing about the ECPT contents, it just checks that the
+    ECPT table is there and that the efidebug ecpt command does not fail.
+
+    Args:
+        ubman -- U-Boot console
+    """
+    response = ubman.run_command('efidebug tables')
+    assert ('36122546-f7e7-4c8f-bd9b-eb8525b50c0b  '
+            'EFI Conformance Profiles Table') in response

test/py/tests/test_efi_ecpt.py line 30

Quoted 10 lines
test/py/tests/test_efi_ecpt.py new file +10 -0
+
+    response = ubman.run_command('efidebug ecpt')
+    assert 'Unknown command' not in response
+    assert 'Configure UEFI environment' not in response
+    assert 'Usage:' not in response
+    assert 'table not present' not in response
+
+
[email protected]('cmd_efidebug')
[email protected]('efi_ecpt')

EFI_EBBR_2_1_CONFORMANCE depends on EFI_ECPT.

Given the next line the line above is redundant.

test/py/tests/test_efi_ecpt.py line 31

Quoted 1 line
test/py/tests/test_efi_ecpt.py new file +1 -0
[email protected]('efi_ebbr_2_1_conformance')

If CONFIG_EFI_ECPT=y and CONFIG_EFI_EBBR_2_1_CONFORMANCE=n, we still expect the efidebug ecpt command to succeed.

I would suggest to move the CONFIG_EFI_EBBR_2_1_CONFORMANCE check to inside the test. This also matches that the EBBR defines more conformance levels which we should add to the ECPT table.

test/py/tests/test_efi_ecpt.py line 42

Quoted 11 lines
test/py/tests/test_efi_ecpt.py new file +11 -0
+def test_efi_ecpt_ebbr_2_1(ubman) -> None:
+    """ Unit test for the ECPT, with EBBR 2.1 profile
+    This test uses the efidebug ecpt command to dump the ECPT and check that
+    the EBBR 2.1 conformance profile is there.
+
+    Args:
+        ubman -- U-Boot console
+    """
+    response = ubman.run_command('efidebug ecpt')
+    assert ('cce33c35-74ac-4087-bce7-8b29b02eeb27  '
+            'EFI EBBR 2.1 Conformance Profile') in response

I don't think that printing out the GUID in hexadecimal is helpful for users. But that would be a change in 3/4.

Best regards

Heinrich

#11 lore raw

PATCH v2 1/4 lib: uuid: add EBBR 2.1 conformance profile GUID

In reply to Vincent Stehlé

Add support for printing the EFI_CONFORMANCE_PROFILE_EBBR_2_1_GUID as human readable text.

This is compiled in only when CONFIG_CMD_EFIDEBUG and CONFIG_EFI_EPCT are set.

---

Changes in v2:
- Gate with CONFIG_EFI_ECPT (suggested by Heinrich)

 lib/uuid.c | 6 ++++++
 1 file changed, 6 insertions(+)
lib/uuid.c +6 -0
index 0a166320e07..3a666d0430d 100644
@@ -254,6 +254,12 @@ static const struct {
 		NULL, "EFI Conformance Profiles Table",
 		EFI_CONFORMANCE_PROFILES_TABLE_GUID,
 	},
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+	{
+		NULL, "EFI EBBR 2.1 Conformance Profile",
+		EFI_CONFORMANCE_PROFILE_EBBR_2_1_GUID,
+	},
+#endif
 #ifdef CONFIG_EFI_RISCV_BOOT_PROTOCOL
 	{
 		NULL, "RISC-V Boot",
Signature · 1 line
2.53.0
Reviewed-by on v2 1/4
#12 lore raw

Re: [PATCH v2 1/4] lib: uuid: add EBBR 2.1 conformance profile GUID

Quoted 9 lines · Vincent Stehlé

Add support for printing the EFI_CONFORMANCE_PROFILE_EBBR_2_1_GUID as human readable text.

This is compiled in only when CONFIG_CMD_EFIDEBUG and CONFIG_EFI_EPCT are set.

Quoted 25 lines

---

Changes in v2:
- Gate with CONFIG_EFI_ECPT (suggested by Heinrich)

  lib/uuid.c | 6 ++++++
  1 file changed, 6 insertions(+)
lib/uuid.c +6 -0
index 0a166320e07..3a666d0430d 100644
@@ -254,6 +254,12 @@ static const struct {
  		NULL, "EFI Conformance Profiles Table",
  		EFI_CONFORMANCE_PROFILES_TABLE_GUID,
  	},
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+	{
+		NULL, "EFI EBBR 2.1 Conformance Profile",
+		EFI_CONFORMANCE_PROFILE_EBBR_2_1_GUID,
+	},
+#endif
  #ifdef CONFIG_EFI_RISCV_BOOT_PROTOCOL
  	{
  		NULL, "RISC-V Boot",
Reviewed-by on v2 1/4
#13 lore raw

Re: [PATCH v2 1/4] lib: uuid: add EBBR 2.1 conformance profile GUID

In reply to Vincent Stehlé
Quoted 11 lines · Vincent Stehlé

Add support for printing the EFI_CONFORMANCE_PROFILE_EBBR_2_1_GUID as human readable text.

This is compiled in only when CONFIG_CMD_EFIDEBUG and CONFIG_EFI_EPCT are set.

---

Quoted 27 lines

Changes in v2:
- Gate with CONFIG_EFI_ECPT (suggested by Heinrich)

 lib/uuid.c | 6 ++++++
 1 file changed, 6 insertions(+)
lib/uuid.c +6 -1
index 0a166320e07..3a666d0430d 100644
@@ -254,6 +254,12 @@ static const struct {
                NULL, "EFI Conformance Profiles Table",
                EFI_CONFORMANCE_PROFILES_TABLE_GUID,
        },
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+       {
+               NULL, "EFI EBBR 2.1 Conformance Profile",
+               EFI_CONFORMANCE_PROFILE_EBBR_2_1_GUID,
+       },
+#endif
 #ifdef CONFIG_EFI_RISCV_BOOT_PROTOCOL
        {
                NULL, "RISC-V Boot",
--

2.53.0

#14 lore raw

PATCH v2 2/4 efi_loader: export efi_ecpt_guid

In reply to Vincent Stehlé

Export the ECPT GUID, to prepare accessing it from more than one location.

The C file containing the GUID is compiled only when CONFIG_EFI_ECPT is set; gate the export accordingly.

Cc Heinrich Schuchardt <[email protected]>
Cc Ilias Apalodimas <[email protected]>
Cc Tom Rini <[email protected]>

---

(No change in v2; re-sending in the series for consistency only.)

 include/efi_loader.h             | 4 ++++
 lib/efi_loader/efi_conformance.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
include/efi_loader.h +4 -0
index 3e70ac07055..0ebc80e0af0 100644
@@ -387,6 +387,10 @@ extern const efi_guid_t efi_guid_capsule_report;
 extern const efi_guid_t efi_guid_firmware_management_protocol;
 /* GUID for the ESRT */
 extern const efi_guid_t efi_esrt_guid;
+/* GUID for the ECPT */
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+extern const efi_guid_t efi_ecpt_guid;
+#endif
 /* GUID of the SMBIOS table */
 extern const efi_guid_t smbios_guid;
 extern const efi_guid_t smbios3_guid;
lib/efi_loader/efi_conformance.c +1 -1
index 2d31800ccb8..470141af483 100644
@@ -12,7 +12,7 @@
 #include <efi_api.h>
 #include <malloc.h>
 
-static const efi_guid_t efi_ecpt_guid = EFI_CONFORMANCE_PROFILES_TABLE_GUID;
+const efi_guid_t efi_ecpt_guid = EFI_CONFORMANCE_PROFILES_TABLE_GUID;
 
 /**
  * efi_ecpt_register() - Install the ECPT system table.
Signature · 1 line
2.53.0
#15 lore raw

Re: [PATCH v2 2/4] efi_loader: export efi_ecpt_guid

Quoted 22 lines · Vincent Stehlé

Export the ECPT GUID, to prepare accessing it from more than one location.

The C file containing the GUID is compiled only when CONFIG_EFI_ECPT is set; gate the export accordingly.

Cc Heinrich Schuchardt <[email protected]>
Cc Ilias Apalodimas <[email protected]>
Cc Tom Rini <[email protected]>

---

(No change in v2; re-sending in the series for consistency only.)

  include/efi_loader.h             | 4 ++++
  lib/efi_loader/efi_conformance.c | 2 +-
  2 files changed, 5 insertions(+), 1 deletion(-)
include/efi_loader.h +0 -0
index 3e70ac07055..0ebc80e0af0 100644

include/efi_loader.h extern const efi_guid_t efi_guid_capsule_report; · line 391

Quoted 5 lines
include/efi_loader.h +2 -0
@@ -387,6 +387,10 @@ extern const efi_guid_t efi_guid_capsule_report;
  extern const efi_guid_t efi_guid_firmware_management_protocol;
  /* GUID for the ESRT */
  extern const efi_guid_t efi_esrt_guid;
+/* GUID for the ECPT */
+#if CONFIG_IS_ENABLED(EFI_ECPT)

This #if looks superfluous. The include should compile without it.

Best regards

Heinrich

Quoted 18 lines
include/efi_loader.h +2 -0
+extern const efi_guid_t efi_ecpt_guid;
+#endif
  /* GUID of the SMBIOS table */
  extern const efi_guid_t smbios_guid;
  extern const efi_guid_t smbios3_guid;
lib/efi_loader/efi_conformance.c +1 -1
index 2d31800ccb8..470141af483 100644
@@ -12,7 +12,7 @@
  #include <efi_api.h>
  #include <malloc.h>
 
-static const efi_guid_t efi_ecpt_guid = EFI_CONFORMANCE_PROFILES_TABLE_GUID;
+const efi_guid_t efi_ecpt_guid = EFI_CONFORMANCE_PROFILES_TABLE_GUID;
 
  /**
   * efi_ecpt_register() - Install the ECPT system table.
#16 lore raw

Re: [PATCH v2 2/4] efi_loader: export efi_ecpt_guid

On Mon, Mar 09, 2026 at 05:40:12PM +0100, Heinrich Schuchardt wrote:

Hi Heinrich,

Thanks for the review; my comments below.

Best regards,
Vincent.

Quoted 18 lines · Vincent Stehlé
Quoted 17 lines

Export the ECPT GUID, to prepare accessing it from more than one location.

The C file containing the GUID is compiled only when CONFIG_EFI_ECPT is set; gate the export accordingly.

Cc Heinrich Schuchardt <[email protected]>
Cc Ilias Apalodimas <[email protected]>
Cc Tom Rini <[email protected]>

---

(No change in v2; re-sending in the series for consistency only.)

  include/efi_loader.h             | 4 ++++
  lib/efi_loader/efi_conformance.c | 2 +-
  2 files changed, 5 insertions(+), 1 deletion(-)
Quoted 12 lines

include/efi_loader.h extern const efi_guid_t efi_guid_capsule_report; · line 391

Quoted 10 lines
include/efi_loader.h +2 -0
index 3e70ac07055..0ebc80e0af0 100644
@@ -387,6 +387,10 @@ extern const efi_guid_t efi_guid_capsule_report;
  extern const efi_guid_t efi_guid_firmware_management_protocol;
  /* GUID for the ESRT */
  extern const efi_guid_t efi_esrt_guid;
+/* GUID for the ECPT */
+#if CONFIG_IS_ENABLED(EFI_ECPT)

This #if looks superfluous. The include should compile without it.

This should compile indeed, but it will not always link as the efi_ecpt_guid symbol is defined in lib/efi_loader/efi_conformance.c, which is compiled only when CONFIG_EFI_ECPT is set.

I think gating the declaration serves two purposes here:

1. It should make the build fail at the point where the symbol is used, which should be -arguably- easier to debug than having it fail at link-time.
2. It kind of documents the fact that the symbol is available only when CONFIG_EFI_ECPT is set. This should avoid having to find the symbol in efi_conformance.c and having to look into the corresponding Makefile to have this information.

Besides, other symbols are already declared conditionally in efi_loader.h.

Anyway, if you insist I could send a v3 without the #if; just let me know.

Quoted 22 lines

Best regards

Heinrich

Quoted 16 lines
include/efi_loader.h +2 -0
+extern const efi_guid_t efi_ecpt_guid;
+#endif
  /* GUID of the SMBIOS table */
  extern const efi_guid_t smbios_guid;
  extern const efi_guid_t smbios3_guid;
lib/efi_loader/efi_conformance.c +1 -1
index 2d31800ccb8..470141af483 100644
@@ -12,7 +12,7 @@
  #include <efi_api.h>
  #include <malloc.h>
-static const efi_guid_t efi_ecpt_guid = EFI_CONFORMANCE_PROFILES_TABLE_GUID;
+const efi_guid_t efi_ecpt_guid = EFI_CONFORMANCE_PROFILES_TABLE_GUID;
  /**
   * efi_ecpt_register() - Install the ECPT system table.
Reviewed-by on v2 2/4
#17 lore raw

Re: [PATCH v2 2/4] efi_loader: export efi_ecpt_guid

In reply to Vincent Stehlé
Quoted 11 lines · Vincent Stehlé

Export the ECPT GUID, to prepare accessing it from more than one location.

The C file containing the GUID is compiled only when CONFIG_EFI_ECPT is set; gate the export accordingly.

Cc Heinrich Schuchardt <[email protected]>
Cc Ilias Apalodimas <[email protected]>
Cc Tom Rini <[email protected]>

---

Quoted 38 lines

(No change in v2; re-sending in the series for consistency only.)

 include/efi_loader.h             | 4 ++++
 lib/efi_loader/efi_conformance.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
include/efi_loader.h +4 -0
index 3e70ac07055..0ebc80e0af0 100644
@@ -387,6 +387,10 @@ extern const efi_guid_t efi_guid_capsule_report;
 extern const efi_guid_t efi_guid_firmware_management_protocol;
 /* GUID for the ESRT */
 extern const efi_guid_t efi_esrt_guid;
+/* GUID for the ECPT */
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+extern const efi_guid_t efi_ecpt_guid;
+#endif
 /* GUID of the SMBIOS table */
 extern const efi_guid_t smbios_guid;
 extern const efi_guid_t smbios3_guid;
lib/efi_loader/efi_conformance.c +1 -2
index 2d31800ccb8..470141af483 100644
@@ -12,7 +12,7 @@
 #include <efi_api.h>
 #include <malloc.h>
 
-static const efi_guid_t efi_ecpt_guid = EFI_CONFORMANCE_PROFILES_TABLE_GUID;
+const efi_guid_t efi_ecpt_guid = EFI_CONFORMANCE_PROFILES_TABLE_GUID;
 
 /**
  * efi_ecpt_register() - Install the ECPT system table.
--

2.53.0

#18 lore raw

PATCH v2 3/4 cmd: efidebug: add ecpt command

In reply to Vincent Stehlé

Add an "efidebug ecpt" command, to print the conformance profiles in the ECPT:

=> efidebug ecpt
cce33c35-74ac-4087-bce7-8b29b02eeb27 EFI EBBR 2.1 Conformance Profile

---

Changes in v2:
- Change log level to error and adapt the printed message (suggested by Heinrich)
- Also in that case, return an error code

 cmd/efidebug.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
cmd/efidebug.c +49 -0
index 109496d9e95..7b733119c82 100644
@@ -533,6 +533,47 @@ static int do_efi_show_defaults(struct cmd_tbl *cmdtp, int flag,
 	return CMD_RET_SUCCESS;
 }
 
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+/**
+ * do_efi_show_ecpt() - show UEFI conformance profiles in ECPT
+ *
+ * @cmdtp:	Command table
+ * @flag:	Command flag
+ * @argc:	Number of arguments
+ * @argv:	Argument array
+ * Return:	CMD_RET_SUCCESS on success,
+ *		CMD_RET_USAGE or CMD_RET_FAILURE on failure
+ *
+ * Implement efidebug "ecpt" sub-command.
+ * Show all the UEFI Conformance Profiles listed in the EFI Conformance Profiles
+ * Table (ECPT).
+ */
+static int do_efi_show_ecpt(struct cmd_tbl *cmdtp, int flag, int argc,
+			    char *const argv[])
+{
+	const struct efi_conformance_profiles_table *ecpt;
+	u16 n;
+
+	if (argc != 1)
+		return CMD_RET_USAGE;
+
+	ecpt = efi_get_configuration_table(&efi_ecpt_guid);
+	if (!ecpt) {
+		log_err("ECPT table missing\n");
+		return CMD_RET_FAILURE;
+	}
+
+	for (n = 0; n < ecpt->number_of_profiles; n++) {
+		const efi_guid_t *guid = &ecpt->conformance_profiles[n];
+
+		printf("%pUl  %s\n", guid->b,
+		       uuid_guid_get_str(guid->b) ?: "(unknown)");
+	}
+
+	return CMD_RET_SUCCESS;
+}
+#endif /* CONFIG_IS_ENABLED(EFI_ECPT) */
+
 static const char * const efi_mem_type_string[] = {
 	[EFI_RESERVED_MEMORY_TYPE] = "RESERVED",
 	[EFI_LOADER_CODE] = "LOADER CODE",
@@ -1586,6 +1627,10 @@ static struct cmd_tbl cmd_efidebug_sub[] = {
 			 "", ""),
 	U_BOOT_CMD_MKENT(defaults, CONFIG_SYS_MAXARGS, 1, do_efi_show_defaults,
 			 "", ""),
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+	U_BOOT_CMD_MKENT(ecpt, CONFIG_SYS_MAXARGS, 1, do_efi_show_ecpt,
+			 "", ""),
+#endif
 	U_BOOT_CMD_MKENT(images, CONFIG_SYS_MAXARGS, 1, do_efi_show_images,
 			 "", ""),
 	U_BOOT_CMD_MKENT(memmap, CONFIG_SYS_MAXARGS, 1, do_efi_show_memmap,
@@ -1680,6 +1725,10 @@ U_BOOT_LONGHELP(efidebug,
 	"  - show UEFI handles\n"
 	"efidebug defaults\n"
 	"  - show default EFI filename and PXE architecture\n"
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+	"efidebug ecpt\n"
+	"  - show conformance profiles in the ECPT\n"
+#endif
 	"efidebug images\n"
 	"  - show loaded images\n"
 	"efidebug memmap\n"
Signature · 1 line
2.53.0
Reviewed-by on v2 3/4
#19 lore raw

Re: [PATCH v2 3/4] cmd: efidebug: add ecpt command

Quoted 10 lines · Vincent Stehlé

Add an "efidebug ecpt" command, to print the conformance profiles in the ECPT:

=> efidebug ecpt
cce33c35-74ac-4087-bce7-8b29b02eeb27 EFI EBBR 2.1 Conformance Profile

Quoted 84 lines

---

Changes in v2:
- Change log level to error and adapt the printed message (suggested by Heinrich)
- Also in that case, return an error code

  cmd/efidebug.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
  1 file changed, 49 insertions(+)
cmd/efidebug.c +49 -0
index 109496d9e95..7b733119c82 100644
@@ -533,6 +533,47 @@ static int do_efi_show_defaults(struct cmd_tbl *cmdtp, int flag,
  	return CMD_RET_SUCCESS;
  }
 
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+/**
+ * do_efi_show_ecpt() - show UEFI conformance profiles in ECPT
+ *
+ * @cmdtp:	Command table
+ * @flag:	Command flag
+ * @argc:	Number of arguments
+ * @argv:	Argument array
+ * Return:	CMD_RET_SUCCESS on success,
+ *		CMD_RET_USAGE or CMD_RET_FAILURE on failure
+ *
+ * Implement efidebug "ecpt" sub-command.
+ * Show all the UEFI Conformance Profiles listed in the EFI Conformance Profiles
+ * Table (ECPT).
+ */
+static int do_efi_show_ecpt(struct cmd_tbl *cmdtp, int flag, int argc,
+			    char *const argv[])
+{
+	const struct efi_conformance_profiles_table *ecpt;
+	u16 n;
+
+	if (argc != 1)
+		return CMD_RET_USAGE;
+
+	ecpt = efi_get_configuration_table(&efi_ecpt_guid);
+	if (!ecpt) {
+		log_err("ECPT table missing\n");
+		return CMD_RET_FAILURE;
+	}
+
+	for (n = 0; n < ecpt->number_of_profiles; n++) {
+		const efi_guid_t *guid = &ecpt->conformance_profiles[n];
+
+		printf("%pUl  %s\n", guid->b,
+		       uuid_guid_get_str(guid->b) ?: "(unknown)");
+	}
+
+	return CMD_RET_SUCCESS;
+}
+#endif /* CONFIG_IS_ENABLED(EFI_ECPT) */
+
  static const char * const efi_mem_type_string[] = {
  	[EFI_RESERVED_MEMORY_TYPE] = "RESERVED",
  	[EFI_LOADER_CODE] = "LOADER CODE",
@@ -1586,6 +1627,10 @@ static struct cmd_tbl cmd_efidebug_sub[] = {
  			 "", ""),
  	U_BOOT_CMD_MKENT(defaults, CONFIG_SYS_MAXARGS, 1, do_efi_show_defaults,
  			 "", ""),
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+	U_BOOT_CMD_MKENT(ecpt, CONFIG_SYS_MAXARGS, 1, do_efi_show_ecpt,
+			 "", ""),
+#endif
  	U_BOOT_CMD_MKENT(images, CONFIG_SYS_MAXARGS, 1, do_efi_show_images,
  			 "", ""),
  	U_BOOT_CMD_MKENT(memmap, CONFIG_SYS_MAXARGS, 1, do_efi_show_memmap,
@@ -1680,6 +1725,10 @@ U_BOOT_LONGHELP(efidebug,
  	"  - show UEFI handles\n"
  	"efidebug defaults\n"
  	"  - show default EFI filename and PXE architecture\n"
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+	"efidebug ecpt\n"
+	"  - show conformance profiles in the ECPT\n"
+#endif
  	"efidebug images\n"
  	"  - show loaded images\n"
  	"efidebug memmap\n"
Acked-by on v2 3/4
#20 lore raw

Re: [PATCH v2 3/4] cmd: efidebug: add ecpt command

In reply to Vincent Stehlé
Quoted 13 lines · Vincent Stehlé

Add an "efidebug ecpt" command, to print the conformance profiles in the ECPT:

=> efidebug ecpt
cce33c35-74ac-4087-bce7-8b29b02eeb27 EFI EBBR 2.1 Conformance Profile

---

Quoted 8 lines

Changes in v2:
- Change log level to error and adapt the printed message (suggested by Heinrich)
- Also in that case, return an error code

 cmd/efidebug.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
Quoted 77 lines
cmd/efidebug.c +49 -1
index 109496d9e95..7b733119c82 100644
@@ -533,6 +533,47 @@ static int do_efi_show_defaults(struct cmd_tbl *cmdtp, int flag,
        return CMD_RET_SUCCESS;
 }
 
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+/**
+ * do_efi_show_ecpt() - show UEFI conformance profiles in ECPT
+ *
+ * @cmdtp:     Command table
+ * @flag:      Command flag
+ * @argc:      Number of arguments
+ * @argv:      Argument array
+ * Return:     CMD_RET_SUCCESS on success,
+ *             CMD_RET_USAGE or CMD_RET_FAILURE on failure
+ *
+ * Implement efidebug "ecpt" sub-command.
+ * Show all the UEFI Conformance Profiles listed in the EFI Conformance Profiles
+ * Table (ECPT).
+ */
+static int do_efi_show_ecpt(struct cmd_tbl *cmdtp, int flag, int argc,
+                           char *const argv[])
+{
+       const struct efi_conformance_profiles_table *ecpt;
+       u16 n;
+
+       if (argc != 1)
+               return CMD_RET_USAGE;
+
+       ecpt = efi_get_configuration_table(&efi_ecpt_guid);
+       if (!ecpt) {
+               log_err("ECPT table missing\n");
+               return CMD_RET_FAILURE;
+       }
+
+       for (n = 0; n < ecpt->number_of_profiles; n++) {
+               const efi_guid_t *guid = &ecpt->conformance_profiles[n];
+
+               printf("%pUl  %s\n", guid->b,
+                      uuid_guid_get_str(guid->b) ?: "(unknown)");
+       }
+
+       return CMD_RET_SUCCESS;
+}
+#endif /* CONFIG_IS_ENABLED(EFI_ECPT) */
+
 static const char * const efi_mem_type_string[] = {
        [EFI_RESERVED_MEMORY_TYPE] = "RESERVED",
        [EFI_LOADER_CODE] = "LOADER CODE",
@@ -1586,6 +1627,10 @@ static struct cmd_tbl cmd_efidebug_sub[] = {
                         "", ""),
        U_BOOT_CMD_MKENT(defaults, CONFIG_SYS_MAXARGS, 1, do_efi_show_defaults,
                         "", ""),
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+       U_BOOT_CMD_MKENT(ecpt, CONFIG_SYS_MAXARGS, 1, do_efi_show_ecpt,
+                        "", ""),
+#endif
        U_BOOT_CMD_MKENT(images, CONFIG_SYS_MAXARGS, 1, do_efi_show_images,
                         "", ""),
        U_BOOT_CMD_MKENT(memmap, CONFIG_SYS_MAXARGS, 1, do_efi_show_memmap,
@@ -1680,6 +1725,10 @@ U_BOOT_LONGHELP(efidebug,
        "  - show UEFI handles\n"
        "efidebug defaults\n"
        "  - show default EFI filename and PXE architecture\n"
+#if CONFIG_IS_ENABLED(EFI_ECPT)
+       "efidebug ecpt\n"
+       "  - show conformance profiles in the ECPT\n"
+#endif
        "efidebug images\n"
        "  - show loaded images\n"
        "efidebug memmap\n"
--

2.53.0

#21 lore raw

PATCH v2 4/4 test/py: add ECPT tests

In reply to Vincent Stehlé

Add a couple of EFI Conformance Profiles Table (ECPT) tests, which exercise the "efidebug ecpt" command.

Cc Tom Rini <[email protected]>
Cc Heinrich Schuchardt <[email protected]>
Cc Ilias Apalodimas <[email protected]>

---

Changes in v2:
- Adapt to follow error message changes

 test/py/tests/test_efi_ecpt.py | 42 ++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 test/py/tests/test_efi_ecpt.py
test/py/tests/test_efi_ecpt.py new file +42 -0
new file mode 100644
index 00000000000..632a6b90bad
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+""" Unit test for the EFI Conformance Profiles Table (ECPT)
+"""
+
+import pytest
+
+
[email protected]('cmd_efidebug')
[email protected]('efi_ecpt')
+def test_efi_ecpt(ubman) -> None:
+    """ Unit test for the ECPT
+    This test assumes nothing about the ECPT contents, it just checks that the
+    ECPT table is there and that the efidebug ecpt command does not fail.
+
+    Args:
+        ubman -- U-Boot console
+    """
+    response = ubman.run_command('efidebug tables')
+    assert ('36122546-f7e7-4c8f-bd9b-eb8525b50c0b  '
+            'EFI Conformance Profiles Table') in response
+
+    response = ubman.run_command('efidebug ecpt')
+    assert 'Unknown command' not in response
+    assert 'Configure UEFI environment' not in response
+    assert 'Usage:' not in response
+    assert 'table missing' not in response
+
+
[email protected]('cmd_efidebug')
[email protected]('efi_ecpt')
[email protected]('efi_ebbr_2_1_conformance')
+def test_efi_ecpt_ebbr_2_1(ubman) -> None:
+    """ Unit test for the ECPT, with EBBR 2.1 profile
+    This test uses the efidebug ecpt command to dump the ECPT and check that
+    the EBBR 2.1 conformance profile is there.
+
+    Args:
+        ubman -- U-Boot console
+    """
+    response = ubman.run_command('efidebug ecpt')
+    assert ('cce33c35-74ac-4087-bce7-8b29b02eeb27  '
+            'EFI EBBR 2.1 Conformance Profile') in response
Signature · 1 line
2.53.0