From patchwork Fri Mar 2 02:55:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Chou X-Patchwork-Id: 144125 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 3BCFE1007D6 for ; Fri, 2 Mar 2012 13:54:35 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EFAFF2807C; Fri, 2 Mar 2012 03:54:31 +0100 (CET) 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 qlJbmr-dqqz9; Fri, 2 Mar 2012 03:54:31 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id ACCE62807E; Fri, 2 Mar 2012 03:54:29 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7A0932807E for ; Fri, 2 Mar 2012 03:54:26 +0100 (CET) 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 2cq-ZSDDmb7o for ; Fri, 2 Mar 2012 03:54:20 +0100 (CET) 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 www.wytron.com.tw (unknown [211.75.82.101]) by theia.denx.de (Postfix) with ESMTP id 4C4192807C for ; Fri, 2 Mar 2012 03:54:17 +0100 (CET) Received: from darkstar.wytron.com.tw (unknown [192.168.1.15]) by www.wytron.com.tw (Postfix) with ESMTP id 1A8D62CC06B; Fri, 2 Mar 2012 10:54:11 +0800 (CST) From: Thomas Chou To: u-boot@lists.denx.de Date: Fri, 2 Mar 2012 10:55:25 +0800 Message-Id: <1330656925-8930-1-git-send-email-thomas@wytron.com.tw> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <201203011217.24148.vapier@gentoo.org> References: <201203011217.24148.vapier@gentoo.org> Subject: [U-Boot] [PATCH v2] nios2: move gd and bd into BSS 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: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de As suggested by Graeme Russ, move gd and bd data structrures to BSS instead of calculating the locations around the stack and heap. Signed-off-by: Thomas Chou Acked-by: Mike Frysinger --- For u-boot. v2, mark gd/bd static arch/nios2/lib/board.c | 12 +++++------- include/configs/nios2-generic.h | 12 ++++-------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/arch/nios2/lib/board.c b/arch/nios2/lib/board.c index 65de26e..6aa6b9c 100644 --- a/arch/nios2/lib/board.c +++ b/arch/nios2/lib/board.c @@ -87,17 +87,15 @@ void board_init (void) { bd_t *bd; init_fnc_t **init_fnc_ptr; + static gd_t gd_data; + static bd_t bd_data; - /* Pointer is writable since we allocated a register for it. - * Nios treats CONFIG_SYS_GBL_DATA_OFFSET as an address. - */ - gd = (gd_t *)CONFIG_SYS_GBL_DATA_OFFSET; + /* Pointer is writable since we allocated a register for it. */ + gd = &gd_data; /* compiler optimization barrier needed for GCC >= 3.4 */ __asm__ __volatile__("": : :"memory"); - memset( gd, 0, GENERATED_GBL_DATA_SIZE ); - - gd->bd = (bd_t *)(gd+1); /* At end of global data */ + gd->bd = &bd_data; gd->baudrate = CONFIG_BAUDRATE; gd->cpu_clk = CONFIG_SYS_CLK_FREQ; diff --git a/include/configs/nios2-generic.h b/include/configs/nios2-generic.h index 17017a5..6a79d09 100644 --- a/include/configs/nios2-generic.h +++ b/include/configs/nios2-generic.h @@ -117,10 +117,9 @@ /* * MEMORY ORGANIZATION - * -Monitor at top of sdram. - * -The heap is placed below the monitor - * -Global data is placed below the heap. - * -The stack is placed below global data (&grows down). + * -Monitor at top of sdram. + * -The heap is placed below the monitor + * -The stack is placed below the heap (&grows down). */ #define CONFIG_MONITOR_IS_IN_RAM #define CONFIG_SYS_MONITOR_LEN 0x40000 /* Reserve 256k */ @@ -130,10 +129,7 @@ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 0x20000) #define CONFIG_SYS_MALLOC_BASE (CONFIG_SYS_MONITOR_BASE - \ CONFIG_SYS_MALLOC_LEN) -#define CONFIG_SYS_GBL_DATA_OFFSET (CONFIG_SYS_MALLOC_BASE - \ - GENERATED_GBL_DATA_SIZE - \ - GENERATED_BD_INFO_SIZE) -#define CONFIG_SYS_INIT_SP CONFIG_SYS_GBL_DATA_OFFSET +#define CONFIG_SYS_INIT_SP CONFIG_SYS_MALLOC_BASE /* * MISC