Signed-off-by: Jose Marinho <jose.mari...@arm.com>
---
 cmd/efidebug.c       | 41 +++++++++++++++++++++++++++++++++++++++++
 include/efi_loader.h |  2 ++
 2 files changed, 43 insertions(+)

diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index a53a5029fa..c3246e1820 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -889,6 +889,38 @@ static int do_efi_show_tables(struct cmd_tbl *cmdtp, int 
flag,
        return CMD_RET_SUCCESS;
 }
 
+#ifdef CONFIG_EFI_ECPT
+static int do_efi_ecpt(struct cmd_tbl *cmdtp, int flag,
+                      int argc, char * const argv[])
+{
+       struct efi_conformance_profiles_table *ecpt;
+
+       if (argc != 1)
+               return CMD_RET_USAGE;
+
+       for (int idx = 0; idx < systab.nr_tables; idx++)
+               if (!guidcmp(&efi_ecpt_guid, &systab.tables[idx].guid))
+                       ecpt = (struct efi_system_resource_table 
*)systab.tables[idx].table;
+
+       if (!ecpt) {
+               log_info("ECPT: table not present\n");
+               return CMD_RET_SUCCESS;
+       }
+
+       const int num_profiles = ecpt->number_of_profiles;
+
+       printf("========================================\n");
+       printf("ECPT: version:%d\n", ecpt->version);
+       printf("ECPT: num profiles:%d\n", num_profiles);
+
+       for (int i = 0; i < num_profiles; i++)
+               printf("ECPT: profile %d = %pUL\n", i, 
&ecpt->conformance_profiles[i]);
+       printf("========================================\n");
+
+       return CMD_RET_SUCCESS;
+}
+#endif /* CONFIG_EFI_ECPT */
+
 /**
  * create_initrd_dp() - Create a special device for our Boot### option
  *
@@ -1681,6 +1713,11 @@ static struct cmd_tbl cmd_efidebug_sub[] = {
                         "", ""),
        U_BOOT_CMD_MKENT(query, CONFIG_SYS_MAXARGS, 1, do_efi_query_info,
                         "", ""),
+#ifdef CONFIG_EFI_ECPT
+       U_BOOT_CMD_MKENT(ecpt, CONFIG_SYS_MAXARGS, 1, do_efi_ecpt,
+                        "", ""),
+#endif
+
 };
 
 /**
@@ -1769,6 +1806,10 @@ static char efidebug_help_text[] =
        "  - show UEFI memory map\n"
        "efidebug tables\n"
        "  - show UEFI configuration tables\n"
+#ifdef CONFIG_EFI_ECPT
+       "efidebug ecpt\n"
+       "  - show UEFI conformance profiles table\n"
+#endif
 #ifdef CONFIG_CMD_BOOTEFI_BOOTMGR
        "efidebug test bootmgr\n"
        "  - run simple bootmgr for test\n"
diff --git a/include/efi_loader.h b/include/efi_loader.h
index d20ff396d0..d60a340136 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -310,6 +310,8 @@ extern const efi_guid_t 
efi_guid_firmware_management_protocol;
 extern const efi_guid_t efi_esrt_guid;
 /* GUID of the SMBIOS table */
 extern const efi_guid_t smbios_guid;
+/* GUID for the ECPT */
+extern const efi_guid_t efi_ecpt_guid;
 
 extern char __efi_runtime_start[], __efi_runtime_stop[];
 extern char __efi_runtime_rel_start[], __efi_runtime_rel_stop[];
-- 
2.25.1

Reply via email to