[PATCH 3/3] cmd: efi: efidebug print ECPT table

Jose Marinho Jose.Marinho at arm.com
Thu Dec 23 15:59:09 CET 2021


Hi Heinrich,

I dropped the ECPT print in efidebug in PATCH v2. Additionally I've introduced an efi selftet.

Regards,

Jose

> -----Original Message-----
> From: Heinrich Schuchardt <xypron.glpk at gmx.de>
> Sent: 17 December 2021 18:07
> To: Jose Marinho <Jose.Marinho at arm.com>; u-boot at lists.denx.de
> Cc: ilias.apalodimas at linaro.org; sughosh.ganu at linaro.org;
> takahiro.akashi at linaro.org; agraf at csgraf.de; nd <nd at arm.com>
> Subject: Re: [PATCH 3/3] cmd: efi: efidebug print ECPT table
> 
> On 12/17/21 13:55, Jose Marinho wrote:
> > Signed-off-by: Jose Marinho <jose.marinho at 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[];
> 
> Our interest is to keep the U-Boot binary size small. I see no need to print the
> ECPT table.
> 
> What make more sense is a unit test that checks the consistency of the table.
> 
> Best regards
> 
> Heinrich


More information about the U-Boot mailing list