From patchwork Tue Sep 10 08:12:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fenghua@phytium.com.cn X-Patchwork-Id: 273780 X-Patchwork-Delegate: albert.aribaud@free.fr 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 C9C132C00D6 for ; Tue, 10 Sep 2013 18:15:13 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id ECC9C4A05F; Tue, 10 Sep 2013 10:14:54 +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 L8PEKmrz5w85; Tue, 10 Sep 2013 10:14:54 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D8D134A060; Tue, 10 Sep 2013 10:14:33 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4CE644A05F for ; Tue, 10 Sep 2013 10:14:23 +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 Y+vJ4kVyiFti for ; Tue, 10 Sep 2013 10:14:22 +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 APP8.CORPEASE.NET (APP8.CORPEASE.NET [61.145.121.10]) by theia.denx.de (Postfix) with ESMTP id A3B944A08B for ; Tue, 10 Sep 2013 10:14:09 +0200 (CEST) Received: from localhost (unknown [220.202.152.85]) by app8.corpease.net (Coremail) with SMTP id CgGowHAbUQJu1C5SUGkQAA--.11783S3; Tue, 10 Sep 2013 16:12:31 +0800 (CST) From: fenghua@phytium.com.cn To: u-boot@lists.denx.de Date: Tue, 10 Sep 2013 16:12:09 +0800 Message-Id: <1378800731-16462-4-git-send-email-fenghua@phytium.com.cn> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1378800731-16462-3-git-send-email-fenghua@phytium.com.cn> References: <1378800731-16462-1-git-send-email-fenghua@phytium.com.cn> <1378800731-16462-2-git-send-email-fenghua@phytium.com.cn> <1378800731-16462-3-git-send-email-fenghua@phytium.com.cn> X-CM-TRANSID: CgGowHAbUQJu1C5SUGkQAA--.11783S3 X-Coremail-Antispam: 1UD129KBjvJXoWxJw4ktrW3GryrWw15WFykXwb_yoW5Cr18pr 1xGF45Gr4rt3yxt3yIv3sI9r9Iyrs3trWIqr17GryrJw18Cw4fXrn7tw12qry2grZ8Xan5 AFykGws8u3WUuw7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvGb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Jr0_JF4l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVWUJVW8JwA2z4x0Y4vEx4A2jsIEc7CjxV AFwI0_Gr0_Gr1UM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40E x7xfMcIj6xIIjxv20xvE14v26r1Y6r17McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x 0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4kE6xkI j40Ew7xC0wCY02Avz4vE14v_GFyl42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr 0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY 17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcV C0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY 6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa 73UjIFyTuYvj4RJUUUUUUUU X-Originating-IP: [220.202.152.85] X-CM-SenderInfo: pihqwxdxd61x51wl3zoofrzhdfq/ Cc: trini@ti.com, David Feng Subject: [U-Boot] [PATCH v7 3/5] generic board patch of manual reloc and zero gd_t 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 From: David Feng Signed-off-by: David Feng --- common/board_f.c | 19 +++++++++++-------- common/board_r.c | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/common/board_f.c b/common/board_f.c index 0ada1af..f6ca610 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -458,7 +458,7 @@ static int reserve_round_4k(void) static int reserve_mmu(void) { /* reserve TLB table */ - gd->arch.tlb_size = 4096 * 4; + gd->arch.tlb_size = PGTABLE_SIZE; gd->relocaddr -= gd->arch.tlb_size; /* round down to next 64 kB limit */ @@ -610,7 +610,7 @@ static int reserve_stacks(void) * TODO(sjg@chromium.org): Perhaps create arch_reserve_stack() * to handle this and put in arch/xxx/lib/stack.c */ -# ifdef CONFIG_ARM +# if defined(CONFIG_ARM) && !defined(CONFIG_ARMV8) # ifdef CONFIG_USE_IRQ gd->start_addr_sp -= (CONFIG_STACKSIZE_IRQ + CONFIG_STACKSIZE_FIQ); debug("Reserving %zu Bytes for IRQ stack at: %08lx\n", @@ -807,11 +807,6 @@ static int mark_bootstage(void) } static init_fnc_t init_sequence_f[] = { -#if !defined(CONFIG_CPM2) && !defined(CONFIG_MPC512X) && \ - !defined(CONFIG_MPC83xx) && !defined(CONFIG_MPC85xx) && \ - !defined(CONFIG_MPC86xx) && !defined(CONFIG_X86) - zero_global_data, -#endif #ifdef CONFIG_SANDBOX setup_ram_buf, #endif @@ -1001,10 +996,18 @@ void board_init_f(ulong boot_flags) { #ifndef CONFIG_X86 gd_t data; - gd = &data; #endif + /* + * Zero gd_t first, otherwise the debug print(if DEBUG defined) + * in initcall_run_list function before zero_global_data is called + * will go wrong. + */ +#ifndef CONFIG_X86 + zero_global_data(); +#endif + gd->flags = boot_flags; if (initcall_run_list(init_sequence_f)) diff --git a/common/board_r.c b/common/board_r.c index 86ca1cb..7217e3c 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -157,6 +157,13 @@ static int initr_reloc_global_data(void) */ gd->env_addr += gd->relocaddr - CONFIG_SYS_MONITOR_BASE; #endif +#ifdef CONFIG_NEEDS_MANUAL_RELOC + /* + * We have to relocate the command table manually + */ + fixup_cmdtable(ll_entry_start(cmd_tbl_t, cmd), + ll_entry_count(cmd_tbl_t, cmd)); +#endif /* CONFIG_NEEDS_MANUAL_RELOC */ return 0; } @@ -899,6 +906,7 @@ init_fnc_t init_sequence_r[] = { initr_modem, #endif run_main_loop, + NULL, }; void board_init_r(gd_t *new_gd, ulong dest_addr) @@ -906,6 +914,16 @@ void board_init_r(gd_t *new_gd, ulong dest_addr) #ifndef CONFIG_X86 gd = new_gd; #endif +#ifdef CONFIG_NEEDS_MANUAL_RELOC + /* + * We have to relocate the init_sequence_r table manually + */ + init_fnc_t *init_fnc_ptr; + for (init_fnc_ptr = init_sequence_r; *init_fnc_ptr; ++init_fnc_ptr) + *init_fnc_ptr = (init_fnc_t *) + ((unsigned long)(*init_fnc_ptr) + gd->reloc_off); +#endif /* CONFIG_NEEDS_MANUAL_RELOC */ + if (initcall_run_list(init_sequence_r)) hang();