aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJassi Brar <jaswinder.singh@linaro.org>2023-05-31 00:30:06 -0500
committerTom Rini <trini@konsulko.com>2023-06-09 13:52:40 -0400
commita7e45415b21c6a224f632194dd2f076c17581426 (patch)
tree2afcd419d054ff71600f9ca1a4b265a69359da1b
parent6b403ca4dcf4c68e2792c4e8b28e03b3cfe5db45 (diff)
downloadu-boot-a7e45415b21c6a224f632194dd2f076c17581426.zip
u-boot-a7e45415b21c6a224f632194dd2f076c17581426.tar.gz
u-boot-a7e45415b21c6a224f632194dd2f076c17581426.tar.bz2
fwu: provide default fwu_plat_get_bootidx
Just like fwu_plat_get_update_index, provide a default/weak implementation of fwu_plat_get_bootidx. So that most platforms wouldn't have to re-implement the likely case. Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
-rw-r--r--lib/fwu_updates/fwu.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c
index 525ac49..cd5c3b6 100644
--- a/lib/fwu_updates/fwu.c
+++ b/lib/fwu_updates/fwu.c
@@ -546,6 +546,24 @@ __weak int fwu_plat_get_update_index(uint *update_idx)
}
/**
+ * fwu_plat_get_bootidx() - Get the value of the boot index
+ * @boot_idx: Boot index value
+ *
+ * Get the value of the bank(partition) from which the platform
+ * has booted. This value is passed to U-Boot from the earlier
+ * stage bootloader which loads and boots all the relevant
+ * firmware images
+ */
+__weak void fwu_plat_get_bootidx(uint *boot_idx)
+{
+ int ret;
+
+ ret = fwu_get_active_index(boot_idx);
+ if (ret < 0)
+ *boot_idx = 0; /* Dummy value */
+}
+
+/**
* fwu_update_checks_pass() - Check if FWU update can be done
*
* Check if the FWU update can be executed. The updates are