Re: [U-Boot] [PATCH 02/10] board_init_f_mem(): Don't require memset()

2015-04-24 Thread Simon Glass
Hi Masahiro,

On 20 April 2015 at 22:30, Masahiro Yamada
yamada.masah...@socionext.com wrote:
 2015-04-21 12:47 GMT+09:00 Simon Glass s...@chromium.org:
 Hi Masahiro,

 On 20 April 2015 at 21:42, Masahiro Yamada
 yamada.masah...@socionext.com wrote:
 Hi Simon,



 2015-04-16 10:14 GMT+09:00 Simon Glass s...@chromium.org:
 Unfortunately memset() is not always available, so provide a substitute 
 when
 needed.

 Signed-off-by: Simon Glass s...@chromium.org
 ---

  common/init/global_data.c | 8 
  1 file changed, 8 insertions(+)

 diff --git a/common/init/global_data.c b/common/init/global_data.c
 index 2633f0d..ef055c4 100644
 --- a/common/init/global_data.c
 +++ b/common/init/global_data.c
 @@ -21,7 +21,15 @@ ulong board_init_f_mem(ulong top)
 top -= sizeof(struct global_data);
 top = ALIGN(top, 16);
 gd = (struct global_data *)top;
 +#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBGENERIC_SUPPORT)
 memset((void *)gd, '\0', sizeof(*gd));
 +#else
 +   int *ptr = (int *)gd;
 +   int *end = (int *)(gd + 1);
 +
 +   while (ptr  end)
 +   *ptr++ = 0;
 +#endif

  #ifdef CONFIG_SYS_MALLOC_F_LEN
 top -= CONFIG_SYS_MALLOC_F_LEN;


 This patch implies that all the SPLs should have memset().

 Is it better to build lib/ unconditionally?
 I posted a patch to do so.

 Please consider to use it as a prerequisite
 for cleaning up 01/10  and 02/10.

 That would be better I think - how did you manage it? I cannot see the
 patch you are referring to.

 It is under moderation because of too many recipients.
 (I think you have already received it because you were listed in CC.)

 Please wait until it is approved.


 Although what about if SPL is very close
 to the maximum size and adding memset() makes it too large? I suppose
 in that case we would get a build error and notice the problem?

 Buildman-test passed, but I am not sure about run-test.

 For those boards that define CONFIG_SPL_MAX_SIZE,
 CONFIG_SPL_MAX_FOOTPRINT etc., we should notice the problem at the
 build time.  (and it did not occur.)

 I'd like to encourage the board maintainers to do run-test just in case.
 (and also to support such CONFIG options for boards with the limited
 memory footprint)

OK, I tried it out for code size and it looked fine. I will see if I
can test it on some boards, but I imagine it would be fine.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 02/10] board_init_f_mem(): Don't require memset()

2015-04-20 Thread Simon Glass
Hi Masahiro,

On 20 April 2015 at 21:42, Masahiro Yamada
yamada.masah...@socionext.com wrote:
 Hi Simon,



 2015-04-16 10:14 GMT+09:00 Simon Glass s...@chromium.org:
 Unfortunately memset() is not always available, so provide a substitute when
 needed.

 Signed-off-by: Simon Glass s...@chromium.org
 ---

  common/init/global_data.c | 8 
  1 file changed, 8 insertions(+)

 diff --git a/common/init/global_data.c b/common/init/global_data.c
 index 2633f0d..ef055c4 100644
 --- a/common/init/global_data.c
 +++ b/common/init/global_data.c
 @@ -21,7 +21,15 @@ ulong board_init_f_mem(ulong top)
 top -= sizeof(struct global_data);
 top = ALIGN(top, 16);
 gd = (struct global_data *)top;
 +#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBGENERIC_SUPPORT)
 memset((void *)gd, '\0', sizeof(*gd));
 +#else
 +   int *ptr = (int *)gd;
 +   int *end = (int *)(gd + 1);
 +
 +   while (ptr  end)
 +   *ptr++ = 0;
 +#endif

  #ifdef CONFIG_SYS_MALLOC_F_LEN
 top -= CONFIG_SYS_MALLOC_F_LEN;


 This patch implies that all the SPLs should have memset().

 Is it better to build lib/ unconditionally?
 I posted a patch to do so.

 Please consider to use it as a prerequisite
 for cleaning up 01/10  and 02/10.

That would be better I think - how did you manage it? I cannot see the
patch you are referring to. Although what about if SPL is very close
to the maximum size and adding memset() makes it too large? I suppose
in that case we would get a build error and notice the problem?
Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 02/10] board_init_f_mem(): Don't require memset()

2015-04-20 Thread Masahiro Yamada
Hi Simon,



2015-04-16 10:14 GMT+09:00 Simon Glass s...@chromium.org:
 Unfortunately memset() is not always available, so provide a substitute when
 needed.

 Signed-off-by: Simon Glass s...@chromium.org
 ---

  common/init/global_data.c | 8 
  1 file changed, 8 insertions(+)

 diff --git a/common/init/global_data.c b/common/init/global_data.c
 index 2633f0d..ef055c4 100644
 --- a/common/init/global_data.c
 +++ b/common/init/global_data.c
 @@ -21,7 +21,15 @@ ulong board_init_f_mem(ulong top)
 top -= sizeof(struct global_data);
 top = ALIGN(top, 16);
 gd = (struct global_data *)top;
 +#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBGENERIC_SUPPORT)
 memset((void *)gd, '\0', sizeof(*gd));
 +#else
 +   int *ptr = (int *)gd;
 +   int *end = (int *)(gd + 1);
 +
 +   while (ptr  end)
 +   *ptr++ = 0;
 +#endif

  #ifdef CONFIG_SYS_MALLOC_F_LEN
 top -= CONFIG_SYS_MALLOC_F_LEN;


This patch implies that all the SPLs should have memset().

Is it better to build lib/ unconditionally?
I posted a patch to do so.

Please consider to use it as a prerequisite
for cleaning up 01/10  and 02/10.



-- 
Best Regards
Masahiro Yamada
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 02/10] board_init_f_mem(): Don't require memset()

2015-04-20 Thread Masahiro Yamada
2015-04-21 12:47 GMT+09:00 Simon Glass s...@chromium.org:
 Hi Masahiro,

 On 20 April 2015 at 21:42, Masahiro Yamada
 yamada.masah...@socionext.com wrote:
 Hi Simon,



 2015-04-16 10:14 GMT+09:00 Simon Glass s...@chromium.org:
 Unfortunately memset() is not always available, so provide a substitute when
 needed.

 Signed-off-by: Simon Glass s...@chromium.org
 ---

  common/init/global_data.c | 8 
  1 file changed, 8 insertions(+)

 diff --git a/common/init/global_data.c b/common/init/global_data.c
 index 2633f0d..ef055c4 100644
 --- a/common/init/global_data.c
 +++ b/common/init/global_data.c
 @@ -21,7 +21,15 @@ ulong board_init_f_mem(ulong top)
 top -= sizeof(struct global_data);
 top = ALIGN(top, 16);
 gd = (struct global_data *)top;
 +#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBGENERIC_SUPPORT)
 memset((void *)gd, '\0', sizeof(*gd));
 +#else
 +   int *ptr = (int *)gd;
 +   int *end = (int *)(gd + 1);
 +
 +   while (ptr  end)
 +   *ptr++ = 0;
 +#endif

  #ifdef CONFIG_SYS_MALLOC_F_LEN
 top -= CONFIG_SYS_MALLOC_F_LEN;


 This patch implies that all the SPLs should have memset().

 Is it better to build lib/ unconditionally?
 I posted a patch to do so.

 Please consider to use it as a prerequisite
 for cleaning up 01/10  and 02/10.

 That would be better I think - how did you manage it? I cannot see the
 patch you are referring to.

It is under moderation because of too many recipients.
(I think you have already received it because you were listed in CC.)

Please wait until it is approved.


 Although what about if SPL is very close
 to the maximum size and adding memset() makes it too large? I suppose
 in that case we would get a build error and notice the problem?

Buildman-test passed, but I am not sure about run-test.

For those boards that define CONFIG_SPL_MAX_SIZE,
CONFIG_SPL_MAX_FOOTPRINT etc., we should notice the problem at the
build time.  (and it did not occur.)

I'd like to encourage the board maintainers to do run-test just in case.
(and also to support such CONFIG options for boards with the limited
memory footprint)



-- 
Best Regards
Masahiro Yamada
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 02/10] board_init_f_mem(): Don't require memset()

2015-04-19 Thread Simon Glass
Hi Wolfgang,

On 15 April 2015 at 22:25, Wolfgang Denk w...@denx.de wrote:
 Dear Simon Glass,

 In message 1429146849-11994-3-git-send-email-...@chromium.org you wrote:
 Unfortunately memset() is not always available, so provide a substitute when
 needed.

 +#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBGENERIC_SUPPORT)
   memset((void *)gd, '\0', sizeof(*gd));
 +#else
 + int *ptr = (int *)gd;
 + int *end = (int *)(gd + 1);
 +
 + while (ptr  end)
 + *ptr++ = 0;
 +#endif

 Please don't declare variables in the middle of the code.

OK I'll tidy that up.

Regards,
Simon
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 02/10] board_init_f_mem(): Don't require memset()

2015-04-15 Thread Simon Glass
Unfortunately memset() is not always available, so provide a substitute when
needed.

Signed-off-by: Simon Glass s...@chromium.org
---

 common/init/global_data.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/common/init/global_data.c b/common/init/global_data.c
index 2633f0d..ef055c4 100644
--- a/common/init/global_data.c
+++ b/common/init/global_data.c
@@ -21,7 +21,15 @@ ulong board_init_f_mem(ulong top)
top -= sizeof(struct global_data);
top = ALIGN(top, 16);
gd = (struct global_data *)top;
+#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBGENERIC_SUPPORT)
memset((void *)gd, '\0', sizeof(*gd));
+#else
+   int *ptr = (int *)gd;
+   int *end = (int *)(gd + 1);
+
+   while (ptr  end)
+   *ptr++ = 0;
+#endif
 
 #ifdef CONFIG_SYS_MALLOC_F_LEN
top -= CONFIG_SYS_MALLOC_F_LEN;
-- 
2.2.0.rc0.207.ga3a616c

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 02/10] board_init_f_mem(): Don't require memset()

2015-04-15 Thread Wolfgang Denk
Dear Simon Glass,

In message 1429146849-11994-3-git-send-email-...@chromium.org you wrote:
 Unfortunately memset() is not always available, so provide a substitute when
 needed.

 +#if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBGENERIC_SUPPORT)
   memset((void *)gd, '\0', sizeof(*gd));
 +#else
 + int *ptr = (int *)gd;
 + int *end = (int *)(gd + 1);
 +
 + while (ptr  end)
 + *ptr++ = 0;
 +#endif

Please don't declare variables in the middle of the code.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Command, n.:
Statement presented by a human and accepted by a computer
in such a manner as to make the human feel as if he is in control.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot