From 75a279c8f28539f560a23425073d97ffee746716 Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Sun, 6 Jan 2013 00:54:20 +0000 Subject: MIPS: bootm.c: use debug macro to print debug message The '## Transferring control ...' message is printed only if DEBUG is enabled. Get rid of the 'ifdef DEBUG' statement and use the debug macro instead. Signed-off-by: Gabor Juhos --- arch/mips/lib/bootm.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'arch/mips/lib') diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 608c1a78db..4ac712aa4b 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -59,10 +59,8 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootstage_mark(BOOTSTAGE_ID_RUN_OS); -#ifdef DEBUG - printf("## Transferring control to Linux (at address %08lx) ...\n", + debug("## Transferring control to Linux (at address %08lx) ...\n", (ulong) theKernel); -#endif linux_params_init(UNCACHED_SDRAM(gd->bd->bi_boot_params), commandline); -- cgit From e08634c7bfdb5fcda2541a8845d44888538d6178 Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Mon, 7 Jan 2013 02:53:40 +0000 Subject: MIPS: bootm.c: separate linux jump code 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(-) (limited to 'arch/mips/lib') diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 4ac712aa4b..689d17bd35 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; -- cgit From 0ea7213f63f580aa679a36795831dabd35d786aa Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Mon, 7 Jan 2013 02:53:41 +0000 Subject: MIPS: bootm.c: separate environment initialization Move the environment initialization 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 | 50 +++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) (limited to 'arch/mips/lib') diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 689d17bd35..8c2e508243 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -43,34 +43,12 @@ 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) +static void boot_prep_linux(bootm_headers_t *images) { char *commandline = getenv("bootargs"); char env_buf[12]; char *cp; - if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) - return 1; - linux_params_init(UNCACHED_SDRAM(gd->bd->bi_boot_params), commandline); #ifdef CONFIG_MEMSIZE_IN_BYTES @@ -103,7 +81,33 @@ int do_bootm_linux(int flag, int argc, char * const argv[], cp = getenv("eth1addr"); if (cp) linux_env_set("eth1addr", cp); +} + +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) +{ + if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) + return 1; + boot_prep_linux(images); boot_jump_linux(images); /* does not return */ -- cgit From 9c170e2ef4ad2bd246c22c93824d754224c4929a Mon Sep 17 00:00:00 2001 From: Gabor Juhos Date: Mon, 7 Jan 2013 02:53:42 +0000 Subject: MIPS: bootm.c: add support for 'prep' and 'go' subcommands The bootm command supports subcommands since long time however those subcommands are not yet usable on MIPS. The patch is based on the ARM implementation, and it adds support for the 'prep' and 'go' subcommands only. Signed-off-by: Gabor Juhos Cc: Daniel Schwierzeck --- arch/mips/lib/bootm.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'arch/mips/lib') diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c index 8c2e508243..a36154a892 100644 --- a/arch/mips/lib/bootm.c +++ b/arch/mips/lib/bootm.c @@ -104,8 +104,19 @@ static void boot_jump_linux(bootm_headers_t *images) int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images) { - if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) - return 1; + /* No need for those on MIPS */ + if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE) + return -1; + + if (flag & BOOTM_STATE_OS_PREP) { + boot_prep_linux(images); + return 0; + } + + if (flag & BOOTM_STATE_OS_GO) { + boot_jump_linux(images); + return 0; + } boot_prep_linux(images); boot_jump_linux(images); -- cgit