diff mbox series

[U-Boot] spl: stash bootstage info before jump to next stage

Message ID 1505298266-5637-1-git-send-email-kever.yang@rock-chips.com
State Accepted
Delegated to: Tom Rini
Headers show
Series [U-Boot] spl: stash bootstage info before jump to next stage | expand

Commit Message

Kever Yang Sept. 13, 2017, 10:24 a.m. UTC
Since we may jump to next stage like ATF/OP-TEE instead of U-Boot,
we need to stash the bootstage info before it.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---

 common/spl/spl.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Tom Rini Sept. 13, 2017, 3:58 p.m. UTC | #1
On Wed, Sep 13, 2017 at 06:24:24PM +0800, Kever Yang wrote:
> Since we may jump to next stage like ATF/OP-TEE instead of U-Boot,
> we need to stash the bootstage info before it.
> 
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
> ---
> 
>  common/spl/spl.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/common/spl/spl.c b/common/spl/spl.c
> index 85e2e88..d156e74 100644
> --- a/common/spl/spl.c
> +++ b/common/spl/spl.c
> @@ -424,6 +424,15 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>  	debug("SPL malloc() used %#lx bytes (%ld KB)\n", gd->malloc_ptr,
>  	      gd->malloc_ptr / 1024);
>  #endif
> +#ifdef CONFIG_BOOTSTAGE_STASH
> +	int ret;
> +
> +	bootstage_mark_name(BOOTSTAGE_ID_END_SPL, "end_spl");
> +	ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
> +			      CONFIG_BOOTSTAGE_STASH_SIZE);
> +	if (ret)
> +		debug("Failed to stash bootstage: err=%d\n", ret);
> +#endif
>  
>  	if (CONFIG_IS_ENABLED(ATF_SUPPORT)) {
>  		debug("loaded - jumping to U-Boot via ATF BL31.\n");
> @@ -436,15 +445,6 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>  	}
>  
>  	debug("loaded - jumping to U-Boot...\n");
> -#ifdef CONFIG_BOOTSTAGE_STASH
> -	int ret;
> -
> -	bootstage_mark_name(BOOTSTAGE_ID_END_SPL, "end_spl");
> -	ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
> -			      CONFIG_BOOTSTAGE_STASH_SIZE);
> -	if (ret)
> -		debug("Failed to stash bootstage: err=%d\n", ret);
> -#endif
>  	spl_board_prepare_for_boot();
>  	jump_to_image_no_args(&spl_image);
>  }

Simon, does this seem right to you?  Thanks!
Simon Glass Sept. 17, 2017, 5:52 p.m. UTC | #2
On 13 September 2017 at 09:58, Tom Rini <trini@konsulko.com> wrote:
> On Wed, Sep 13, 2017 at 06:24:24PM +0800, Kever Yang wrote:
>> Since we may jump to next stage like ATF/OP-TEE instead of U-Boot,
>> we need to stash the bootstage info before it.
>>
>> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
>> ---
>>
>>  common/spl/spl.c | 18 +++++++++---------
>>  1 file changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/common/spl/spl.c b/common/spl/spl.c
>> index 85e2e88..d156e74 100644
>> --- a/common/spl/spl.c
>> +++ b/common/spl/spl.c
>> @@ -424,6 +424,15 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>>       debug("SPL malloc() used %#lx bytes (%ld KB)\n", gd->malloc_ptr,
>>             gd->malloc_ptr / 1024);
>>  #endif
>> +#ifdef CONFIG_BOOTSTAGE_STASH
>> +     int ret;
>> +
>> +     bootstage_mark_name(BOOTSTAGE_ID_END_SPL, "end_spl");
>> +     ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
>> +                           CONFIG_BOOTSTAGE_STASH_SIZE);
>> +     if (ret)
>> +             debug("Failed to stash bootstage: err=%d\n", ret);
>> +#endif
>>
>>       if (CONFIG_IS_ENABLED(ATF_SUPPORT)) {
>>               debug("loaded - jumping to U-Boot via ATF BL31.\n");
>> @@ -436,15 +445,6 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
>>       }
>>
>>       debug("loaded - jumping to U-Boot...\n");
>> -#ifdef CONFIG_BOOTSTAGE_STASH
>> -     int ret;
>> -
>> -     bootstage_mark_name(BOOTSTAGE_ID_END_SPL, "end_spl");
>> -     ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
>> -                           CONFIG_BOOTSTAGE_STASH_SIZE);
>> -     if (ret)
>> -             debug("Failed to stash bootstage: err=%d\n", ret);
>> -#endif
>>       spl_board_prepare_for_boot();
>>       jump_to_image_no_args(&spl_image);
>>  }
>
> Simon, does this seem right to you?  Thanks!

Yes. I think the commit message would be better if it mentioned that
the code is moved, not added. Really, it is the
CONFIG_IS_ENABLED(ATF_SUPPORT) that is being moved I think.

Reviewed-by: Simon Glass <sjg@chromium.org>

Regards,
Simon
Tom Rini Sept. 22, 2017, 2:19 p.m. UTC | #3
On Wed, Sep 13, 2017 at 06:24:24PM +0800, Kever Yang wrote:

> Since we may jump to next stage like ATF/OP-TEE instead of U-Boot,
> we need to stash the bootstage info before it.
> 
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 85e2e88..d156e74 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -424,6 +424,15 @@  void board_init_r(gd_t *dummy1, ulong dummy2)
 	debug("SPL malloc() used %#lx bytes (%ld KB)\n", gd->malloc_ptr,
 	      gd->malloc_ptr / 1024);
 #endif
+#ifdef CONFIG_BOOTSTAGE_STASH
+	int ret;
+
+	bootstage_mark_name(BOOTSTAGE_ID_END_SPL, "end_spl");
+	ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
+			      CONFIG_BOOTSTAGE_STASH_SIZE);
+	if (ret)
+		debug("Failed to stash bootstage: err=%d\n", ret);
+#endif
 
 	if (CONFIG_IS_ENABLED(ATF_SUPPORT)) {
 		debug("loaded - jumping to U-Boot via ATF BL31.\n");
@@ -436,15 +445,6 @@  void board_init_r(gd_t *dummy1, ulong dummy2)
 	}
 
 	debug("loaded - jumping to U-Boot...\n");
-#ifdef CONFIG_BOOTSTAGE_STASH
-	int ret;
-
-	bootstage_mark_name(BOOTSTAGE_ID_END_SPL, "end_spl");
-	ret = bootstage_stash((void *)CONFIG_BOOTSTAGE_STASH_ADDR,
-			      CONFIG_BOOTSTAGE_STASH_SIZE);
-	if (ret)
-		debug("Failed to stash bootstage: err=%d\n", ret);
-#endif
 	spl_board_prepare_for_boot();
 	jump_to_image_no_args(&spl_image);
 }