From patchwork Tue Dec 21 18:12:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 76310 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 5DB86B70A9 for ; Wed, 22 Dec 2010 05:13:38 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 58AC22819D; Tue, 21 Dec 2010 19:13:21 +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 n2gIC613vaDn; Tue, 21 Dec 2010 19:13:21 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 43598281C7; Tue, 21 Dec 2010 19:13:16 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1CA4228179 for ; Tue, 21 Dec 2010 19:13:08 +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 W-8WutgsgQXW for ; Tue, 21 Dec 2010 19:13:07 +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 mail-bw0-f46.google.com (mail-bw0-f46.google.com [209.85.214.46]) by theia.denx.de (Postfix) with ESMTP id AE35D2817A for ; Tue, 21 Dec 2010 19:13:07 +0100 (CET) Received: by mail-bw0-f46.google.com with SMTP id 15so4855270bwz.33 for ; Tue, 21 Dec 2010 10:13:07 -0800 (PST) Received: by 10.204.77.199 with SMTP id h7mr4941121bkk.79.1292955187364; Tue, 21 Dec 2010 10:13:07 -0800 (PST) Received: from localhost ([178.23.216.97]) by mx.google.com with ESMTPS id f20sm2000685bkf.16.2010.12.21.10.13.05 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 21 Dec 2010 10:13:06 -0800 (PST) From: Michal Simek To: u-boot@lists.denx.de Date: Tue, 21 Dec 2010 19:12:58 +0100 Message-Id: <1292955178-13018-3-git-send-email-monstr@monstr.eu> X-Mailer: git-send-email 1.5.5.1 In-Reply-To: <1292955178-13018-2-git-send-email-monstr@monstr.eu> References: <1292955178-13018-1-git-send-email-monstr@monstr.eu> <1292955178-13018-2-git-send-email-monstr@monstr.eu> Subject: [U-Boot] [PATCH 3/3] microblaze: Fix bdiinfo pointer X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 Patch "Replace CONFIG_SYS_GBL_DATA_SIZE by auto-generated value" (sha1: 25ddd1fb0a2281b182529afbc8fda5de2dc16d96) introduce GENERATED_GBL_DATA_SIZE which is sizeof aligned gd_t (currently 0x40). Microblaze configs used 0x40(128) because this place also contained board info structure which lies on the top of ram. U-Boot is placed to the top of the ram (for example 0xd7ffffff) and bd structure was moved out of ram. This patch is fixing this scheme with GENERATED_BD_INFO_SIZE which swap global data and board info structures. For example: Current: gd 0xd7ffffc0, bd 0xd8000000 Fixed: gd 0xd7ffffc0, bd 0xd7ffff90 Signed-off-by: Michal Simek --- arch/microblaze/lib/board.c | 7 ++++--- include/configs/microblaze-generic.h | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/microblaze/lib/board.c b/arch/microblaze/lib/board.c index eeef579..8232cf0 100644 --- a/arch/microblaze/lib/board.c +++ b/arch/microblaze/lib/board.c @@ -91,15 +91,16 @@ void board_init (void) bd_t *bd; init_fnc_t **init_fnc_ptr; gd = (gd_t *) CONFIG_SYS_GBL_DATA_OFFSET; + bd = (bd_t *) CONFIG_SYS_GBL_DATA_OFFSET - GENERATED_BD_INFO_SIZE; char *s; #if defined(CONFIG_CMD_FLASH) ulong flash_size = 0; #endif asm ("nop"); /* FIXME gd is not initialize - wait */ - memset ((void *)gd, 0, GENERATED_GBL_DATA_SIZE); - gd->bd = (bd_t *) (gd + 1); /* At end of global data */ + memset ((void *)bd, 0, GENERATED_GBL_DATA_SIZE + + GENERATED_BD_INFO_SIZE); + gd->bd = bd; gd->baudrate = CONFIG_BAUDRATE; - bd = gd->bd; bd->bi_baudrate = CONFIG_BAUDRATE; bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; diff --git a/include/configs/microblaze-generic.h b/include/configs/microblaze-generic.h index 75e4e07..fdfc0d8 100644 --- a/include/configs/microblaze-generic.h +++ b/include/configs/microblaze-generic.h @@ -142,9 +142,10 @@ /* monitor code */ #define SIZE 0x40000 -#define CONFIG_SYS_MONITOR_LEN (SIZE - GENERATED_GBL_DATA_SIZE) +#define CONFIG_SYS_MONITOR_LEN SIZE #define CONFIG_SYS_MONITOR_BASE \ - (CONFIG_SYS_GBL_DATA_OFFSET - CONFIG_SYS_MONITOR_LEN) + (CONFIG_SYS_GBL_DATA_OFFSET - CONFIG_SYS_MONITOR_LEN \ + - GENERATED_BD_INFO_SIZE) #define CONFIG_SYS_MONITOR_END \ (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN) #define CONFIG_SYS_MALLOC_LEN SIZE