diff mbox series

[v5,6/6] fwu: provide default fwu_plat_get_bootidx

Message ID 20230410230459.72680-1-jaswinder.singh@linaro.org
State Superseded
Headers show
Series FWU: Add support for mtd backed feature on DeveloperBox | expand

Commit Message

Jassi Brar April 10, 2023, 11:04 p.m. UTC
From: Jassi Brar <jaswinder.singh@linaro.org>

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>
---
 lib/fwu_updates/fwu.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
diff mbox series

Patch

diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c
index a24ccf567a..c9996f4d6d 100644
--- a/lib/fwu_updates/fwu.c
+++ b/lib/fwu_updates/fwu.c
@@ -545,6 +545,24 @@  __weak int fwu_plat_get_update_index(uint *update_idx)
 	return ret;
 }
 
+/**
+ * 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
  *