]>
Commit | Line | Data |
---|---|---|
fe8c2806 | 1 | /* |
8bde7f77 | 2 | * (C) Copyright 2000-2003 |
fe8c2806 WD |
3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
4 | * | |
1a459660 | 5 | * SPDX-License-Identifier: GPL-2.0+ |
fe8c2806 WD |
6 | */ |
7 | ||
8 | /* | |
8bde7f77 | 9 | * Misc boot support |
fe8c2806 WD |
10 | */ |
11 | #include <common.h> | |
12 | #include <command.h> | |
fe8c2806 | 13 | #include <net.h> |
fe8c2806 | 14 | |
a641b979 MF |
15 | #ifdef CONFIG_CMD_GO |
16 | ||
a4986459 MF |
17 | /* Allow ports to override the default behavior */ |
18 | __attribute__((weak)) | |
088f1b19 KP |
19 | unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc, |
20 | char * const argv[]) | |
1f1d88dd | 21 | { |
a4986459 | 22 | return entry (argc, argv); |
1f1d88dd MF |
23 | } |
24 | ||
088f1b19 | 25 | static int do_go(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
fe8c2806 WD |
26 | { |
27 | ulong addr, rc; | |
28 | int rcode = 0; | |
29 | ||
47e26b1b | 30 | if (argc < 2) |
4c12eeb8 | 31 | return CMD_RET_USAGE; |
fe8c2806 WD |
32 | |
33 | addr = simple_strtoul(argv[1], NULL, 16); | |
34 | ||
dc7c9a1a | 35 | printf ("## Starting application at 0x%08lX ...\n", addr); |
fe8c2806 | 36 | |
4a551709 | 37 | /* |
1f1d88dd MF |
38 | * pass address parameter as argv[0] (aka command name), |
39 | * and all remaining args | |
4a551709 | 40 | */ |
a4986459 | 41 | rc = do_go_exec ((void *)addr, argc - 1, argv + 1); |
fe8c2806 WD |
42 | if (rc != 0) rcode = 1; |
43 | ||
dc7c9a1a | 44 | printf ("## Application terminated, rc = 0x%lX\n", rc); |
fe8c2806 WD |
45 | return rcode; |
46 | } | |
47 | ||
8bde7f77 | 48 | /* -------------------------------------------------------------------- */ |
fe8c2806 | 49 | |
0d498393 | 50 | U_BOOT_CMD( |
6d0f6bcf | 51 | go, CONFIG_SYS_MAXARGS, 1, do_go, |
2fb2604d | 52 | "start application at address 'addr'", |
8bde7f77 | 53 | "addr [arg ...]\n - start application at address 'addr'\n" |
a89c33db | 54 | " passing 'arg' as arguments" |
8bde7f77 | 55 | ); |
fe8c2806 | 56 | |
a641b979 MF |
57 | #endif |
58 | ||
0d498393 | 59 | U_BOOT_CMD( |
0bba5452 | 60 | reset, 1, 0, do_reset, |
2fb2604d | 61 | "Perform RESET of the CPU", |
a89c33db | 62 | "" |
8bde7f77 | 63 | ); |
4e42e29f MS |
64 | |
65 | #ifdef CONFIG_CMD_POWEROFF | |
66 | U_BOOT_CMD( | |
67 | poweroff, 1, 0, do_poweroff, | |
68 | "Perform POWEROFF of the device", | |
69 | "" | |
70 | ); | |
71 | #endif |