1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23#include <common.h>
24#include <command.h>
25
26int
27cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
28{
29 unsigned long cpuid;
30
31 if (argc < 3)
32 return cmd_usage(cmdtp);
33
34 cpuid = simple_strtoul(argv[1], NULL, 10);
35 if (cpuid >= cpu_numcores()) {
36 printf ("Core num: %lu is out of range[0..%d]\n",
37 cpuid, cpu_numcores() - 1);
38 return 1;
39 }
40
41
42 if (argc == 3) {
43 if (strncmp(argv[2], "reset", 5) == 0)
44 cpu_reset(cpuid);
45 else if (strncmp(argv[2], "status", 6) == 0)
46 cpu_status(cpuid);
47 else if (strncmp(argv[2], "disable", 7) == 0)
48 return cpu_disable(cpuid);
49 else
50 return cmd_usage(cmdtp);
51
52 return 0;
53 }
54
55
56 if (strncmp(argv[2], "release", 7) != 0)
57 return cmd_usage(cmdtp);
58
59 if (cpu_release(cpuid, argc - 3, argv + 3))
60 return cmd_usage(cmdtp);
61
62 return 0;
63}
64
65#ifdef CONFIG_PPC
66#define CPU_ARCH_HELP \
67 " [args] : <pir> <r3> <r6>\n" \
68 " pir - processor id (if writeable)\n" \
69 " r3 - value for gpr 3\n" \
70 " r6 - value for gpr 6\n" \
71 "\n" \
72 " Use '-' for any arg if you want the default value.\n" \
73 " Default for r3 is <num> and r6 is 0\n" \
74 "\n" \
75 " When cpu <num> is released r4 and r5 = 0.\n" \
76 " r7 will contain the size of the initial mapped area"
77#endif
78
79U_BOOT_CMD(
80 cpu, CONFIG_SYS_MAXARGS, 1, cpu_cmd,
81 "Multiprocessor CPU boot manipulation and release",
82 "<num> reset - Reset cpu <num>\n"
83 "cpu <num> status - Status of cpu <num>\n"
84 "cpu <num> disable - Disable cpu <num>\n"
85 "cpu <num> release <addr> [args] - Release cpu <num> at <addr> with [args]"
86#ifdef CPU_ARCH_HELP
87 "\n"
88 CPU_ARCH_HELP
89#endif
90);
91