public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: Etienne Carriere <etienne.carriere@linaro.org>
Cc: u-boot@lists.denx.de, Heinrich Schuchardt <xypron.glpk@gmx.de>
Subject: Re: [PATCH v2] efi_loader: set CapsuleMax from CONFIG_EFI_CAPSULE_MAX
Date: Thu, 16 Feb 2023 22:41:15 +0200	[thread overview]
Message-ID: <Y+6U65bKJGtF1kCe@hera> (raw)
In-Reply-To: <20230216172141.2357759-1-etienne.carriere@linaro.org>

Hi Etienne,

On Thu, Feb 16, 2023 at 06:21:41PM +0100, Etienne Carriere wrote:
> Adds CONFIG_EFI_CAPSULE_MAX to configure the max index value used in
> EFI capsule reports. The config default value is 65535 as the index max
> value used before this change. Platforms with limited storage capacity
> can set a lower configuration value to prevent storage capacity
> overflow or even waste of storage space.
>
> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
> ---
> Changes since v1
> - Changed CONFIG_EFI_CAPSULE_MAX default value from 65535 to 15.
> ---
>  lib/efi_loader/Kconfig       |  8 ++++++
>  lib/efi_loader/efi_capsule.c | 48 +++++++++++++++++++++++++-----------
>  lib/efi_loader/efi_setup.c   |  7 +++++-
>  3 files changed, 48 insertions(+), 15 deletions(-)
>
> diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
> index c56904afc2..727241dc9c 100644
> --- a/lib/efi_loader/Kconfig
> +++ b/lib/efi_loader/Kconfig
> @@ -226,6 +226,14 @@ config EFI_CAPSULE_AUTHENTICATE
>  	  Select this option if you want to enable capsule
>  	  authentication
>
> +config EFI_CAPSULE_MAX
> +	int "Max value for capsule index"
> +	default 15
> +	range 0 65535
> +	help
> +	  Select the max capsule index value used for capsule report
> +	  variables. This value is used to create CapsuleMax variable.
> +
>  config EFI_DEVICE_PATH_TO_TEXT
>  	bool "Device path to text protocol"
>  	default y
> diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
> index 0997cd248f..d5d3ede7ae 100644
> --- a/lib/efi_loader/efi_capsule.c
> +++ b/lib/efi_loader/efi_capsule.c
> @@ -45,17 +45,7 @@ const efi_guid_t fwu_guid_os_request_fw_accept =
>  static struct efi_file_handle *bootdev_root;
>  #endif
>
> -/**
> - * get_last_capsule - get the last capsule index
> - *
> - * Retrieve the index of the capsule invoked last time from "CapsuleLast"
> - * variable.
> - *
> - * Return:
> - * * > 0	- the last capsule index invoked
> - * * 0xffff	- on error, or no capsule invoked yet
> - */
> -static __maybe_unused unsigned int get_last_capsule(void)
> +static __maybe_unused unsigned int get_capsule_index(const u16 *variable_name)
>  {
>  	u16 value16[11]; /* "CapsuleXXXX": non-null-terminated */
>  	char value[5];
> @@ -65,7 +55,7 @@ static __maybe_unused unsigned int get_last_capsule(void)
>  	int i;
>
>  	size = sizeof(value16);
> -	ret = efi_get_variable_int(u"CapsuleLast", &efi_guid_capsule_report,
> +	ret = efi_get_variable_int(variable_name, &efi_guid_capsule_report,
>  				   NULL, &size, value16, NULL);

Variable name is now an argument, but the value16 size remains an array of
11 u16's.  We should test that before calling efi_get_variable_int()
although the code currently just uses 'CapsuleLast' and 'CapsuleMax'.

>  	if (ret != EFI_SUCCESS || size != 22 ||
>  	    u16_strncmp(value16, u"Capsule", 7))
> @@ -84,6 +74,35 @@ err:
>  	return index;
>  }
>

[...]

Cheers
/Ilias

      parent reply	other threads:[~2023-02-16 20:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 17:21 [PATCH v2] efi_loader: set CapsuleMax from CONFIG_EFI_CAPSULE_MAX Etienne Carriere
2023-02-16 18:41 ` Etienne Carriere
2023-02-16 20:41 ` Ilias Apalodimas [this message]

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=Y+6U65bKJGtF1kCe@hera \
    --to=ilias.apalodimas@linaro.org \
    --cc=etienne.carriere@linaro.org \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox