On 7/21/25 13:18, abdellatif.elkhl...@arm.com wrote:
From: Abdellatif El Khlifi <abdellatif.elkhl...@arm.com>
Read ESRT data from Secure world in GetImageInfo()
Use FWU_READ_STREAM ABI to read ESRT data from Secure world.
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhl...@arm.com>
Cc: Sughosh Ganu <sughosh.g...@linaro.org>
Cc: Tom Rini <tr...@konsulko.com>
Cc: Ilias Apalodimas <ilias.apalodi...@linaro.org>
Cc: Simon Glass <s...@chromium.org>
Cc: Michal Simek <michal.si...@amd.com>
Cc: Marek Vasut <marek.vasut+rene...@mailbox.org>
Cc: Casey Connolly <casey.conno...@linaro.org>
---
Changelog of changes:
===========================
v2:
* As suggested by Michal: Add /** for marking kernel-doc format
v1:
* Read ESRT data from Secure world in GetImageInfo()
include/fwu_arm_psa.h | 13 ++++
lib/fwu_updates/fwu_arm_psa.c | 116 +++++++++++++++++++++++++++++++---
2 files changed, 119 insertions(+), 10 deletions(-)
diff --git a/include/fwu_arm_psa.h b/include/fwu_arm_psa.h
index 6400cf44d1b..38fb9bde165 100644
--- a/include/fwu_arm_psa.h
+++ b/include/fwu_arm_psa.h
@@ -16,6 +16,9 @@
#define DEFAULT_HW_INSTANCE (1)
+/* The minimum supported ESRT version */
+#define EFI_SYSTEM_RESOURCE_TABLE_FIRMWARE_RESOURCE_VERSION (1)
+
/* Default values of the ESRT fields which are not supported at this stage */
#define PACKAGE_VERSION_NOT_SUP (0xffffffff)
#define LAST_ATTEMPT_NOT_SUP (0)
@@ -355,6 +358,16 @@ struct __packed fwu_image_directory {
struct fwu_image_info_entry entries[FWU_DIRECTORY_IMAGE_ENTRIES_COUNT];
};
+/**
+ * struct fwu_esrt_data_wrapper - Wrapper for the ESRT data
+ * @data: The ESRT data read from secure world
+ * @entries: The ESRT entries
+ */
+struct __packed fwu_esrt_data_wrapper {
+ struct efi_system_resource_table data;
double space
+ struct efi_system_resource_entry
entries[CONFIG_FWU_NUM_IMAGES_PER_BANK];
+};
+
/**
* fwu_agent_init() - Setup the FWU agent
*
diff --git a/lib/fwu_updates/fwu_arm_psa.c b/lib/fwu_updates/fwu_arm_psa.c
index 40746eee6ce..7297e724569 100644
--- a/lib/fwu_updates/fwu_arm_psa.c
+++ b/lib/fwu_updates/fwu_arm_psa.c
@@ -27,6 +27,7 @@ static u8 g_fwu_version_minor;
static bool g_fwu_initialized;
struct fwu_image_directory g_fwu_cached_directory;
efi_guid_t g_update_guid[CONFIG_FWU_NUM_IMAGES_PER_BANK];
+struct fwu_esrt_data_wrapper g_esrt_data;
/* Error mapping declarations */
@@ -898,6 +899,100 @@ close_handle:
return ret;
}
+/**
+ * fwu_esrt_sanity_check() - Verify ESRT data
+ *
+ * Make sure the ESRT data matches the directory data.
+ *
+ * Return:
+ *
+ * 0 on success
+ */
Please run
./scripts/kernel-doc -man -v 1>/dev/null lib/fwu_updates/fwu_arm_psa.c
and fix issues created by new added code.
And obviously here you are returning more then just 0.
M