aboutsummaryrefslogtreecommitdiff
path: root/lib/fwu_updates
diff options
context:
space:
mode:
Diffstat (limited to 'lib/fwu_updates')
-rw-r--r--lib/fwu_updates/Kconfig33
-rw-r--r--lib/fwu_updates/Makefile7
-rw-r--r--lib/fwu_updates/fwu.c22
3 files changed, 62 insertions, 0 deletions
diff --git a/lib/fwu_updates/Kconfig b/lib/fwu_updates/Kconfig
new file mode 100644
index 00000000000..78759e6618d
--- /dev/null
+++ b/lib/fwu_updates/Kconfig
@@ -0,0 +1,33 @@
+config FWU_MULTI_BANK_UPDATE
+ bool "Enable FWU Multi Bank Update Feature"
+ depends on EFI_CAPSULE_ON_DISK
+ select PARTITION_TYPE_GUID
+ select EFI_SETUP_EARLY
+ imply EFI_CAPSULE_ON_DISK_EARLY
+ select EVENT
+ help
+ Feature for updating firmware images on platforms having
+ multiple banks(copies) of the firmware images. One of the
+ bank is selected for updating all the firmware components
+
+config FWU_NUM_BANKS
+ int "Number of Banks defined by the platform"
+ depends on FWU_MULTI_BANK_UPDATE
+ help
+ Define the number of banks of firmware images on a platform
+
+config FWU_NUM_IMAGES_PER_BANK
+ int "Number of firmware images per bank"
+ depends on FWU_MULTI_BANK_UPDATE
+ help
+ Define the number of firmware images per bank. This value
+ should be the same for all the banks.
+
+config FWU_TRIAL_STATE_CNT
+ int "Number of times system boots in Trial State"
+ depends on FWU_MULTI_BANK_UPDATE
+ default 3
+ help
+ With FWU Multi Bank Update feature enabled, number of times
+ the platform is allowed to boot in Trial State after an
+ update.
diff --git a/lib/fwu_updates/Makefile b/lib/fwu_updates/Makefile
new file mode 100644
index 00000000000..1993088e5b1
--- /dev/null
+++ b/lib/fwu_updates/Makefile
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Copyright (c) 2022, Linaro Limited
+#
+
+obj-$(CONFIG_FWU_MULTI_BANK_UPDATE) += fwu.o
+obj-$(CONFIG_FWU_MDATA_GPT_BLK) += fwu_gpt.o
diff --git a/lib/fwu_updates/fwu.c b/lib/fwu_updates/fwu.c
index c9a9022a595..6e159c050c5 100644
--- a/lib/fwu_updates/fwu.c
+++ b/lib/fwu_updates/fwu.c
@@ -630,6 +630,28 @@ u8 fwu_empty_capsule_checks_pass(void)
return in_trial && boottime_check;
}
+/**
+ * fwu_trial_state_ctr_start() - Start the Trial State counter
+ *
+ * Start the counter to identify the platform booting in the
+ * Trial State. The counter is implemented as an EFI variable.
+ *
+ * Return: 0 if OK, -ve on error
+ *
+ */
+int fwu_trial_state_ctr_start(void)
+{
+ int ret;
+ u16 trial_state_ctr;
+
+ trial_state_ctr = 0;
+ ret = trial_counter_update(&trial_state_ctr);
+ if (ret)
+ log_err("Unable to initialise TrialStateCtr\n");
+
+ return ret;
+}
+
static int fwu_boottime_checks(void *ctx, struct event *event)
{
int ret;