From: Takahiro Akashi <takahiro.akashi@linaro.org>
To: Masahisa Kojima <masahisa.kojima@linaro.org>
Cc: u-boot@lists.denx.de, Heinrich Schuchardt <xypron.glpk@gmx.de>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>
Subject: Re: [PATCH v2 2/4] efi_loader: versioning support in GetImageInfo
Date: Thu, 2 Mar 2023 14:16:48 +0900 [thread overview]
Message-ID: <20230302051648.GB44192@laputa> (raw)
In-Reply-To: <20230301091523.18384-3-masahisa.kojima@linaro.org>
On Wed, Mar 01, 2023 at 06:15:20PM +0900, Masahisa Kojima wrote:
> Current FMP->GetImageInfo() always return 0 for the firmware
> version, user can not identify which firmware version is currently
> running through the EFI interface.
>
> This commit reads the "FmpStateXXXX" EFI variable, then fills the
> firmware version, lowest supported version, last attempt version
> and last attempt status in FMP->GetImageInfo().
>
> Now FMP->GetImageInfo() and ESRT have the meaningful version number.
>
> Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
> ---
> No update since v1
>
> lib/efi_loader/efi_firmware.c | 30 ++++++++++++++++++++++++++----
> 1 file changed, 26 insertions(+), 4 deletions(-)
>
> diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
> index d1afafb052..ead20fa914 100644
> --- a/lib/efi_loader/efi_firmware.c
> +++ b/lib/efi_loader/efi_firmware.c
> @@ -173,13 +173,38 @@ static efi_status_t efi_fill_image_desc_array(
> *package_version_name = NULL; /* not supported */
>
> for (i = 0; i < num_image_type_guids; i++) {
> + u16 varname[13]; /* u"FmpStateXXXX" */
> + efi_status_t ret;
> + efi_uintn_t size;
> + struct fmp_state var_state = { 0 };
> +
> image_info[i].image_index = fw_array[i].image_index;
> image_info[i].image_type_id = fw_array[i].image_type_id;
> image_info[i].image_id = fw_array[i].image_index;
>
> image_info[i].image_id_name = fw_array[i].fw_name;
>
> - image_info[i].version = 0; /* not supported */
> + efi_create_indexed_name(varname, sizeof(varname), "FmpState",
> + fw_array[i].image_index);
Don't we have to think of the systems where multiple FMP drivers are
used? In those cases, 'image_index' doesn't work as an unique ID.
It is unlikely under the current code, but we should consider
any future extension.
-Takahiro Akashi
> + size = sizeof(var_state);
> + ret = efi_get_variable_int(varname, &efi_guid_fmp_state, NULL,
> + &size, &var_state, NULL);
> + if (ret == EFI_SUCCESS) {
> + image_info[i].version = var_state.fw_version;
> + image_info[i].lowest_supported_image_version =
> + var_state.lowest_supported_version;
> + image_info[i].last_attempt_version =
> + var_state.last_attempt_version;
> + image_info[i].last_attempt_status =
> + var_state.last_attempt_status;
> + } else {
> + image_info[i].version = 0;
> + image_info[i].lowest_supported_image_version = 0;
> + image_info[i].last_attempt_version = 0;
> + image_info[i].last_attempt_status =
> + LAST_ATTEMPT_STATUS_SUCCESS;
> + }
> +
> image_info[i].version_name = NULL; /* not supported */
> image_info[i].size = 0;
> image_info[i].attributes_supported =
> @@ -193,9 +218,6 @@ static efi_status_t efi_fill_image_desc_array(
> image_info[0].attributes_setting |=
> IMAGE_ATTRIBUTE_AUTHENTICATION_REQUIRED;
>
> - image_info[i].lowest_supported_image_version = 0;
> - image_info[i].last_attempt_version = 0;
> - image_info[i].last_attempt_status = LAST_ATTEMPT_STATUS_SUCCESS;
> image_info[i].hardware_instance = 1;
> image_info[i].dependencies = NULL;
> }
> --
> 2.17.1
>
next prev parent reply other threads:[~2023-03-02 5:17 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-01 9:15 [PATCH v2 0/4] FMP versioning support Masahisa Kojima
2023-03-01 9:15 ` [PATCH v2 1/4] efi_loader: store firmware version into FmpState variable Masahisa Kojima
2023-03-02 5:09 ` Takahiro Akashi
2023-03-02 9:50 ` Masahisa Kojima
2023-03-03 0:17 ` Takahiro Akashi
2023-03-03 4:16 ` Masahisa Kojima
2023-03-01 9:15 ` [PATCH v2 2/4] efi_loader: versioning support in GetImageInfo Masahisa Kojima
2023-03-02 5:16 ` Takahiro Akashi [this message]
2023-03-02 10:05 ` Masahisa Kojima
2023-03-03 0:10 ` Takahiro Akashi
2023-03-03 4:15 ` Masahisa Kojima
2023-03-01 9:15 ` [PATCH v2 3/4] efi_loader: check lowest supported version in capsule update Masahisa Kojima
2023-03-01 9:15 ` [PATCH v2 4/4] mkeficapsule: add FMP Payload Header Masahisa Kojima
2023-03-02 5:29 ` Takahiro Akashi
2023-03-02 10:15 ` Masahisa Kojima
2023-03-04 1:28 ` [PATCH v2 0/4] FMP versioning support Takahiro Akashi
2023-03-06 6:08 ` Masahisa Kojima
2023-03-06 6:32 ` Takahiro Akashi
2023-03-06 7:26 ` Masahisa Kojima
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=20230302051648.GB44192@laputa \
--to=takahiro.akashi@linaro.org \
--cc=ilias.apalodimas@linaro.org \
--cc=masahisa.kojima@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