From e7858d255652e866f40b455164b172a6a8b92ccf Mon Sep 17 00:00:00 2001
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Date: Fri, 24 Jan 2025 15:13:39 +0000
Subject: [PATCH] efi_loader: fwu_arm_psa: Keep the FMP payload header

Allow sending the payload with its FMP header

The Secure world needs the data provided by the payload
FMP header. So, let's keep it in case of FWU_ARM_PSA.

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Upstream-Status: Submitted [cover letter: https://lore.kernel.org/all/20250702152528.1180414-1-abdellatif.elkhlifi@arm.com/]
---
 lib/efi_loader/efi_firmware.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/efi_loader/efi_firmware.c b/lib/efi_loader/efi_firmware.c
index be439b4019d..80f8acd1774 100644
--- a/lib/efi_loader/efi_firmware.c
+++ b/lib/efi_loader/efi_firmware.c
@@ -521,8 +521,10 @@ static void efi_firmware_get_fw_version(const void **p_image,
 		/* FMP header is inserted above the capsule payload */
 		state->fw_version = header->fw_version;
 
+#if !CONFIG_IS_ENABLED(FWU_ARM_PSA)
 		*p_image += header->header_size;
 		*p_image_size -= header->header_size;
+#endif
 	}
 }
 
