FWU: Add boot time checks as highlighted by the FWU specification
authorSughosh Ganu <sughosh.ganu@linaro.org>
Fri, 21 Oct 2022 12:46:02 +0000 (18:16 +0530)
committerTom Rini <trini@konsulko.com>
Mon, 31 Oct 2022 18:47:32 +0000 (14:47 -0400)
commit7e9814cc6c1dcda8cb8028e1d34483387889e149
tree1c4130356d450deba6b9fc3a40dce1e4c7763183
parent467bad5e368abfb8bca218b988567799e53f9e03
FWU: Add boot time checks as highlighted by the FWU specification

The FWU Multi Bank Update specification requires the Update Agent to
carry out certain checks at the time of platform boot. The Update
Agent is the component which is responsible for updating the firmware
components and maintaining and keeping the metadata in sync.

The spec requires that the Update Agent perform the following checks
at the time of boot
* Sanity check of both the metadata copies maintained by the platform.
* Get the boot index passed to U-Boot by the prior stage bootloader
  and use this value for metadata bookkeeping.
* Check if the system is booting in Trial State. If the system boots
  in the Trial State for more than a specified number of boot counts,
  change the Active Bank to be booting the platform from.

Call these checks through the main loop event at the time of platform
boot.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
include/fwu.h
lib/fwu_updates/fwu.c