From: York Sun Date: Wed, 30 Apr 2014 18:01:00 -0700 Subject: [U-Boot] [Patch v3 1/2] common/board_f: Preserve early global data Message-ID: <1398906061-7119-1-git-send-email-yorksun@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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. Signed-off-by: York Sun CC: Scott Wood CC: Simon Glass --- 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(-) diff --git a/README b/README index 12758dc..1a51b11 100644 --- a/README +++ b/README @@ -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 diff --git a/arch/powerpc/include/asm/config.h b/arch/powerpc/include/asm/config.h index 423a6fb..4b6103b 100644 --- a/arch/powerpc/include/asm/config.h +++ b/arch/powerpc/include/asm/config.h @@ -10,11 +10,13 @@ #ifdef CONFIG_MPC85xx #include #define CONFIG_SYS_FSL_DDR +#define CONFIG_SYS_EARLY_GD #endif #ifdef CONFIG_MPC86xx #include #define CONFIG_SYS_FSL_DDR +#define CONFIG_SYS_EARLY_GD #endif #ifdef CONFIG_MPC83xx diff --git a/arch/x86/include/asm/config.h b/arch/x86/include/asm/config.h index f06a15c..940461d 100644 --- a/arch/x86/include/asm/config.h +++ b/arch/x86/include/asm/config.h @@ -7,5 +7,6 @@ #ifndef _ASM_CONFIG_H_ #define _ASM_CONFIG_H_ +#define CONFIG_SYS_EARLY_GD #define CONFIG_SYS_GENERIC_BOARD #endif diff --git a/common/board_f.c b/common/board_f.c index cbdf06f..0823bed 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -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 -- 1.7.9.5