From patchwork Mon Jan 3 19:46:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Graeme Russ X-Patchwork-Id: 77340 X-Patchwork-Delegate: graeme.russ@gmail.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 64E29B6F14 for ; Tue, 4 Jan 2011 06:53:54 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 237E6284D6; Mon, 3 Jan 2011 20:51:11 +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 TwVUunvtAUKm; Mon, 3 Jan 2011 20:51:10 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 72E2A28431; Mon, 3 Jan 2011 20:50:23 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C81CB283BA for ; Mon, 3 Jan 2011 20:50:19 +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 iETcbeTr87fo for ; Mon, 3 Jan 2011 20:50:19 +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-fx0-f44.google.com (mail-fx0-f44.google.com [209.85.161.44]) by theia.denx.de (Postfix) with ESMTP id 2FD7A283C2 for ; Mon, 3 Jan 2011 20:49:26 +0100 (CET) Received: by mail-fx0-f44.google.com with SMTP id 9so12889169fxm.3 for ; Mon, 03 Jan 2011 11:49:26 -0800 (PST) Received: by 10.223.120.193 with SMTP id e1mr335644far.106.1294084166731; Mon, 03 Jan 2011 11:49:26 -0800 (PST) Received: from helios.localdomain6 (d122-104-38-246.sbr6.nsw.optusnet.com.au [122.104.38.246]) by mx.google.com with ESMTPS id a6sm3124092fak.1.2011.01.03.11.49.23 (version=SSLv3 cipher=RC4-MD5); Mon, 03 Jan 2011 11:49:25 -0800 (PST) From: Graeme Russ To: u-boot@lists.denx.de Date: Tue, 4 Jan 2011 06:46:54 +1100 Message-Id: <1294084016-2674-35-git-send-email-graeme.russ@gmail.com> X-Mailer: git-send-email 1.7.1.422.g049e9 In-Reply-To: <1294084016-2674-1-git-send-email-graeme.russ@gmail.com> References: <1294084016-2674-1-git-send-email-graeme.russ@gmail.com> Subject: [U-Boot] [RFC][PATCH 34/36] x86 - Convert board_init_f to use an init_sequence 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 --- arch/i386/lib/board.c | 68 +++++++++++++++++++++--------------------------- 1 files changed, 30 insertions(+), 38 deletions(-) --- 1.7.1.422.g049e9 diff --git a/arch/i386/lib/board.c b/arch/i386/lib/board.c index 35d7afd..6888d53 100644 --- a/arch/i386/lib/board.c +++ b/arch/i386/lib/board.c @@ -156,7 +156,29 @@ static void display_flash_config (ulong size) */ typedef int (init_fnc_t) (void); -init_fnc_t *init_sequence[] = { +int dram_init_f(void); +static int calculate_relocation_address(void); +static int copy_uboot_to_ram(void); +static int clear_bss(void); +static int do_elf_reloc_fixups(void); + +init_fnc_t *init_sequence_f[] = { + cpu_init_f, + board_early_init_f, + env_init, + init_baudrate, + serial_init, + console_init_f, + dram_init_f, + calculate_relocation_address, + copy_uboot_to_ram, + clear_bss, + do_elf_reloc_fixups, + + NULL, +}; + +init_fnc_t *init_sequence_r[] = { cpu_init_r, /* basic cpu dependent setup */ board_early_init_r, /* basic board dependent setup */ dram_init, /* configure available RAM banks */ @@ -170,8 +192,6 @@ init_fnc_t *init_sequence[] = { gd_t *gd; -int dram_init_f(void); - static int calculate_relocation_address(void) { void *text_start = &__text_start; @@ -237,41 +257,13 @@ static int do_elf_reloc_fixups(void) */ void board_init_f (ulong boot_flags) { - /* First stage CPU initialization */ - if (cpu_init_f() != 0) - hang(); - - /* First stage Board initialization */ - if (board_early_init_f() != 0) - hang(); - - if (env_init() != 0) - hang(); - - if (init_baudrate() != 0) - hang(); - - if (serial_init() != 0) - hang(); - - if (console_init_f() != 0) - hang(); - - if (dram_init_f() != 0) - hang(); - - if (calculate_relocation_address() != 0) - hang(); - - /* Copy U-Boot into RAM */ - if (copy_uboot_to_ram() != 0) - hang(); - - if (clear_bss() != 0) - hang(); + init_fnc_t **init_fnc_ptr; - if (do_elf_reloc_fixups() != 0) - hang(); + for (init_fnc_ptr = init_sequence_f; *init_fnc_ptr; ++init_fnc_ptr) { + if ((*init_fnc_ptr)() != 0) { + hang (); + } + } gd->flags |= GD_FLG_RELOC; @@ -309,7 +301,7 @@ void board_init_r(gd_t *id, ulong dest_addr) mem_malloc_init((((ulong)dest_addr - CONFIG_SYS_MALLOC_LEN)+3)&~3, CONFIG_SYS_MALLOC_LEN); - for (init_fnc_ptr = init_sequence, i=0; *init_fnc_ptr; ++init_fnc_ptr, i++) { + for (init_fnc_ptr = init_sequence_r, i=0; *init_fnc_ptr; ++init_fnc_ptr, i++) { show_boot_progress(0xa130|i); if ((*init_fnc_ptr)() != 0) {