diff mbox series

[v4,1/2] efi_loader: use efi_update_capsule_firmware() for capsule on disk

Message ID 164388019634.446835.18271480521485569016.stgit@localhost
State Superseded
Headers show
Series EFI: Reset system after capsule-on-disk | expand

Commit Message

Masami Hiramatsu Feb. 3, 2022, 9:23 a.m. UTC
Since the efi_update_capsule() represents the UpdateCapsule() runtime
service, it has to handle the capsule flags and update ESRT. However
the capsule-on-disk doesn't need to care about such things.

Thus, the capsule-on-disk should use the efi_capsule_update_firmware()
directly instead of calling efi_update_capsule().

This means the roles of the efi_update_capsule() and capsule-on-disk
are different. We have to keep the efi_update_capsule() for providing
runtime service API at boot time.

Suggested-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>
---
 Changes in v4:
  - Update patch description.
---
 lib/efi_loader/efi_capsule.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Heinrich Schuchardt Feb. 13, 2022, 8:58 a.m. UTC | #1
On 2/3/22 10:23, Masami Hiramatsu wrote:
> Since the efi_update_capsule() represents the UpdateCapsule() runtime
> service, it has to handle the capsule flags and update ESRT. However
> the capsule-on-disk doesn't need to care about such things.
>
> Thus, the capsule-on-disk should use the efi_capsule_update_firmware()
> directly instead of calling efi_update_capsule().
>
> This means the roles of the efi_update_capsule() and capsule-on-disk
> are different. We have to keep the efi_update_capsule() for providing
> runtime service API at boot time.
>
> Suggested-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index 4463ae00fd..1ec7ea29ff 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]);