From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Masami Hiramatsu <masami.hiramatsu@linaro.org>
Cc: u-boot@lists.denx.de,
Patrick Delaunay <patrick.delaunay@foss.st.com>,
Patrice Chotard <patrice.chotard@foss.st.com>,
Heinrich Schuchardt <xypron.glpk@gmx.de>,
Alexander Graf <agraf@csgraf.de>, Simon Glass <sjg@chromium.org>,
Bin Meng <bmeng.cn@gmail.com>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
Jose Marinho <jose.marinho@arm.com>,
Grant Likely <grant.likely@arm.com>,
Tom Rini <trini@konsulko.com>,
Etienne Carriere <etienne.carriere@linaro.org>,
Sughosh Ganu <sughosh.ganu@linaro.org>,
Paul Liu <paul.liu@linaro.org>
Subject: Re: [PATCH 1/2] EFI: Support CAPSULE_FLAGS_INITIATE_RESET for capsule update
Date: Tue, 25 Jan 2022 21:49:21 +0900 [thread overview]
Message-ID: <20220125124921.GA56019@laputa> (raw)
In-Reply-To: <164311028928.175897.11020560607087529330.stgit@localhost>
Hi Masami,
Thank you for this enhancement.
On Tue, Jan 25, 2022 at 08:31:29PM +0900, Masami Hiramatsu wrote:
> Support CAPSULE_FLAGS_INITIATE_RESET for rebooting uboot soon after
> updating firmware. Note that the machine will reboot soon after
> applying the capsule file which has CAPSULE_FLAGS_INITIATE_RESET
> flag. If there are multiple capsules and one has this flag, the
> machine may reboot while scanning the capsule files.
> You can control when the machine reboot by renaming the capsule
> file because the capsule files will be applied alphabetically.
>
> Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
> ---
> lib/efi_loader/efi_capsule.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
> index 4463ae00fd..24a2a026a9 100644
> --- a/lib/efi_loader/efi_capsule.c
> +++ b/lib/efi_loader/efi_capsule.c
> @@ -407,12 +407,20 @@ static efi_status_t efi_capsule_update_firmware(
> struct efi_firmware_management_protocol *fmp;
> u16 *abort_reason;
> efi_status_t ret = EFI_SUCCESS;
> + bool reset = false;
>
> /* sanity check */
> if (capsule_data->header_size < sizeof(*capsule) ||
> capsule_data->header_size >= capsule_data->capsule_image_size)
> return EFI_INVALID_PARAMETER;
>
> + if (capsule_data->flags & CAPSULE_FLAGS_INITIATE_RESET) {
> + /* INITIATE_RESET flag requires PERSIST_ACROSS_RESET flag */
> + if (!(capsule_data->flags & CAPSULE_FLAGS_PERSIST_ACROSS_RESET))
> + return EFI_INVALID_PARAMETER;
> + reset = true;
> + }
> +
> capsule = (void *)capsule_data + capsule_data->header_size;
> capsule_size = capsule_data->capsule_image_size
> - capsule_data->header_size;
> @@ -498,6 +506,11 @@ static efi_status_t efi_capsule_update_firmware(
> out:
> efi_free_pool(handles);
>
> + if (ret == EFI_SUCCESS && reset) {
> + log_debug("This capsule has CAPSULE_FLAGS_INITIATE_RESET. Reboot machine.\n");
> + do_reset(NULL, 0, 0, NULL);
I don't think this is the right place of calling do_reset().
Whenever you have processed any capsule file, you have to
- delete the capsule file,
- create/update "CapsuleXXXX" and "CapsuleLast" variables, and
- modify ESRT table
before initiating a reset.
-Takahiro Akashi
> + }
> +
> return ret;
> }
> #else
>
next prev parent reply other threads:[~2022-01-25 12:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-25 11:31 [PATCH 0/2] EFI: Add CAPSULE_FLAG_INITIATE_RESET support Masami Hiramatsu
2022-01-25 11:31 ` [PATCH 1/2] EFI: Support CAPSULE_FLAGS_INITIATE_RESET for capsule update Masami Hiramatsu
2022-01-25 12:49 ` AKASHI Takahiro [this message]
2022-01-25 22:31 ` Masami Hiramatsu
2022-01-26 2:29 ` Masami Hiramatsu
2022-01-26 7:20 ` AKASHI Takahiro
2022-01-26 8:46 ` Masami Hiramatsu
2022-01-25 11:31 ` [PATCH 2/2] mkeficapsule: Support "--flags reset" option Masami Hiramatsu
2022-02-05 6:47 ` Heinrich Schuchardt
2022-02-06 23:57 ` Masami Hiramatsu
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=20220125124921.GA56019@laputa \
--to=takahiro.akashi@linaro.org \
--cc=agraf@csgraf.de \
--cc=bmeng.cn@gmail.com \
--cc=etienne.carriere@linaro.org \
--cc=grant.likely@arm.com \
--cc=ilias.apalodimas@linaro.org \
--cc=jose.marinho@arm.com \
--cc=masami.hiramatsu@linaro.org \
--cc=patrice.chotard@foss.st.com \
--cc=patrick.delaunay@foss.st.com \
--cc=paul.liu@linaro.org \
--cc=sjg@chromium.org \
--cc=sughosh.ganu@linaro.org \
--cc=trini@konsulko.com \
--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 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.