common/board_f: Preserve early global data
PATCH v3 1/2 common/board_f: Preserve early global data
Some platforms (including mpc85xx, mpc86xx) use global data before calling function baord_inti_f(). This data should not be cleared later. Any arch which needs to preserve global data should define CONFIG_SYS_EARLY_GD.
---
Change log
v3: Introduce CONFIG_SYS_EARLY_GD instead of using a list
v2: Instead of adding back gd init for all PPC, preserve gd for mpc85xx and mpc86xx.
README | 3 +++ arch/powerpc/include/asm/config.h | 2 ++ arch/x86/include/asm/config.h | 1 + common/board_f.c | 10 +++++----- 4 files changed, 11 insertions(+), 5 deletions(-)
README +3 -0
@@ -440,6 +440,9 @@ The following options need to be configured: supported, core will start to execute uboot when wakes up. - Generic CPU options: + CONFIG_SYS_EARLY_GD + Defines global data is used before board_init_f(). + CONFIG_SYS_BIG_ENDIAN, CONFIG_SYS_LITTLE_ENDIAN Defines the endianess of the CPU. Implementation of those
arch/powerpc/include/asm/config.h +2 -0
@@ -10,11 +10,13 @@#ifdef CONFIG_MPC85xx#include <asm/config_mpc85xx.h> #define CONFIG_SYS_FSL_DDR +#define CONFIG_SYS_EARLY_GD #endif #ifdef CONFIG_MPC86xx#include <asm/config_mpc86xx.h> #define CONFIG_SYS_FSL_DDR +#define CONFIG_SYS_EARLY_GD #endif #ifdef CONFIG_MPC83xx
arch/x86/include/asm/config.h +1 -0
@@ -7,5 +7,6 @@#ifndef _ASM_CONFIG_H_#define _ASM_CONFIG_H_ +#define CONFIG_SYS_EARLY_GD #define CONFIG_SYS_GENERIC_BOARD #endif
common/board_f.c +5 -5
@@ -970,20 +970,20 @@ static init_fnc_t init_sequence_f[] = {void board_init_f (ulong boot_flags) { -#ifndef CONFIG_X86 +/* +* For some archtecture, global data is initialized and used before +* calling this function. The data should be preserved. +*/ +#ifndef CONFIG_SYS_EARLY_GD gd_t data; gd = &data; -#endif /* * Clear global data before it is accessed at debug print * in initcall_run_list. Otherwise the debug print probably * get the wrong vaule of gd->have_console. */ -#if !defined(CONFIG_CPM2 ) && !defined(CONFIG_MPC512X ) && \ - !defined(CONFIG_MPC83xx) && !defined(CONFIG_MPC85xx) && \ - !defined(CONFIG_MPC86xx) && !defined(CONFIG_X86 )zero_global_data ();#endif
Signature · 1 line
1.7.9.5
PATCH v3 2/2 common/board_f: Fix size variable
DRAM size should use 64-bit variable when the size could be more than 4GB. Caught and verified on P4080DS with 4GB DDR.
---
Change log
v3: no change
v2: no change
common/board_f.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
common/board_f.c +1 -1
@@ -194,7 +194,7 @@ static int init_func_ram(void)static int show_dram_config (void ) { -ulong size; +unsigned long long size;#ifdef CONFIG_NR_DRAM_BANKS int i;
Signature · 1 line
1.7.9.5
PATCH v3 1/2 common/board_f: Preserve early global data
In reply to York SunHi York,
Quoted 24 lines · York Sun
Some platforms (including mpc85xx, mpc86xx) use global data before calling function
baord_inti_f(). This data should not be cleared later. Any arch which needs to preserve global data should defineCONFIG_SYS_EARLY_GD.Signed-off-by York Sun <[email protected]>CC Scott Wood <[email protected]>CC Simon Glass <[email protected]>---
Change logv3: Introduce
CONFIG_SYS_EARLY_GDinstead of using a list
v2: Instead of adding back gd init for all PPC, preserve gd for mpc85xx and mpc86xx.README | 3 +++ arch/powerpc/include/asm/config.h | 2 ++ arch/x86/include/asm/config.h | 1 + common/board_f.c | 10 +++++----- 4 files changed, 11 insertions(+), 5 deletions(-)README +0
-0
README The following options need to be configured: · line 445
Quoted 6 lines
README +3
-0@@ -440,6 +440,9 @@ The following options need to be configured: supported, core will start to execute uboot when wakes up. - Generic CPU options: + CONFIG_SYS_EARLY_GD + Defines global data is used before board_init_f(). +
This looks like a good solution, but I believe that 'early' is in fact where we are headed. So perhaps you should create an inverted option and define it for archs that don't support it?
For what you have, I think CONFIG_SYS_EARLY_GLOBAL_DATA might be more descriptive. Also I think you should describe the purpose more precisely here - it's not just the use that you need to discuss.
- The CPU init code must set it up and zero it
- Then board_init_f() doesn't zero it
Quoted 51 lines
README +0
-0CONFIG_SYS_BIG_ENDIAN, CONFIG_SYS_LITTLE_ENDIAN Defines the endianess of the CPU. Implementation of thosearch/powerpc/include/asm/config.h +2
-0@@ -10,11 +10,13 @@#ifdef CONFIG_MPC85xx#include <asm/config_mpc85xx.h> #define CONFIG_SYS_FSL_DDR +#define CONFIG_SYS_EARLY_GD #endif #ifdef CONFIG_MPC86xx#include <asm/config_mpc86xx.h> #define CONFIG_SYS_FSL_DDR +#define CONFIG_SYS_EARLY_GD #endif #ifdef CONFIG_MPC83xxarch/x86/include/asm/config.h +1
-0@@ -7,5 +7,6 @@#ifndef _ASM_CONFIG_H_#define _ASM_CONFIG_H_ +#define CONFIG_SYS_EARLY_GD #define CONFIG_SYS_GENERIC_BOARD #endif common/board_f.c +5
-2@@ -970,20 +970,20 @@ static init_fnc_t init_sequence_f[] = {void board_init_f (ulong boot_flags) { -#ifndef CONFIG_X86 +/* +* For some archtecture, global data is initialized and used before +* calling this function. The data should be preserved. +*/ +#ifndef CONFIG_SYS_EARLY_GD gd_t data; gd = &data; -#endif
common/board_f.c static init_fnc_t init_sequence_f[] = { · line 988
Quoted 10 lines
common/board_f.c +0
-3/* * Clear global data before it is accessed at debug print * in initcall_run_list. Otherwise the debug print probably * get the wrong vaule of gd->have_console. */ -#if !defined(CONFIG_CPM2 ) && !defined(CONFIG_MPC512X ) && \ - !defined(CONFIG_MPC83xx) && !defined(CONFIG_MPC85xx) && \ - !defined(CONFIG_MPC86xx) && !defined(CONFIG_X86 )zero_global_data ();#endif
As a separate issue/patch, I think this should be defined for ARM also.
Regards,
Simon
PATCH v3 1/2 common/board_f: Preserve early global data
Quoted 29 lines · Simon Glass
Hi York,
Quoted 26 lines · York Sun
Some platforms (including mpc85xx, mpc86xx) use global data before calling function
baord_inti_f(). This data should not be cleared later. Any arch which needs to preserve global data should defineCONFIG_SYS_EARLY_GD.Signed-off-by York Sun <[email protected]>CC Scott Wood <[email protected]>CC Simon Glass <[email protected]>---
Change logv3: Introduce
CONFIG_SYS_EARLY_GDinstead of using a list
v2: Instead of adding back gd init for all PPC, preserve gd for mpc85xx and mpc86xx.README | 3 +++ arch/powerpc/include/asm/config.h | 2 ++ arch/x86/include/asm/config.h | 1 + common/board_f.c | 10 +++++----- 4 files changed, 11 insertions(+), 5 deletions(-)README +0
-0@@ -440,6 +440,9 @@ The following options need to be configured: supported, core will start to execute uboot when wakes up.
Quoted 8 lines
README The following options need to be configured: · line 445
Quoted 4 lines
README +3
-0- Generic CPU options: + CONFIG_SYS_EARLY_GD + Defines global data is used before board_init_f(). +This looks like a good solution, but I believe that 'early' is in fact where we are headed. So perhaps you should create an inverted option and define it for archs that don't support it?
I don't disagree for the long term. But since we just start to convert to generic board, fewer archs need this than those don't. I suggest we try this and when most archs convert to generic board, we can invert it if needed.
Quoted 8 lines
For what you have, I think
CONFIG_SYS_EARLY_GLOBAL_DATAmight be more descriptive. Also I think you should describe the purpose more precisely here - it's not just the use that you need to discuss.- The CPU init code must set it up and zero it
- Thenboard_init_f()doesn't zero it
Will add these.
York
PATCH v3 1/2 common/board_f: Preserve early global data
Quoted 39 lines · York Sun
Quoted 29 lines · Simon Glass
Hi York,
Quoted 26 lines · York Sun
Some platforms (including mpc85xx, mpc86xx) use global data before calling function
baord_inti_f(). This data should not be cleared later. Any arch which needs to preserve global data should defineCONFIG_SYS_EARLY_GD.Signed-off-by York Sun <[email protected]>CC Scott Wood <[email protected]>CC Simon Glass <[email protected]>---
Change logv3: Introduce
CONFIG_SYS_EARLY_GDinstead of using a list
v2: Instead of adding back gd init for all PPC, preserve gd for mpc85xx and mpc86xx.README | 3 +++ arch/powerpc/include/asm/config.h | 2 ++ arch/x86/include/asm/config.h | 1 + common/board_f.c | 10 +++++----- 4 files changed, 11 insertions(+), 5 deletions(-)README +0
-0@@ -440,6 +440,9 @@ The following options need to be configured: supported, core will start to execute uboot when wakes up.Quoted 8 lines
README The following options need to be configured: · line 445
Quoted 4 lines
README +3
-0- Generic CPU options: + CONFIG_SYS_EARLY_GD + Defines global data is used before board_init_f(). +This looks like a good solution, but I believe that 'early' is in fact where we are headed. So perhaps you should create an inverted option and define it for archs that don't support it?
Quoted 3 lines
I don't disagree for the long term. But since we just start to convert to generic board, fewer archs need this than those don't. I suggest we try this and when most archs convert to generic board, we can invert it if needed.
Why wait to do it right? Which arches actually don't need this, given that Simon said he thinks ARM needs it as well?
-Scott
PATCH v3 1/2 common/board_f: Preserve early global data
Quoted 40 lines · Scott Wood
Quoted 39 lines · York Sun
Quoted 37 lines · Simon Glass
Hi York,
Quoted 24 lines · York Sun
Some platforms (including mpc85xx, mpc86xx) use global data before calling function
baord_inti_f(). This data should not be cleared later. Any arch which needs to preserve global data should defineCONFIG_SYS_EARLY_GD.Signed-off-by York Sun <[email protected]>CC Scott Wood <[email protected]>CC Simon Glass <[email protected]>---
Change logv3: Introduce
CONFIG_SYS_EARLY_GDinstead of using a list
v2: Instead of adding back gd init for all PPC, preserve gd for mpc85xx and mpc86xx.README | 3 +++ arch/powerpc/include/asm/config.h | 2 ++ arch/x86/include/asm/config.h | 1 + common/board_f.c | 10 +++++----- 4 files changed, 11 insertions(+), 5 deletions(-)README +0
-0README The following options need to be configured: · line 445
Quoted 6 lines
README +3
-0@@ -440,6 +440,9 @@ The following options need to be configured: supported, core will start to execute uboot when wakes up. - Generic CPU options: + CONFIG_SYS_EARLY_GD + Defines global data is used before board_init_f(). +This looks like a good solution, but I believe that 'early' is in fact where we are headed. So perhaps you should create an inverted option and define it for archs that don't support it?
Quoted 7 lines
Quoted 3 lines
I don't disagree for the long term. But since we just start to convert to generic board, fewer archs need this than those don't. I suggest we try this and when most archs convert to generic board, we can invert it if needed.
Why wait to do it right? Which arches actually don't need this, given that Simon said he thinks ARM needs it as well?
Adding something I can't test?
Even Simon said he thinks ARM needs it, it is not what current code has. If I revert this logic,
#ifdef CONFIG_SYS_GLOBAL_DATA_STACK
gd_dt data;
gd = &data;
zero_global_data();#endif
I need to add #define CONFIG_SYS_GLOBAL_DATA_STACK to the board/arch who needs it. I have no idea which needs in the 70+ boards with CONFIG_DISPLAY_BOARDINFO defined.
York
PATCH v3 1/2 common/board_f: Preserve early global data
Quoted 45 lines · York Sun
Quoted 44 lines · Scott Wood
Quoted 42 lines · York Sun
Quoted 29 lines · Simon Glass
Hi York,
Quoted 26 lines · York Sun
Some platforms (including mpc85xx, mpc86xx) use global data before calling function
baord_inti_f(). This data should not be cleared later. Any arch which needs to preserve global data should defineCONFIG_SYS_EARLY_GD.Signed-off-by York Sun <[email protected]>CC Scott Wood <[email protected]>CC Simon Glass <[email protected]>---
Change logv3: Introduce
CONFIG_SYS_EARLY_GDinstead of using a list
v2: Instead of adding back gd init for all PPC, preserve gd for mpc85xx and mpc86xx.README | 3 +++ arch/powerpc/include/asm/config.h | 2 ++ arch/x86/include/asm/config.h | 1 + common/board_f.c | 10 +++++----- 4 files changed, 11 insertions(+), 5 deletions(-)README +0
-0@@ -440,6 +440,9 @@ The following options need to be configured: supported, core will start to execute uboot when wakes up.Quoted 8 lines
README The following options need to be configured: · line 445
Quoted 4 lines
README +3
-0- Generic CPU options: + CONFIG_SYS_EARLY_GD + Defines global data is used before board_init_f(). +This looks like a good solution, but I believe that 'early' is in fact where we are headed. So perhaps you should create an inverted option and define it for archs that don't support it?
I don't disagree for the long term. But since we just start to convert to generic board, fewer archs need this than those don't. I suggest we try this and when most archs convert to generic board, we can invert it if needed.
Quoted 5 lines
Quoted 3 lines
Why wait to do it right? Which arches actually don't need this, given that Simon said he thinks ARM needs it as well?
Adding something I can't test?
By that rationale nobody could ever make changes that aren't localized to a few boards. That type of development produces the sort of mess that the generic board is meant to remedy.
Quoted 4 lines
Even Simon said he thinks ARM needs it, it is not what current code has. If I revert this logic,
#ifdef
CONFIG_SYS_GLOBAL_DATA_STACK
This looks like a global stack of data, not global data on the stack.
How about CONFIG_SYS_GENERIC_GLOBAL_DATA?
Quoted 9 lines
gd_dt data; gd = &data; zero_global_data();#endif
I need to add #define
CONFIG_SYS_GLOBAL_DATA_STACKto the board/arch who needs it. I have no idea which needs in the 70+ boards withCONFIG_DISPLAY_BOARDINFOdefined.
I see only 10 boards that currently use CONFIG_SYS_GENERIC_BOARD in include/configs, plus sandbox and x86 which hide it in config.mk. I don't know what CONFIG_DISPLAY_BOARDINFO has to do with it. To invert the symbol, add the new symbol to all of the current users. Removal from ARM boards can come afterward if it's confirmed that it's the right thing to do.
-Scott
PATCH v3 1/2 common/board_f: Preserve early global data
+Albert
Hi,
Quoted 42 lines · Scott Wood
Quoted 41 lines · York Sun
Quoted 40 lines · Scott Wood
Quoted 39 lines · York Sun
Quoted 37 lines · Simon Glass
Hi York,
Quoted 24 lines · York Sun
Some platforms (including mpc85xx, mpc86xx) use global data before calling function
baord_inti_f(). This data should not be cleared later. Any arch which needs to preserve global data should defineCONFIG_SYS_EARLY_GD.Signed-off-by York Sun <[email protected]>CC Scott Wood <[email protected]>CC Simon Glass <[email protected]>---
Change logv3: Introduce
CONFIG_SYS_EARLY_GDinstead of using a list
v2: Instead of adding back gd init for all PPC, preserve gd for mpc85xx and mpc86xx.README | 3 +++ arch/powerpc/include/asm/config.h | 2 ++ arch/x86/include/asm/config.h | 1 + common/board_f.c | 10 +++++----- 4 files changed, 11 insertions(+), 5 deletions(-)README +0
-0README The following options need to be configured: · line 445
Quoted 6 lines
README +3
-0@@ -440,6 +440,9 @@ The following options need to be configured: supported, core will start to execute uboot when wakes up. - Generic CPU options: + CONFIG_SYS_EARLY_GD + Defines global data is used before board_init_f(). +This looks like a good solution, but I believe that 'early' is in fact where we are headed. So perhaps you should create an inverted option and define it for archs that don't support it?
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
I don't disagree for the long term. But since we just start to convert to generic board, fewer archs need this than those don't. I suggest we try this and when most archs convert to generic board, we can invert it if needed.
Why wait to do it right? Which arches actually don't need this, given that Simon said he thinks ARM needs it as well?
Thanks for working on this, York.
I looked at ARM and I think it is similar. See arch/arm/lib/crt0.S. It sets up gd - the only problem is that it does not zero the area unfortunately. But once that is added we can switch ARM over.
Quoted 27 lines
Quoted 3 lines
Quoted 1 line
Adding something I can't test?
By that rationale nobody could ever make changes that aren't localized to a few boards. That type of development produces the sort of mess that the generic board is meant to remedy.
Quoted 4 lines
Even Simon said he thinks ARM needs it, it is not what current code has. If I revert this logic,
#ifdef
CONFIG_SYS_GLOBAL_DATA_STACKThis looks like a global stack of data, not global data on the stack.
How about
CONFIG_SYS_GENERIC_GLOBAL_DATA?Quoted 9 lines
gd_dt data; gd = &data; zero_global_data();#endif
I need to add #define
CONFIG_SYS_GLOBAL_DATA_STACKto the board/arch who needs it. I have no idea which needs in the 70+ boards withCONFIG_DISPLAY_BOARDINFOdefined.
Quoted 6 lines
I see only 10 boards that currently use
CONFIG_SYS_GENERIC_BOARDininclude/configs, plus sandbox and x86 which hide it in config.mk. I don't know whatCONFIG_DISPLAY_BOARDINFOhas to do with it. To invert the symbol, add the new symbol to all of the current users. Removal from ARM boards can come afterward if it's confirmed that it's the right thing to do.
SGTM.
Regards,
Simon
PATCH v3 1/2 common/board_f: Preserve early global data
In reply to Scott WoodQuoted 75 lines · Scott Wood
Quoted 45 lines · York Sun
Quoted 44 lines · Scott Wood
Quoted 42 lines · York Sun
Quoted 29 lines · Simon Glass
Hi York,
Quoted 26 lines · York Sun
Some platforms (including mpc85xx, mpc86xx) use global data before calling function
baord_inti_f(). This data should not be cleared later. Any arch which needs to preserve global data should defineCONFIG_SYS_EARLY_GD.Signed-off-by York Sun <[email protected]>CC Scott Wood <[email protected]>CC Simon Glass <[email protected]>---
Change logv3: Introduce
CONFIG_SYS_EARLY_GDinstead of using a list
v2: Instead of adding back gd init for all PPC, preserve gd for mpc85xx and mpc86xx.README | 3 +++ arch/powerpc/include/asm/config.h | 2 ++ arch/x86/include/asm/config.h | 1 + common/board_f.c | 10 +++++----- 4 files changed, 11 insertions(+), 5 deletions(-)README +0
-0@@ -440,6 +440,9 @@ The following options need to be configured: supported, core will start to execute uboot when wakes up.Quoted 8 lines
README The following options need to be configured: · line 445
Quoted 4 lines
README +3
-0- Generic CPU options: + CONFIG_SYS_EARLY_GD + Defines global data is used before board_init_f(). +This looks like a good solution, but I believe that 'early' is in fact where we are headed. So perhaps you should create an inverted option and define it for archs that don't support it?
I don't disagree for the long term. But since we just start to convert to generic board, fewer archs need this than those don't. I suggest we try this and when most archs convert to generic board, we can invert it if needed.
Quoted 5 lines
Quoted 3 lines
Why wait to do it right? Which arches actually don't need this, given that Simon said he thinks ARM needs it as well?
Adding something I can't test?
By that rationale nobody could ever make changes that aren't localized to a few boards. That type of development produces the sort of mess that the generic board is meant to remedy.
Quoted 4 lines
Even Simon said he thinks ARM needs it, it is not what current code has. If I revert this logic,
#ifdef
CONFIG_SYS_GLOBAL_DATA_STACKThis looks like a global stack of data, not global data on the stack.
How about
CONFIG_SYS_GENERIC_GLOBAL_DATA?Quoted 9 lines
gd_dt data; gd = &data; zero_global_data();#endif
I need to add #define
CONFIG_SYS_GLOBAL_DATA_STACKto the board/arch who needs it. I have no idea which needs in the 70+ boards withCONFIG_DISPLAY_BOARDINFOdefined.
Quoted 6 lines
I see only 10 boards that currently use
CONFIG_SYS_GENERIC_BOARDininclude/configs, plus sandbox and x86 which hide it in config.mk. I don't know whatCONFIG_DISPLAY_BOARDINFOhas to do with it. To invert the symbol, add the new symbol to all of the current users. Removal from ARM boards can come afterward if it's confirmed that it's the right thing to do.
I made a typo when I search it. Yes, it is only 10 boards. I can add the new macro to their arch header file.
York
York