From bd9370d775ccc982ba54424f272deaef997f80bc Mon Sep 17 00:00:00 2001 From: Sergii Dmytruk Date: Mon, 6 May 2024 15:02:50 +0300 Subject: drivers/efi/uefi_capsules.c: coalesce and store UEFI capsules How it approximately works: (During a normal system run): 1. OS puts a capsule into RAM and calls UpdateCapsule() function of EFI runtime 2. If applying the update requires a reboot, EFI implementation creates a new CapsuleUpdateData* EFI variable pointing at the beginning of capsules description (not data, but description of the data) and does a warm reboot leaving capsule data and its description in RAM to be picked by firmware on the next boot process (After DEV_INIT:) 3. Capsules are discovered by checking for CapsuleUpdateData* variables 4. Capsule description in memory and capsule data is validated for sanity 5. Capsule data is coalesced into a continuous piece of memory (On BS_WRITE_TABLES via dasharo_add_capsules_to_bootmem() hook:) 6. Buffer with coalesced capsules is marked as reserved (On BS_WRITE_TABLES via lb_uefi_capsules() hook:) 7. coreboot table entry is added for each of the discovered capsules (In UEFI payload:) 8. CapsuleUpdateData* get removed 9. coreboot table is checked for any update capsules which are then applied Change-Id: I162d678ae5c504906084b59c1a8d8c26dadb9433 Signed-off-by: Sergii Dmytruk Reviewed-on: https://review.coreboot.org/c/coreboot/+/83422 Tested-by: build bot (Jenkins) Reviewed-by: Krystian Hebel --- src/drivers/efi/Kconfig | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/drivers/efi/Kconfig') diff --git a/src/drivers/efi/Kconfig b/src/drivers/efi/Kconfig index 399443bdaa..07e5f146a6 100644 --- a/src/drivers/efi/Kconfig +++ b/src/drivers/efi/Kconfig @@ -38,3 +38,11 @@ config DRIVERS_EFI_MAIN_FW_LSV 32-bit unsigned integer representing lowest firmware version number that is allowed to replace the current one. Can be used to forbid bugged versions. + +config DRIVERS_EFI_UPDATE_CAPSULES + bool "Include EFI update capsules driver" + depends on DRIVERS_EFI_VARIABLE_STORE && SMMSTORE_V2 && DRIVERS_EFI_FW_INFO + help + Adds a driver that is able to parse CapsuleUpdateData* EFI variables + to discover firmware updates and expose them for tianocore thorough + CBMEM for execution. tianocore is responsible for erasing the variables. -- cgit v1.2.3