From patchwork Thu May 1 23:00:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: York Sun X-Patchwork-Id: 344828 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3C4F3140102 for ; Fri, 2 May 2014 09:01:06 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B05974BD3B; Fri, 2 May 2014 01:01:04 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qjz+AqHIrYjv; Fri, 2 May 2014 01:01:04 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3206D4BD34; Fri, 2 May 2014 01:01:00 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 98FA14BD34 for ; Fri, 2 May 2014 01:00:57 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ql2T7EX9KJFa for ; Fri, 2 May 2014 01:00:54 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from na01-by2-obe.outbound.protection.outlook.com (mail-by2lp0243.outbound.protection.outlook.com [207.46.163.243]) by theia.denx.de (Postfix) with ESMTPS id 19C374BD2B for ; Fri, 2 May 2014 01:00:50 +0200 (CEST) Received: from BY2PR03CA033.namprd03.prod.outlook.com (10.242.234.154) by BY2PR03MB396.namprd03.prod.outlook.com (10.141.141.26) with Microsoft SMTP Server (TLS) id 15.0.929.12; Thu, 1 May 2014 23:00:46 +0000 Received: from BL2FFO11FD023.protection.gbl (2a01:111:f400:7c09::168) by BY2PR03CA033.outlook.office365.com (2a01:111:e400:2c2c::26) with Microsoft SMTP Server (TLS) id 15.0.934.12 via Frontend Transport; Thu, 1 May 2014 23:00:46 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.1) by BL2FFO11FD023.mail.protection.outlook.com (10.173.161.102) with Microsoft SMTP Server (TLS) id 15.0.929.8 via Frontend Transport; Thu, 1 May 2014 23:00:46 +0000 Received: from oslab-l1.am.freescale.net ([10.214.81.185]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id s41N0hPu029515; Thu, 1 May 2014 16:00:43 -0700 From: York Sun To: Date: Thu, 1 May 2014 16:00:39 -0700 Message-ID: <1398985240-23670-1-git-send-email-yorksun@freescale.com> X-Mailer: git-send-email 1.7.9.5 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.168.1; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009001)(6009001)(428001)(189002)(199002)(74502001)(74662001)(4396001)(76482001)(6806004)(50986999)(31966008)(101416001)(33646001)(87286001)(19580405001)(44976005)(46102001)(83322001)(87936001)(19580395003)(80976001)(77096999)(50226001)(80022001)(20776003)(99396002)(50466002)(47776003)(77982001)(48376002)(86362001)(83072002)(89996001)(93916002)(85852003)(36756003)(81542001)(81342001)(62966002)(77156001)(92566001)(92726001)(88136002)(79102001)(41533002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR03MB396; H:tx30smr01.am.freescale.net; FPR:ECE6FCD4.AFF08829.7CF02B5F.4ED85E48.20388; MLV:sfv; PTR:gate-tx3.freescale.com; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Forefront-PRVS: 01986AE76B Received-SPF: None (: freescale.com does not designate permitted sender hosts) X-OriginatorOrg: freescale.com Cc: scottwood@freescale.com, u-boot@lists.denx.de, York Sun Subject: [U-Boot] [Patch v4 1/2] common/board_f: Initialized global data for generic board X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Some platforms (tested on mpc85xx, mpc86xx) use global data before calling function baord_inti_f(). The data should not be cleared later. Any arch which uses global data in generic board board_init_f() should define CONFIG_SYS_GENERIC_GLOBAL_DATA. Signed-off-by: York Sun CC: Scott Wood CC: Simon Glass CC: Albert ARIBAUD Reviewed-by: Simon Glass --- Change log v4: Replace with CONFIG_SYS_GENERIC_GLOBAL_DATA, a positive logic 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 | 6 ++++++ arch/arc/include/asm/config.h | 2 ++ arch/arm/include/asm/config.h | 2 ++ arch/mips/include/asm/config.h | 2 ++ common/board_f.c | 12 +++++++----- 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/README b/README index 12758dc..c66f988 100644 --- a/README +++ b/README @@ -440,6 +440,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 5761def..3d331cc 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 abf79e5..2a20a77 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 3a891ba..1c8a42b 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/common/board_f.c b/common/board_f.c index cbdf06f..7601a98 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -970,20 +970,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