public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu@linaro.org>
To: u-boot@lists.denx.de
Cc: Masami Hiramatsu <masami.hiramatsu@linaro.org>,
	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>,
	AKASHI Takahiro <takahiro.akashi@linaro.org>,
	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: [PATCH 1/2] efi_loader: Avoid using efi_update_capsule() from update capsule on disk
Date: Mon, 31 Jan 2022 18:18:49 +0900	[thread overview]
Message-ID: <164362072975.312714.5769638615920735810.stgit@localhost> (raw)
In-Reply-To: <164362071931.312714.14793570668139727572.stgit@localhost>

The efi_update_capsule() may have to handle the capsule flags as an UEFI
runtime and boottime service, but the capsule-on-disk process doesn't.
Thus, the capsule-on-disk should use the efi_capsule_update_firmware()
directly instead of efi_update_capsule(). To keep the consistency
ESRT also will be updated after all capsule updates are completed.

Suggested-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
---
 lib/efi_loader/efi_capsule.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index 4463ae00fd..98dab1c6f5 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -1118,7 +1118,7 @@ efi_status_t efi_launch_capsules(void)
 			index = 0;
 		ret = efi_capsule_read_file(files[i], &capsule);
 		if (ret == EFI_SUCCESS) {
-			ret = EFI_CALL(efi_update_capsule(&capsule, 1, 0));
+			ret = efi_capsule_update_firmware(&capsule);
 			if (ret != EFI_SUCCESS)
 				log_err("Applying capsule %ls failed\n",
 					files[i]);
@@ -1142,6 +1142,13 @@ efi_status_t efi_launch_capsules(void)
 		free(files[i]);
 	free(files);
 
+	if (IS_ENABLED(CONFIG_EFI_ESRT)) {
+		/* Rebuild the ESRT to reflect any updated FW images. */
+		ret = efi_esrt_populate();
+		if (ret != EFI_SUCCESS)
+			log_warning("ESRT update failed\n");
+	}
+
 	return ret;
 }
 #endif /* CONFIG_EFI_CAPSULE_ON_DISK */


  reply	other threads:[~2022-01-31  9:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-31  9:18 [PATCH 0/2] EFI: Reset system after capsule-on-disk Masami Hiramatsu
2022-01-31  9:18 ` Masami Hiramatsu [this message]
2022-01-31 19:26   ` [PATCH 1/2] efi_loader: Avoid using efi_update_capsule() from update capsule on disk Heinrich Schuchardt
2022-02-01  2:21     ` Masami Hiramatsu
2022-01-31  9:19 ` [PATCH 2/2] efi_loader: Reset system after CapsuleUpdate " Masami Hiramatsu
2022-01-31 11:19   ` Grant Likely
2022-01-31 12:17     ` Heinrich Schuchardt
2022-02-01  2:26       ` Masami Hiramatsu
2022-02-01  3:16         ` AKASHI Takahiro
2022-01-31 12:38     ` 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=164362072975.312714.5769638615920735810.stgit@localhost \
    --to=masami.hiramatsu@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=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=takahiro.akashi@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox