All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: u-boot@lists.denx.de
Subject: [PATCH 4/6] cmd: efidebug: Add support for querying UEFI variable storage
Date: Sat, 9 May 2020 11:58:17 +0200	[thread overview]
Message-ID: <f3358d5f-5a1d-4f24-5f24-ca4b9e2f1a96@gmx.de> (raw)
In-Reply-To: <20200506191246.237790-5-ilias.apalodimas@linaro.org>

On 5/6/20 9:12 PM, Ilias Apalodimas wrote:
> With the previous patches that use OP-TEE and StandAloneMM for UEFI
> variable storage we've added functionality for efi_query_variable_info.
> So let's add the relevant command to efidebug and retrieve information
> about the container used to store UEFI variables
>
> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
> ---
>  cmd/efidebug.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 44 insertions(+), 1 deletion(-)
>
> diff --git a/cmd/efidebug.c b/cmd/efidebug.c
> index d8a76d78a388..17e36ef76d69 100644
> --- a/cmd/efidebug.c
> +++ b/cmd/efidebug.c
> @@ -1160,6 +1160,45 @@ static int do_efi_test(cmd_tbl_t *cmdtp, int flag,
>  	return cp->cmd(cmdtp, flag, argc, argv);
>  }
>
> +/**
> + * do_efi_query_info() - QueryVariableInfo EFI service
> + *
> + * @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 "test" sub-command.
> + */
> +
> +static int do_efi_query_info(cmd_tbl_t *cmdtp, int flag,
> +			     int argc, char * const argv[])
> +{
> +	efi_status_t ret;
> +	u32 attr = EFI_VARIABLE_BOOTSERVICE_ACCESS |
> +			EFI_VARIABLE_RUNTIME_ACCESS |
> +			EFI_VARIABLE_NON_VOLATILE;
> +	u64 max_variable_storage_size;
> +	u64 remain_variable_storage_size;
> +	u64 max_variable_size;
> +
> +	ret = EFI_CALL(efi_query_variable_info(attr,
> +					       &max_variable_storage_size,
> +					       &remain_variable_storage_size,
> +					       &max_variable_size));
> +	if (ret != EFI_SUCCESS)
> +		return CMD_RET_FAILURE;
> +
> +	printf("%.*s ====================\n", EFI_HANDLE_WIDTH, sep);

We are not printing handles. Please remove the line.

> +	printf("Max storage size %llu\n", max_variable_storage_size);
> +	printf("Remaining storage size %llu\n", remain_variable_storage_size);
> +	printf("Max variable size %llu\n", max_variable_size);
> +
> +	return CMD_RET_SUCCESS;
> +}
> +
>  static cmd_tbl_t cmd_efidebug_sub[] = {
>  	U_BOOT_CMD_MKENT(boot, CONFIG_SYS_MAXARGS, 1, do_efi_boot_opt, "", ""),
>  	U_BOOT_CMD_MKENT(devices, CONFIG_SYS_MAXARGS, 1, do_efi_show_devices,
> @@ -1176,6 +1215,8 @@ static cmd_tbl_t cmd_efidebug_sub[] = {
>  			 "", ""),
>  	U_BOOT_CMD_MKENT(test, CONFIG_SYS_MAXARGS, 1, do_efi_test,
>  			 "", ""),
> +	U_BOOT_CMD_MKENT(query, CONFIG_SYS_MAXARGS, 1, do_efi_query_info,
> +			 "", ""),
>  };
>
>  /**
> @@ -1247,7 +1288,9 @@ static char efidebug_help_text[] =
>  	"efidebug tables\n"
>  	"  - show UEFI configuration tables\n"
>  	"efidebug test bootmgr\n"
> -	"  - run simple bootmgr for test\n";
> +	"  - run simple bootmgr for test\n"
> +	"efidebug query\n"
> +	"  - show information of the container used to store UEFI variables\n";

This text does not make it clear that we will get size information. How
about:

"show size of UEFI variables store\n"

Best regards

Heinrich

>  #endif
>
>  U_BOOT_CMD(
>

  reply	other threads:[~2020-05-09  9:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-06 19:12 [PATCH 0/6] EFI variable support via OP-TEE Ilias Apalodimas
2020-05-06 19:12 ` [PATCH 1/6] charset: Add support for calculating bytes occupied by a u16 string Ilias Apalodimas
2020-05-09  6:44   ` Heinrich Schuchardt
2020-05-06 19:12 ` [PATCH 2/6] efi_loader: Add headers for EDK2 StandAloneMM communication Ilias Apalodimas
2020-05-09  8:12   ` Heinrich Schuchardt
2020-05-11 10:25     ` Ilias Apalodimas
2020-05-06 19:12 ` [PATCH 3/6] efi_loader: Implement EFI variable handling via OP-TEE Ilias Apalodimas
2020-05-09  9:14   ` Heinrich Schuchardt
2020-05-11  8:43     ` Ilias Apalodimas
2020-05-11 10:00     ` Ilias Apalodimas
2020-05-06 19:12 ` [PATCH 4/6] cmd: efidebug: Add support for querying UEFI variable storage Ilias Apalodimas
2020-05-09  9:58   ` Heinrich Schuchardt [this message]
2020-05-11  8:49     ` Ilias Apalodimas
2020-05-06 19:12 ` [PATCH 5/6] MAINTAINERS: Add maintainer for EFI variables via OP-TEE Ilias Apalodimas
2020-05-09  9:17   ` Heinrich Schuchardt
2020-05-11  8:47     ` Ilias Apalodimas
2020-05-06 19:12 ` [PATCH 6/6] doc: uefi.rst: Add OP-TEE variable storage config options Ilias Apalodimas
2020-05-09  9:51   ` Heinrich Schuchardt
2020-05-11  8:52     ` Ilias Apalodimas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f3358d5f-5a1d-4f24-5f24-ca4b9e2f1a96@gmx.de \
    --to=xypron.glpk@gmx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.