arm/lib: Add get_effective_memsize() to board.c
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 arm/lib: Add get_effective_memsize() to board.c
-------- Original Message --------
Subject: [PATCH] arm/lib: Add get_effective_memsize() to board.c
Date: Mon, 10 Feb 2014 14:04:19 -0800
From: York Sun <[email protected]>
To: <[email protected]>
CC: <[email protected]>, York Sun <[email protected]>
This function has been around for powerpc. It is used for systems with memory more than CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory, this feature can limit U-boot to one block without going over the limit.
--- arch/arm/lib/board.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
arch/arm/lib/board.c +19 -1
@@ -263,6 +263,24 @@ init_fnc_t *init_sequence[] = { NULL, }; +phys_size_t get_effective_memsize (void ) +{ +#ifndef CONFIG_VERY_BIG_RAM +return gd->ram_size; +#else +/* limit stack to what we can reasonable map */ +return ((gd->ram_size >CONFIG_MAX_MEM_MAPPED ) ? +CONFIG_MAX_MEM_MAPPED : gd->ram_size); +#endif +} + +#ifdef CONFIG_LOGBUFFER +unsigned long logbuffer_base (void ) +{ +return CONFIG_SYS_SDRAM_BASE +get_effective_memsize () -LOGBUFF_LEN ; +} +#endif +void board_init_f (ulong bootflag) {bd_t *bd;
@@ -322,7 +340,7 @@ void board_init_f(ulong bootflag) gd->ram_size -=CONFIG_SYS_MEM_TOP_HIDE ;#endif - addr =CONFIG_SYS_SDRAM_BASE + gd->ram_size; + addr =CONFIG_SYS_SDRAM_BASE +get_effective_memsize ();#ifdef CONFIG_LOGBUFFER #ifndef CONFIG_ALT_LB_ADDR
Signature · 1 line
1.7.9.5
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 arm/lib: Add get_effective_memsize() to board.c
Quoted 18 lines · Scott Wood
Quoted 17 lines · York Sun
This function has been around for powerpc. It is used for systems with memory more than
CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory, this feature can limit U-boot to one block without going over the limit.Signed-off-by York Sun <[email protected]>--- arch/arm/lib/board.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)arch/arm/lib/board.c +0
-0@@ -263,6 +263,24 @@ init_fnc_t *init_sequence[] = { NULL, };
Quoted 5 lines
arch/arm/lib/board.c init_fnc_t *init_sequence[] = { · line 268
Quoted 3 lines
arch/arm/lib/board.c +3
-0+phys_size_t get_effective_memsize (void ) +{ +#ifndef CONFIG_VERY_BIG_RAM Whitespace
I think I have put a tab instead of a space.
Quoted 11 lines
arch/arm/lib/board.c init_fnc_t *init_sequence[] = { · line 275
Quoted 8 lines
arch/arm/lib/board.c +7
-0+return gd->ram_size; +#else +/* limit stack to what we can reasonable map */ +return ((gd->ram_size >CONFIG_MAX_MEM_MAPPED ) ? +CONFIG_MAX_MEM_MAPPED : gd->ram_size); +#endif +}Is there anything really arch-specific about this function?
Not at all. It is not called by any other file either. I tried to move the function phys_size_t get_effective_memsize(void) out, but I don't see which common file fits this purpose.
York
PATCH 1/1 arm/lib: Add get_effective_memsize() to board.c
Quoted 19 lines · York Sun
Quoted 18 lines · Scott Wood
Quoted 17 lines · York Sun
This function has been around for powerpc. It is used for systems with memory more than
CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory, this feature can limit U-boot to one block without going over the limit.Signed-off-by York Sun <[email protected]>--- arch/arm/lib/board.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)arch/arm/lib/board.c +0
-0@@ -263,6 +263,24 @@ init_fnc_t *init_sequence[] = { NULL, };
Quoted 7 lines
Quoted 5 lines
arch/arm/lib/board.c init_fnc_t *init_sequence[] = { · line 268
Quoted 3 lines
arch/arm/lib/board.c +3
-0+phys_size_t get_effective_memsize (void ) +{ +#ifndef CONFIG_VERY_BIG_RAM Whitespace
I think I have put a tab instead of a space.
Yes.
Quoted 11 lines
Quoted 10 lines
arch/arm/lib/board.c init_fnc_t *init_sequence[] = { · line 275
Quoted 7 lines
arch/arm/lib/board.c +7
-0+return gd->ram_size; +#else +/* limit stack to what we can reasonable map */ +return ((gd->ram_size >CONFIG_MAX_MEM_MAPPED ) ? +CONFIG_MAX_MEM_MAPPED : gd->ram_size); +#endif +}Is there anything really arch-specific about this function?
Quoted 3 lines
Not at all. It is not called by any other file either. I tried to move the function
phys_size_tget_effective_memsize(void)out, but I don't see which common file fits this purpose.
Not having an obvious place to put it isn't a good reason to keep it duplicated in arch code. Moving it to generic code would let you also avoid overriding things like logbuffer_base().
-Scott
PATCH 1/1 arm/lib: Add get_effective_memsize() to board.c
Quoted 41 lines · Scott Wood
Quoted 19 lines · York Sun
Quoted 18 lines · Scott Wood
Quoted 17 lines · York Sun
This function has been around for powerpc. It is used for systems with memory more than
CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory, this feature can limit U-boot to one block without going over the limit.Signed-off-by York Sun <[email protected]>--- arch/arm/lib/board.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)arch/arm/lib/board.c +0
-0@@ -263,6 +263,24 @@ init_fnc_t *init_sequence[] = { NULL, };Quoted 7 lines
Quoted 5 lines
arch/arm/lib/board.c init_fnc_t *init_sequence[] = { · line 268
Quoted 3 lines
arch/arm/lib/board.c +3
-0+phys_size_t get_effective_memsize (void ) +{ +#ifndef CONFIG_VERY_BIG_RAM Whitespace
I think I have put a tab instead of a space.
Yes.
Quoted 11 lines
Quoted 10 lines
arch/arm/lib/board.c init_fnc_t *init_sequence[] = { · line 275
Quoted 7 lines
arch/arm/lib/board.c +7
-0+return gd->ram_size; +#else +/* limit stack to what we can reasonable map */ +return ((gd->ram_size >CONFIG_MAX_MEM_MAPPED ) ? +CONFIG_MAX_MEM_MAPPED : gd->ram_size); +#endif +}Is there anything really arch-specific about this function?
Quoted 8 lines
Quoted 3 lines
Not at all. It is not called by any other file either. I tried to move the function
phys_size_tget_effective_memsize(void)out, but I don't see which common file fits this purpose.Not having an obvious place to put it isn't a good reason to keep it duplicated in arch code. Moving it to generic code would let you also avoid overriding things like
logbuffer_base().
I see the benefit of putting the code to common file and modify the common/cmd_log.c for logbuffer_base(). Can you suggest a location for get_effective_memsize(void)? Only powerpc uses this function before this patch. Putting into common.h seems too generic.
York
PATCH 1/1 arm/lib: Add get_effective_memsize() to board.c
Quoted 51 lines · York Sun
Quoted 41 lines · Scott Wood
Quoted 19 lines · York Sun
Quoted 18 lines · Scott Wood
Quoted 17 lines · York Sun
This function has been around for powerpc. It is used for systems with memory more than
CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory, this feature can limit U-boot to one block without going over the limit.Signed-off-by York Sun <[email protected]>--- arch/arm/lib/board.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)arch/arm/lib/board.c +0
-0@@ -263,6 +263,24 @@ init_fnc_t *init_sequence[] = { NULL, };Quoted 7 lines
Quoted 5 lines
arch/arm/lib/board.c init_fnc_t *init_sequence[] = { · line 268
Quoted 3 lines
arch/arm/lib/board.c +3
-0+phys_size_t get_effective_memsize (void ) +{ +#ifndef CONFIG_VERY_BIG_RAM Whitespace
I think I have put a tab instead of a space.
Yes.
Quoted 11 lines
Quoted 10 lines
arch/arm/lib/board.c init_fnc_t *init_sequence[] = { · line 275
Quoted 7 lines
arch/arm/lib/board.c +7
-0+return gd->ram_size; +#else +/* limit stack to what we can reasonable map */ +return ((gd->ram_size >CONFIG_MAX_MEM_MAPPED ) ? +CONFIG_MAX_MEM_MAPPED : gd->ram_size); +#endif +}Is there anything really arch-specific about this function?
Quoted 8 lines
Quoted 3 lines
Not at all. It is not called by any other file either. I tried to move the function
phys_size_tget_effective_memsize(void)out, but I don't see which common file fits this purpose.Not having an obvious place to put it isn't a good reason to keep it duplicated in arch code. Moving it to generic code would let you also avoid overriding things like
logbuffer_base().
Quoted 4 lines
I see the benefit of putting the code to common file and modify the
common/cmd_log.cforlogbuffer_base(). Can you suggest a location forget_effective_memsize(void)? Only powerpc uses this function before this patch. Putting intocommon.hseems too generic.
What's wrong with common.h? That's where get_ram_size() is.
-Scott
PATCH 1/1 arm/lib: Add get_effective_memsize() to board.c
Quoted 52 lines · Scott Wood
Quoted 51 lines · York Sun
Quoted 49 lines · Scott Wood
Quoted 19 lines · York Sun
Quoted 18 lines · Scott Wood
Quoted 17 lines · York Sun
This function has been around for powerpc. It is used for systems with memory more than
CONFIG_MAX_MEM_MAPPED. In case of non-contiguous memory, this feature can limit U-boot to one block without going over the limit.Signed-off-by York Sun <[email protected]>--- arch/arm/lib/board.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)arch/arm/lib/board.c +0
-0@@ -263,6 +263,24 @@ init_fnc_t *init_sequence[] = { NULL, };Quoted 7 lines
Quoted 5 lines
arch/arm/lib/board.c init_fnc_t *init_sequence[] = { · line 268
Quoted 3 lines
arch/arm/lib/board.c +3
-0+phys_size_t get_effective_memsize (void ) +{ +#ifndef CONFIG_VERY_BIG_RAM Whitespace
I think I have put a tab instead of a space.
Yes.
Quoted 11 lines
Quoted 10 lines
arch/arm/lib/board.c init_fnc_t *init_sequence[] = { · line 275
Quoted 7 lines
arch/arm/lib/board.c +7
-0+return gd->ram_size; +#else +/* limit stack to what we can reasonable map */ +return ((gd->ram_size >CONFIG_MAX_MEM_MAPPED ) ? +CONFIG_MAX_MEM_MAPPED : gd->ram_size); +#endif +}Is there anything really arch-specific about this function?
Quoted 3 lines
Not at all. It is not called by any other file either. I tried to move the function
phys_size_tget_effective_memsize(void)out, but I don't see which common file fits this purpose.Not having an obvious place to put it isn't a good reason to keep it duplicated in arch code. Moving it to generic code would let you also avoid overriding things like
logbuffer_base().
Quoted 7 lines
Quoted 4 lines
I see the benefit of putting the code to common file and modify the
common/cmd_log.cforlogbuffer_base(). Can you suggest a location forget_effective_memsize(void)? Only powerpc uses this function before this patch. Putting intocommon.hseems too generic.What's wrong with
common.h? That's whereget_ram_size()is.
You are right. I will put the function in common/memsize.c and put the prototype in common.h.
York
PATCH 1/1 arm/lib: Add get_effective_memsize() to board.c
In reply to York SunDear York Sun,
Quoted 5 lines · In message <[email protected]> you wrote:
I see the benefit of putting the code to common file and modify the
common/cmd_log.cforlogbuffer_base(). Can you suggest a location forget_effective_memsize(void)? Only powerpc uses this function before this patch. Putting intocommon.hseems too generic.
common/memsize.c ?
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Software suppliers are trying to make their software packages more ``user-friendly''. . . . Their best approach, so far, has been to take all the old brochures, and stamp the words, ``user-friendly'' on the cover. - Bill Gates
PATCH 1/1 arm/lib: Add get_effective_memsize() to board.c
Quoted 11 lines · Wolfgang Denk
Dear York Sun,
Quoted 5 lines · In message <[email protected]> you wrote:
I see the benefit of putting the code to common file and modify the
common/cmd_log.cforlogbuffer_base(). Can you suggest a location forget_effective_memsize(void)? Only powerpc uses this function before this patch. Putting intocommon.hseems too generic.
common/memsize.c?
Yes. Thanks. I am working on this file.
York