All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Kiernan <alex.kiernan@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v5 4/7] bootcount: Rewrite autoboot to use wrapper functions from bootcount.h
Date: Tue, 08 May 2018 05:23:56 +0000	[thread overview]
Message-ID: <CAO5Uq5SKtC5GLPPBqr2JrFfWb-A21vzxiA4E7xCx4rDYvaqUnw@mail.gmail.com> (raw)
In-Reply-To: <20180502141056.23937-5-lukma@denx.de>

On Wed, May 2, 2018 at 3:11 PM Lukasz Majewski <lukma@denx.de> wrote:

> The code has been refactored to use common wrappers from bootcount.h
> header.

> Signed-off-by: Lukasz Majewski <lukma@denx.de>
> Reviewed-by: Stefan Roese <sr@denx.de>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Reviewed-by:  Alex Kiernan <alex.kiernan@gmail.com>


> ---

> Changes in v5:
> - None

> Changes in v4:
> - Use global data pointer (gd_t *) instead of bootcount specific enum

> Changes in v3:
> - New patch

> Changes in v2: None

>   common/autoboot.c | 23 +++++------------------
>   1 file changed, 5 insertions(+), 18 deletions(-)

> diff --git a/common/autoboot.c b/common/autoboot.c
> index 2eef7a04cc..a0f7822c9e 100644
> --- a/common/autoboot.c
> +++ b/common/autoboot.c
> @@ -14,6 +14,7 @@
>   #include <menu.h>
>   #include <post.h>
>   #include <u-boot/sha256.h>
> +#include <bootcount.h>

>   DECLARE_GLOBAL_DATA_PTR;

> @@ -291,18 +292,8 @@ const char *bootdelay_process(void)
>   {
>          char *s;
>          int bootdelay;
> -#ifdef CONFIG_BOOTCOUNT_LIMIT
> -       unsigned long bootcount = 0;
> -       unsigned long bootlimit = 0;
> -#endif /* CONFIG_BOOTCOUNT_LIMIT */
> -
> -#ifdef CONFIG_BOOTCOUNT_LIMIT
> -       bootcount = bootcount_load();
> -       bootcount++;
> -       bootcount_store(bootcount);
> -       env_set_ulong("bootcount", bootcount);
> -       bootlimit = env_get_ulong("bootlimit", 10, 0);
> -#endif /* CONFIG_BOOTCOUNT_LIMIT */
> +
> +       bootcount_inc();

>          s = env_get("bootdelay");
>          bootdelay = s ? (int)simple_strtol(s, NULL, 10) :
CONFIG_BOOTDELAY;
> @@ -324,13 +315,9 @@ const char *bootdelay_process(void)
>                  s = env_get("failbootcmd");
>          } else
>   #endif /* CONFIG_POST */
> -#ifdef CONFIG_BOOTCOUNT_LIMIT
> -       if (bootlimit && (bootcount > bootlimit)) {
> -               printf("Warning: Bootlimit (%u) exceeded. Using
altbootcmd.\n",
> -                      (unsigned)bootlimit);
> +       if (bootcount_error())
>                  s = env_get("altbootcmd");
> -       } else
> -#endif /* CONFIG_BOOTCOUNT_LIMIT */
> +       else
>                  s = env_get("bootcmd");

>          process_fdt_options(gd->fdt_blob);
> --
> 2.11.0



-- 
Alex Kiernan

  reply	other threads:[~2018-05-08  5:23 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-02 14:10 [U-Boot] [PATCH v5 0/7] Provide SPL support for bootcount (in the case of using falcon boot mode) Lukasz Majewski
2018-05-02 14:10 ` [U-Boot] [PATCH v5 1/7] bootcount: spl: Enable bootcount support in SPL Lukasz Majewski
2018-05-08  4:51   ` Alex Kiernan
2018-05-11 11:07   ` [U-Boot] [U-Boot, v5, " Tom Rini
2018-05-02 14:10 ` [U-Boot] [PATCH v5 2/7] bootcount: Add include guards into bootcount.h file Lukasz Majewski
2018-05-08  4:52   ` Alex Kiernan
2018-05-11 11:07   ` [U-Boot] [U-Boot, v5, " Tom Rini
2018-05-02 14:10 ` [U-Boot] [PATCH v5 3/7] bootcount: Add function wrappers to handle bootcount increment and error checking Lukasz Majewski
2018-05-08  5:15   ` Alex Kiernan
2018-05-08  6:58     ` Alex Kiernan
2018-05-08  7:11       ` Stefan Roese
2018-05-08  7:38         ` Lukasz Majewski
2018-05-08  8:45         ` Alex Kiernan
2018-05-08  7:41     ` Lukasz Majewski
2018-05-08  8:53       ` Alex Kiernan
2018-05-08  9:21         ` Lukasz Majewski
2018-05-08  9:28           ` Alex Kiernan
2018-05-08 10:27             ` Lukasz Majewski
2018-05-11 11:07   ` [U-Boot] [U-Boot, v5, " Tom Rini
2018-05-02 14:10 ` [U-Boot] [PATCH v5 4/7] bootcount: Rewrite autoboot to use wrapper functions from bootcount.h Lukasz Majewski
2018-05-08  5:23   ` Alex Kiernan [this message]
2018-05-11 11:08   ` [U-Boot] [U-Boot, v5, " Tom Rini
2018-05-02 14:10 ` [U-Boot] [PATCH v5 5/7] bootcount: spl: Extend SPL to support bootcount incrementation Lukasz Majewski
2018-05-11 11:08   ` [U-Boot] [U-Boot, v5, " Tom Rini
2018-05-02 14:10 ` [U-Boot] [PATCH v5 6/7] bootcount: display5: spl: Extend DISPLAY5 board SPL to support bootcount checking Lukasz Majewski
2018-05-11 11:08   ` [U-Boot] [U-Boot, v5, " Tom Rini
2018-05-02 14:10 ` [U-Boot] [PATCH v5 7/7] bootcount: display5: config: Enable boot count feature in the display5 board Lukasz Majewski
2018-05-11 11:08   ` [U-Boot] [U-Boot, v5, " Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAO5Uq5SKtC5GLPPBqr2JrFfWb-A21vzxiA4E7xCx4rDYvaqUnw@mail.gmail.com \
    --to=alex.kiernan@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.