]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - arch/blackfin/lib/boot.c
Make sure that argv[] argument pointers are not modified.
[karo-tx-uboot.git] / arch / blackfin / lib / boot.c
1 /*
2  * U-boot - boot.c - misc boot helper functions
3  *
4  * Copyright (c) 2005-2008 Analog Devices Inc.
5  *
6  * (C) Copyright 2000-2004
7  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8  *
9  * Licensed under the GPL-2 or later.
10  */
11
12 #include <common.h>
13 #include <command.h>
14 #include <image.h>
15 #include <asm/blackfin.h>
16
17 #ifdef SHARED_RESOURCES
18 extern void swap_to(int device_id);
19 #endif
20
21 static char *make_command_line(void)
22 {
23         char *dest = (char *)CONFIG_LINUX_CMDLINE_ADDR;
24         char *bootargs = getenv("bootargs");
25
26         if (bootargs == NULL)
27                 return NULL;
28
29         strncpy(dest, bootargs, CONFIG_LINUX_CMDLINE_SIZE);
30         dest[CONFIG_LINUX_CMDLINE_SIZE - 1] = 0;
31         return dest;
32 }
33
34 extern ulong bfin_poweron_retx;
35
36 int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images)
37 {
38         int     (*appl) (char *cmdline);
39         char    *cmdline;
40
41         if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
42                 return 1;
43
44 #ifdef SHARED_RESOURCES
45         swap_to(FLASH);
46 #endif
47
48         appl = (int (*)(char *))images->ep;
49
50         printf("Starting Kernel at = %p\n", appl);
51         cmdline = make_command_line();
52         icache_disable();
53         dcache_disable();
54         asm __volatile__(
55                 "RETX = %[retx];"
56                 "CALL (%0);"
57                 :
58                 : "p"(appl), "q0"(cmdline), [retx] "d"(bfin_poweron_retx)
59         );
60         /* does not return */
61
62         return 1;
63 }