[PATCH 1/2] efi_loader: use original image_index for FMP versioning

Masahisa Kojima masahisa.kojima at linaro.org
Tue Nov 14 10:25:07 CET 2023


FMP versioning uses the image_index argument of
EFI_FIRMWARE_MANAGEMENT_PROTOCOL.SetImage() service.
When CONFIG_FWU_MULTI_BANK_UPDATE is enabled, image_index
is updated by fwu_get_image_index() function. This commit
saves the original image_index argument and use it for
FMP versioning.

Signed-off-by: Masahisa Kojima <masahisa.kojima at linaro.org>
---
 lib/efi_loader/efi_firmware.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
index 9abb29f1df..9c1a273926 100644
--- a/lib/efi_loader/efi_firmware.c
+++ b/lib/efi_loader/efi_firmware.c
@@ -612,6 +612,8 @@ efi_status_t EFIAPI efi_firmware_raw_set_image(
 {
 	int ret;
 	efi_status_t status;
+	u8 original_image_index = image_index;
+
 	struct fmp_state state = { 0 };
 
 	EFI_ENTRY("%p %d %p %zu %p %p %p\n", this, image_index, image,
@@ -641,7 +643,7 @@ efi_status_t EFIAPI efi_firmware_raw_set_image(
 			     NULL, NULL))
 		return EFI_EXIT(EFI_DEVICE_ERROR);
 
-	efi_firmware_set_fmp_state_var(&state, image_index);
+	efi_firmware_set_fmp_state_var(&state, original_image_index);
 
 	return EFI_EXIT(EFI_SUCCESS);
 }
-- 
2.34.1



More information about the U-Boot mailing list