diff mbox series

[U-Boot,v3,5/7] bootcount: spl: Extend SPL to support bootcount incrementation

Message ID 20180429133633.29509-6-lukma@denx.de
State Superseded
Delegated to: Tom Rini
Headers show
Series Provide SPL support for bootcount (in the case of using falcon boot mode) | expand

Commit Message

Lukasz Majewski April 29, 2018, 1:36 p.m. UTC
This patch adds support for incrementation of the bootcount in SPL.
Such feature is necessary when we do want to use this feature with
'falcon' boot mode (which loads OS directly in SPL).

Signed-off-by: Lukasz Majewski <lukma@denx.de>

---

Changes in v3:
- Remove not needed #ifdefs
- Add enum bootcount_context parameter to bootcount_inc() function

Changes in v2:
- New patch - as suggested by Stefan Roese - bootcount_inc() is called
  in common SPL code (./common/spl/spl.c), so other boards can also
  reuse it without modification

 common/spl/spl.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Stefan Roese April 30, 2018, 8:10 a.m. UTC | #1
Hi Lukasz,

On 29.04.2018 15:36, Lukasz Majewski wrote:
> This patch adds support for incrementation of the bootcount in SPL.
> Such feature is necessary when we do want to use this feature with
> 'falcon' boot mode (which loads OS directly in SPL).
> 
> Signed-off-by: Lukasz Majewski <lukma@denx.de>
> 
> ---
> 
> Changes in v3:
> - Remove not needed #ifdefs
> - Add enum bootcount_context parameter to bootcount_inc() function
> 
> Changes in v2:
> - New patch - as suggested by Stefan Roese - bootcount_inc() is called
>    in common SPL code (./common/spl/spl.c), so other boards can also
>    reuse it without modification
> 
>   common/spl/spl.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 61d3071324..2d10c84296 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -20,6 +20,7 @@
>   #include <dm/root.h>
>   #include <linux/compiler.h>
>   #include <fdt_support.h>
> +#include <bootcount.h>
>   
>   DECLARE_GLOBAL_DATA_PTR;
>   
> @@ -417,6 +418,8 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>   	spl_board_init();
>   #endif
>   
> +	bootcount_inc(SPL);
> +

Thanks. With the suggested addition of automatic runtime detection
of the boot-stage (SPL vs U-Boot etc), this SPL parameter can be
dropped.

Other that this:

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan
Tom Rini April 30, 2018, 2:17 p.m. UTC | #2
On Sun, Apr 29, 2018 at 03:36:31PM +0200, Lukasz Majewski wrote:

> This patch adds support for incrementation of the bootcount in SPL.
> Such feature is necessary when we do want to use this feature with
> 'falcon' boot mode (which loads OS directly in SPL).
> 
> Signed-off-by: Lukasz Majewski <lukma@denx.de>
> 

Reviewed-by: Tom Rini <trini@konsulko.com>
diff mbox series

Patch

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 61d3071324..2d10c84296 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -20,6 +20,7 @@ 
 #include <dm/root.h>
 #include <linux/compiler.h>
 #include <fdt_support.h>
+#include <bootcount.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -417,6 +418,8 @@  void board_init_r(gd_t *dummy1, ulong dummy2)
 	spl_board_init();
 #endif
 
+	bootcount_inc(SPL);
+
 	memset(&spl_image, '\0', sizeof(spl_image));
 #ifdef CONFIG_SYS_SPL_ARGS_ADDR
 	spl_image.arg = (void *)CONFIG_SYS_SPL_ARGS_ADDR;