From patchwork Mon Jan 7 12:53:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabor Juhos X-Patchwork-Id: 209911 X-Patchwork-Delegate: daniel.schwierzeck@googlemail.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 0F40D2C009F for ; Mon, 7 Jan 2013 23:54:24 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AE6EA4A040; Mon, 7 Jan 2013 13:54:13 +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 qb4Dk16o7+5m; Mon, 7 Jan 2013 13:54:13 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B9B334A039; Mon, 7 Jan 2013 13:54:01 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 153894A026 for ; Mon, 7 Jan 2013 13:53:58 +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 uELWRiwcnYeY for ; Mon, 7 Jan 2013 13:53:53 +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 arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) by theia.denx.de (Postfix) with ESMTPS id 3E4FF4A025 for ; Mon, 7 Jan 2013 13:53:51 +0100 (CET) Received: from arrakis.dune.hu ([127.0.0.1]) by localhost (arrakis.dune.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id N9wabxSl_zeY; Mon, 7 Jan 2013 13:52:49 +0100 (CET) Received: from localhost.localdomain (catvpool-576570d8.szarvasnet.hu [87.101.112.216]) by arrakis.dune.hu (Postfix) with ESMTPSA id 6D71D283C2B; Mon, 7 Jan 2013 13:52:49 +0100 (CET) From: Gabor Juhos To: u-boot@lists.denx.de Date: Mon, 7 Jan 2013 13:53:40 +0100 Message-Id: <1357563222-18426-1-git-send-email-juhosg@openwrt.org> X-Mailer: git-send-email 1.7.10 Subject: [U-Boot] [PATCH 1/3] MIPS: bootm.c: separate linux jump code 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 Move the actual jump code into a separate function. This make the code reusable for bootm subcommands. Signed-off-by: Gabor Juhos Cc: Daniel Schwierzeck --- arch/mips/lib/bootm.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 4ac712a..689d17b 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -43,10 +43,27 @@ static int linux_env_idx; static void linux_params_init(ulong start, char *commandline); static void linux_env_set(char *env_name, char *env_val); +static void boot_jump_linux(bootm_headers_t *images) +{ + void (*theKernel) (int, char **, char **, int *); + + /* find kernel entry point */ + theKernel = (void (*)(int, char **, char **, int *))images->ep; + + debug("## Transferring control to Linux (at address %08lx) ...\n", + (ulong) theKernel); + + bootstage_mark(BOOTSTAGE_ID_RUN_OS); + + /* we assume that the kernel is in place */ + printf("\nStarting kernel ...\n\n"); + + theKernel(linux_argc, linux_argv, linux_env, 0); +} + int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images) { - void (*theKernel) (int, char **, char **, int *); char *commandline = getenv("bootargs"); char env_buf[12]; char *cp; @@ -54,14 +71,6 @@ int do_bootm_linux(int flag, int argc, char * const argv[], if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) return 1; - /* find kernel entry point */ - theKernel = (void (*)(int, char **, char **, int *))images->ep; - - bootstage_mark(BOOTSTAGE_ID_RUN_OS); - - debug("## Transferring control to Linux (at address %08lx) ...\n", - (ulong) theKernel); - linux_params_init(UNCACHED_SDRAM(gd->bd->bi_boot_params), commandline); #ifdef CONFIG_MEMSIZE_IN_BYTES @@ -95,10 +104,7 @@ int do_bootm_linux(int flag, int argc, char * const argv[], if (cp) linux_env_set("eth1addr", cp); - /* we assume that the kernel is in place */ - printf("\nStarting kernel ...\n\n"); - - theKernel(linux_argc, linux_argv, linux_env, 0); + boot_jump_linux(images); /* does not return */ return 1;