summaryrefslogtreecommitdiff
path: root/lib/fwu_updates/fwu.c
diff options
context:
space:
mode:
authorSughosh Ganu <sughosh.ganu@linaro.org>2024-09-09 16:50:18 +0530
committerIlias Apalodimas <ilias.apalodimas@linaro.org>2024-09-19 10:52:50 +0300
commit03392f1eb85655bf6397f6eafaeafa1f9571a77e (patch)
treef54118bd66c5fc2a9483c15beebc2585297cc737 /lib/fwu_updates/fwu.c
parent36811ff8275144a9fe78453023ce1b7e20bd0cf9 (diff)
fwu: check all images for transitioning out of Trial State
The platform transitions out of Trial State into the Regular State only when all the images in the update bank have been accepted. Check for this condition before transitioning out of Trial State. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Tested-by: Michal Simek <michal.simek@amd.com> Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Diffstat (limited to 'lib/fwu_updates/fwu.c')
-rw-r--r--lib/fwu_updates/fwu.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c
index c7fc8987beb..a94a769a2b6 100644
--- a/lib/fwu_updates/fwu.c
+++ b/lib/fwu_updates/fwu.c
@@ -28,6 +28,31 @@ enum {
IMAGE_ACCEPT_CLEAR,
};
+/**
+ * fwu_bank_accepted() - Has the bank been accepted
+ * @data: Version agnostic FWU metadata information
+ * @bank: Update bank to check
+ *
+ * Check in the given bank if all the images have been accepted.
+ *
+ * Return: true if all images accepted, false otherwise
+ */
+bool fwu_bank_accepted(struct fwu_data *data, uint32_t bank)
+{
+ u32 i;
+ struct fwu_image_entry *img_entry;
+ struct fwu_image_bank_info *img_bank_info;
+
+ img_entry = &data->fwu_images[0];
+ for (i = 0; i < CONFIG_FWU_NUM_IMAGES_PER_BANK; i++) {
+ img_bank_info = &img_entry[i].img_bank_info[bank];
+ if (!img_bank_info->accepted)
+ return false;
+ }
+
+ return true;
+}
+
static int trial_counter_update(u16 *trial_state_ctr)
{
bool delete;