diff mbox

[U-Boot,RFC,01/10] ARM: crt0.S: clear the global data

Message ID 1401568344-4441-2-git-send-email-jeroen@myspectrum.nl
State RFC
Delegated to: Tom Rini
Headers show

Commit Message

Jeroen Hofstee May 31, 2014, 8:32 p.m. UTC
NOTE: smdk5420 snow smdkv310 apf27 arndale origen vpac270_ond_256 smdk5250
don't have a memset available.
---
 arch/arm/lib/crt0.S | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Simon Glass June 3, 2014, 2:02 a.m. UTC | #1
Hi Jeroen,

On 31 May 2014 14:32, Jeroen Hofstee <jeroen@myspectrum.nl> wrote:
> NOTE: smdk5420 snow smdkv310 apf27 arndale origen vpac270_ond_256 smdk5250
> don't have a memset available.

You should add a message explaining the motivation for the change.

Can you add a memset()?

Regards,
Simon
Tim Harvey June 3, 2014, 3:36 p.m. UTC | #2
On Sat, May 31, 2014 at 1:32 PM, Jeroen Hofstee <jeroen@myspectrum.nl> wrote:
> NOTE: smdk5420 snow smdkv310 apf27 arndale origen vpac270_ond_256 smdk5250
> don't have a memset available.
> ---
>  arch/arm/lib/crt0.S | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
> index dfc2de9..52b6f74 100644
> --- a/arch/arm/lib/crt0.S
> +++ b/arch/arm/lib/crt0.S
> @@ -70,6 +70,12 @@ ENTRY(_main)
>         sub     sp, sp, #GD_SIZE        /* allocate one GD above SP */
>         bic     sp, sp, #7      /* 8-byte alignment for ABI compliance */
>         mov     r9, sp          /* GD is above SP */
> +
> +       mov     r0, r9          /* Clear the global data */
> +       mov     r1, #0
> +       mov     r2, #GENERATED_GBL_DATA_SIZE
> +       bl      memset
> +
>         mov     r0, #0
>         bl      board_init_f
>
> --

Acked-by: Tim Harvey <tharvey@gateworks.com>

This resolves the issue I encountered and reported with IMX6 SPL.

Thanks,

Tim
Jeroen Hofstee June 3, 2014, 7:41 p.m. UTC | #3
Hello Simon,

On ma, 2014-06-02 at 20:02 -0600, Simon Glass wrote:
> Hi Jeroen,
> 
> On 31 May 2014 14:32, Jeroen Hofstee <jeroen@myspectrum.nl> wrote:
> > NOTE: smdk5420 snow smdkv310 apf27 arndale origen vpac270_ond_256 smdk5250
> > don't have a memset available.
> 
> You should add a message explaining the motivation for the change.
yes, I will actually check all commit messages, fix the typos and add
proper tags and cc's etc. Make the documentation a bit more generic and
add some comment about why gd needs to be treated special for llvm in
the first place.

That said, regarding this patch, the reason to clear gd at all is that
e.g. i2c depends on it and there have been issues with the serial
console flags etc as well. The reason to do it directly after allocating
gd is that there are several board_init_f's with the more wide spread
use of SPL. Another problem is that some code attempts to store values
in global data assuming it will survive relocation, but failed since gd
got reassigned again.

When just "allocating" global data once and clearing it directly, such
problem should be gone. It also matches the behavior of the generic
board CONFIG_SYS_GENERIC_GLOBAL_DATA, so this actually preserves current
behavior for the ARM boards using the generic board after the removal of
CONFIG_SYS_GENERIC_GLOBAL_DATA.

> Can you add a memset()?
Likely, one way or the other, it will be easily to fix. I posted it as
is since I was wondering what Albert thinks about it. (for completeness
a final version will include a similar change for aarch64).

Regards,
Jeroen
Jeroen Hofstee July 11, 2014, 5:55 p.m. UTC | #4
Hi,

On 31-05-14 22:32, Jeroen Hofstee wrote:
> NOTE: smdk5420 snow smdkv310 apf27 arndale origen vpac270_ond_256 smdk5250
> don't have a memset available.
> ---
>   arch/arm/lib/crt0.S | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
> index dfc2de9..52b6f74 100644
> --- a/arch/arm/lib/crt0.S
> +++ b/arch/arm/lib/crt0.S
> @@ -70,6 +70,12 @@ ENTRY(_main)
>   	sub	sp, sp, #GD_SIZE	/* allocate one GD above SP */
>   	bic	sp, sp, #7	/* 8-byte alignment for ABI compliance */
>   	mov	r9, sp		/* GD is above SP */
> +
> +	mov	r0, r9		/* Clear the global data */
> +	mov	r1, #0
> +	mov	r2, #GENERATED_GBL_DATA_SIZE
> +	bl	memset
> +
>   	mov	r0, #0
>   	bl	board_init_f
>   

this patch is superseded by http://patchwork.ozlabs.org/patch/368944/.

Regards,
Jeroen
diff mbox

Patch

diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
index dfc2de9..52b6f74 100644
--- a/arch/arm/lib/crt0.S
+++ b/arch/arm/lib/crt0.S
@@ -70,6 +70,12 @@  ENTRY(_main)
 	sub	sp, sp, #GD_SIZE	/* allocate one GD above SP */
 	bic	sp, sp, #7	/* 8-byte alignment for ABI compliance */
 	mov	r9, sp		/* GD is above SP */
+
+	mov	r0, r9		/* Clear the global data */
+	mov	r1, #0
+	mov	r2, #GENERATED_GBL_DATA_SIZE
+	bl	memset
+
 	mov	r0, #0
 	bl	board_init_f