aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README6
-rw-r--r--arch/arc/include/asm/config.h2
-rw-r--r--arch/arm/include/asm/config.h2
-rw-r--r--arch/mips/include/asm/config.h2
-rw-r--r--arch/sandbox/include/asm/config.h1
-rw-r--r--common/board_f.c12
6 files changed, 20 insertions, 5 deletions
diff --git a/README b/README
index 61c2caca316..5f895520e82 100644
--- a/README
+++ b/README
@@ -451,6 +451,12 @@ The following options need to be configured:
supported, core will start to execute uboot when wakes up.
- Generic CPU options:
+ CONFIG_SYS_GENERIC_GLOBAL_DATA
+ Defines global data is initialized in generic board board_init_f().
+ If this macro is defined, global data is created and cleared in
+ generic board board_init_f(). Without this macro, architecture/board
+ should initialize global data before calling board_init_f().
+
CONFIG_SYS_BIG_ENDIAN, CONFIG_SYS_LITTLE_ENDIAN
Defines the endianess of the CPU. Implementation of those
diff --git a/arch/arc/include/asm/config.h b/arch/arc/include/asm/config.h
index 5761def1e71..3d331cc970d 100644
--- a/arch/arc/include/asm/config.h
+++ b/arch/arc/include/asm/config.h
@@ -7,6 +7,8 @@
#ifndef __ASM_ARC_CONFIG_H_
#define __ASM_ARC_CONFIG_H_
+#define CONFIG_SYS_GENERIC_GLOBAL_DATA
+
#define CONFIG_LMB
#endif /*__ASM_ARC_CONFIG_H_ */
diff --git a/arch/arm/include/asm/config.h b/arch/arm/include/asm/config.h
index abf79e5c9ed..2a20a770bcd 100644
--- a/arch/arm/include/asm/config.h
+++ b/arch/arm/include/asm/config.h
@@ -7,6 +7,8 @@
#ifndef _ASM_CONFIG_H_
#define _ASM_CONFIG_H_
+#define CONFIG_SYS_GENERIC_GLOBAL_DATA
+
#define CONFIG_LMB
#define CONFIG_SYS_BOOT_RAMDISK_HIGH
diff --git a/arch/mips/include/asm/config.h b/arch/mips/include/asm/config.h
index 3a891ba6272..1c8a42bd2f6 100644
--- a/arch/mips/include/asm/config.h
+++ b/arch/mips/include/asm/config.h
@@ -7,6 +7,8 @@
#ifndef _ASM_CONFIG_H_
#define _ASM_CONFIG_H_
+#define CONFIG_SYS_GENERIC_GLOBAL_DATA
+
#define CONFIG_LMB
#define CONFIG_SYS_BOOT_RAMDISK_HIGH
diff --git a/arch/sandbox/include/asm/config.h b/arch/sandbox/include/asm/config.h
index ec7729eb4cc..6c1bff99c2b 100644
--- a/arch/sandbox/include/asm/config.h
+++ b/arch/sandbox/include/asm/config.h
@@ -7,6 +7,7 @@
#ifndef _ASM_CONFIG_H_
#define _ASM_CONFIG_H_
+#define CONFIG_SYS_GENERIC_GLOBAL_DATA
#define CONFIG_SANDBOX_ARCH
/* Used by drivers/spi/sandbox_spi.c and arch/sandbox/include/asm/state.h */
diff --git a/common/board_f.c b/common/board_f.c
index aea6bff5551..b6be386a7f7 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -961,20 +961,22 @@ static init_fnc_t init_sequence_f[] = {
void board_init_f(ulong boot_flags)
{
-#ifndef CONFIG_X86
+#ifdef CONFIG_SYS_GENERIC_GLOBAL_DATA
+ /*
+ * For some archtectures, global data is initialized and used before
+ * calling this function. The data should be preserved. For others,
+ * CONFIG_SYS_GENERIC_GLOBAL_DATA should be defined and use the stack
+ * here to host global data until relocation.
+ */
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