summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2021-07-10 12:14:13 +0300
committerHeinrich Schuchardt <xypron.glpk@gmx.de>2021-07-12 21:30:48 +0300
commit70bad5462ca77dcd62efb6fdff03b26460df5f14 (patch)
tree9b1fc83fc8f5e2a19caef310370244e83e9f5708 /lib
parentd7eedd9d50334388766a69f99cca7484e04684d6 (diff)
downloadu-boot-70bad5462ca77dcd62efb6fdff03b26460df5f14.tar.xz
efi_loader: set CapsuleLast after each capsule
If multiple capsules are applied, the FMP drivers for the individual capsules can expect the value of CapsuleLast to be accurate. Hence CapsuleLast must be updated after each capsule. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/efi_loader/efi_capsule.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index 7831a2723a..bef9d61f67 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -102,8 +102,20 @@ void set_capsule_result(int index, struct efi_capsule_header *capsule,
EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS,
sizeof(result), &result, false);
- if (ret)
+ if (ret != EFI_SUCCESS) {
log_err("Setting %ls failed\n", variable_name16);
+ return;
+ }
+
+ /* Variable CapsuleLast must not include terminating 0x0000 */
+ ret = efi_set_variable_int(L"CapsuleLast", &efi_guid_capsule_report,
+ EFI_VARIABLE_READ_ONLY |
+ EFI_VARIABLE_NON_VOLATILE |
+ EFI_VARIABLE_BOOTSERVICE_ACCESS |
+ EFI_VARIABLE_RUNTIME_ACCESS,
+ 22, variable_name16, false);
+ if (ret != EFI_SUCCESS)
+ log_err("Setting %ls failed\n", L"CapsuleLast");
}
#ifdef CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT
@@ -990,7 +1002,6 @@ efi_status_t efi_launch_capsules(void)
struct efi_capsule_header *capsule = NULL;
u16 **files;
unsigned int nfiles, index, i;
- u16 variable_name16[12];
efi_status_t ret;
if (!check_run_capsules())
@@ -1042,16 +1053,6 @@ efi_status_t efi_launch_capsules(void)
free(files[i]);
free(files);
- /* CapsuleLast */
- efi_create_indexed_name(variable_name16, sizeof(variable_name16),
- "Capsule", index - 1);
- efi_set_variable_int(L"CapsuleLast", &efi_guid_capsule_report,
- EFI_VARIABLE_READ_ONLY |
- EFI_VARIABLE_NON_VOLATILE |
- EFI_VARIABLE_BOOTSERVICE_ACCESS |
- EFI_VARIABLE_RUNTIME_ACCESS,
- 22, variable_name16, false);
-
return ret;
}
#endif /* CONFIG_EFI_CAPSULE_ON_DISK */