Blame view

common/cmd_mp.c 1.82 KB
ec2b74ffd   Kumar Gala   85xx: Added suppo...
1
  /*
0e870980a   Poonam Aggrwal   8xxx: Removed CON...
2
   * Copyright 2008-2009 Freescale Semiconductor, Inc.
ec2b74ffd   Kumar Gala   85xx: Added suppo...
3
   *
1a4596601   Wolfgang Denk   Add GPL-2.0+ SPDX...
4
   * SPDX-License-Identifier:	GPL-2.0+
ec2b74ffd   Kumar Gala   85xx: Added suppo...
5
6
7
8
   */
  
  #include <common.h>
  #include <command.h>
088f1b199   Kim Phillips   common/cmd_*.c: s...
9
  static int
54841ab50   Wolfgang Denk   Make sure that ar...
10
  cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
ec2b74ffd   Kumar Gala   85xx: Added suppo...
11
  {
79679d800   Kumar Gala   85xx: Update mult...
12
  	unsigned long cpuid;
ec2b74ffd   Kumar Gala   85xx: Added suppo...
13

47e26b1bf   Wolfgang Denk   cmd_usage(): simp...
14
  	if (argc < 3)
4c12eeb8b   Simon Glass   Convert cmd_usage...
15
  		return CMD_RET_USAGE;
ec2b74ffd   Kumar Gala   85xx: Added suppo...
16
17
  
  	cpuid = simple_strtoul(argv[1], NULL, 10);
fbb9ecf74   Timur Tabi   powerpc/mp: add s...
18
19
20
  	if (!is_core_valid(cpuid)) {
  		printf ("Core num: %lu is not valid
  ",	cpuid);
ec2b74ffd   Kumar Gala   85xx: Added suppo...
21
22
23
24
25
  		return 1;
  	}
  
  
  	if (argc == 3) {
47e26b1bf   Wolfgang Denk   cmd_usage(): simp...
26
  		if (strncmp(argv[2], "reset", 5) == 0)
ec2b74ffd   Kumar Gala   85xx: Added suppo...
27
  			cpu_reset(cpuid);
47e26b1bf   Wolfgang Denk   cmd_usage(): simp...
28
  		else if (strncmp(argv[2], "status", 6) == 0)
ec2b74ffd   Kumar Gala   85xx: Added suppo...
29
  			cpu_status(cpuid);
47e26b1bf   Wolfgang Denk   cmd_usage(): simp...
30
  		else if (strncmp(argv[2], "disable", 7) == 0)
4194b3668   Kumar Gala   Add support to di...
31
  			return cpu_disable(cpuid);
47e26b1bf   Wolfgang Denk   cmd_usage(): simp...
32
  		else
4c12eeb8b   Simon Glass   Convert cmd_usage...
33
  			return CMD_RET_USAGE;
47e26b1bf   Wolfgang Denk   cmd_usage(): simp...
34

ec2b74ffd   Kumar Gala   85xx: Added suppo...
35
36
37
38
  		return 0;
  	}
  
  	/* 4 or greater, make sure its release */
47e26b1bf   Wolfgang Denk   cmd_usage(): simp...
39
  	if (strncmp(argv[2], "release", 7) != 0)
4c12eeb8b   Simon Glass   Convert cmd_usage...
40
  		return CMD_RET_USAGE;
ec2b74ffd   Kumar Gala   85xx: Added suppo...
41

47e26b1bf   Wolfgang Denk   cmd_usage(): simp...
42
  	if (cpu_release(cpuid, argc - 3, argv + 3))
4c12eeb8b   Simon Glass   Convert cmd_usage...
43
  		return CMD_RET_USAGE;
ec2b74ffd   Kumar Gala   85xx: Added suppo...
44
45
46
  
  	return 0;
  }
088f1b199   Kim Phillips   common/cmd_*.c: s...
47
48
49
50
51
52
53
54
55
  #ifdef CONFIG_SYS_LONGHELP
  static char cpu_help_text[] =
  	    "<num> reset                 - Reset cpu <num>
  "
  	"cpu <num> status                - Status of cpu <num>
  "
  	"cpu <num> disable               - Disable cpu <num>
  "
  	"cpu <num> release <addr> [args] - Release cpu <num> at <addr> with [args]"
ec2b74ffd   Kumar Gala   85xx: Added suppo...
56
  #ifdef CONFIG_PPC
088f1b199   Kim Phillips   common/cmd_*.c: s...
57
58
  	"
  "
79679d800   Kumar Gala   85xx: Update mult...
59
60
  	"                         [args] : <pir> <r3> <r6>
  " \
ec2b74ffd   Kumar Gala   85xx: Added suppo...
61
62
63
64
  	"                                   pir - processor id (if writeable)
  " \
  	"                                    r3 - value for gpr 3
  " \
ec2b74ffd   Kumar Gala   85xx: Added suppo...
65
66
  	"                                    r6 - value for gpr 6
  " \
ec2b74ffd   Kumar Gala   85xx: Added suppo...
67
68
69
70
  	"
  " \
  	"     Use '-' for any arg if you want the default value.
  " \
79679d800   Kumar Gala   85xx: Update mult...
71
72
  	"     Default for r3 is <num> and r6 is 0
  " \
ec2b74ffd   Kumar Gala   85xx: Added suppo...
73
74
  	"
  " \
79679d800   Kumar Gala   85xx: Update mult...
75
76
  	"     When cpu <num> is released r4 and r5 = 0.
  " \
a89c33db9   Wolfgang Denk   General help mess...
77
  	"     r7 will contain the size of the initial mapped area"
ec2b74ffd   Kumar Gala   85xx: Added suppo...
78
  #endif
088f1b199   Kim Phillips   common/cmd_*.c: s...
79
80
  	"";
  #endif
ec2b74ffd   Kumar Gala   85xx: Added suppo...
81
82
  
  U_BOOT_CMD(
6d0f6bcf3   Jean-Christophe PLAGNIOL-VILLARD   rename CFG_ macro...
83
  	cpu, CONFIG_SYS_MAXARGS, 1, cpu_cmd,
088f1b199   Kim Phillips   common/cmd_*.c: s...
84
  	"Multiprocessor CPU boot manipulation and release", cpu_help_text
a89c33db9   Wolfgang Denk   General help mess...
85
  );