2008-01-17 22:48:33 +00:00
|
|
|
/*
|
2009-07-31 06:38:14 +00:00
|
|
|
* Copyright 2008-2009 Freescale Semiconductor, Inc.
|
2008-01-17 22:48:33 +00:00
|
|
|
*
|
|
|
|
* See file CREDITS for list of people who contributed to this
|
|
|
|
* project.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <command.h>
|
|
|
|
|
|
|
|
int
|
2010-06-28 20:00:46 +00:00
|
|
|
cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
2008-01-17 22:48:33 +00:00
|
|
|
{
|
2008-03-26 13:34:25 +00:00
|
|
|
unsigned long cpuid;
|
2008-01-17 22:48:33 +00:00
|
|
|
|
2010-07-16 23:06:04 +00:00
|
|
|
if (argc < 3)
|
|
|
|
return cmd_usage(cmdtp);
|
2008-01-17 22:48:33 +00:00
|
|
|
|
|
|
|
cpuid = simple_strtoul(argv[1], NULL, 10);
|
2009-07-31 06:38:14 +00:00
|
|
|
if (cpuid >= cpu_numcores()) {
|
2008-07-14 19:03:02 +00:00
|
|
|
printf ("Core num: %lu is out of range[0..%d]\n",
|
2009-07-31 06:38:14 +00:00
|
|
|
cpuid, cpu_numcores() - 1);
|
2008-01-17 22:48:33 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (argc == 3) {
|
2010-07-16 23:06:04 +00:00
|
|
|
if (strncmp(argv[2], "reset", 5) == 0)
|
2008-01-17 22:48:33 +00:00
|
|
|
cpu_reset(cpuid);
|
2010-07-16 23:06:04 +00:00
|
|
|
else if (strncmp(argv[2], "status", 6) == 0)
|
2008-01-17 22:48:33 +00:00
|
|
|
cpu_status(cpuid);
|
2010-07-16 23:06:04 +00:00
|
|
|
else if (strncmp(argv[2], "disable", 7) == 0)
|
2010-01-12 17:42:43 +00:00
|
|
|
return cpu_disable(cpuid);
|
2010-07-16 23:06:04 +00:00
|
|
|
else
|
|
|
|
return cmd_usage(cmdtp);
|
|
|
|
|
2008-01-17 22:48:33 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 4 or greater, make sure its release */
|
2010-07-16 23:06:04 +00:00
|
|
|
if (strncmp(argv[2], "release", 7) != 0)
|
|
|
|
return cmd_usage(cmdtp);
|
2008-01-17 22:48:33 +00:00
|
|
|
|
2010-07-16 23:06:04 +00:00
|
|
|
if (cpu_release(cpuid, argc - 3, argv + 3))
|
|
|
|
return cmd_usage(cmdtp);
|
2008-01-17 22:48:33 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_PPC
|
|
|
|
#define CPU_ARCH_HELP \
|
2008-03-26 13:34:25 +00:00
|
|
|
" [args] : <pir> <r3> <r6>\n" \
|
2008-01-17 22:48:33 +00:00
|
|
|
" pir - processor id (if writeable)\n" \
|
|
|
|
" r3 - value for gpr 3\n" \
|
|
|
|
" r6 - value for gpr 6\n" \
|
|
|
|
"\n" \
|
|
|
|
" Use '-' for any arg if you want the default value.\n" \
|
2008-03-26 13:34:25 +00:00
|
|
|
" Default for r3 is <num> and r6 is 0\n" \
|
2008-01-17 22:48:33 +00:00
|
|
|
"\n" \
|
2008-03-26 13:34:25 +00:00
|
|
|
" When cpu <num> is released r4 and r5 = 0.\n" \
|
2009-05-24 15:06:54 +00:00
|
|
|
" r7 will contain the size of the initial mapped area"
|
2008-01-17 22:48:33 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
U_BOOT_CMD(
|
2008-10-16 13:01:15 +00:00
|
|
|
cpu, CONFIG_SYS_MAXARGS, 1, cpu_cmd,
|
2009-01-28 00:03:12 +00:00
|
|
|
"Multiprocessor CPU boot manipulation and release",
|
2008-01-17 22:48:33 +00:00
|
|
|
"<num> reset - Reset cpu <num>\n"
|
|
|
|
"cpu <num> status - Status of cpu <num>\n"
|
2010-01-12 17:42:43 +00:00
|
|
|
"cpu <num> disable - Disable cpu <num>\n"
|
2009-05-24 15:06:54 +00:00
|
|
|
"cpu <num> release <addr> [args] - Release cpu <num> at <addr> with [args]"
|
2008-01-17 22:48:33 +00:00
|
|
|
#ifdef CPU_ARCH_HELP
|
2009-05-24 15:06:54 +00:00
|
|
|
"\n"
|
2008-01-17 22:48:33 +00:00
|
|
|
CPU_ARCH_HELP
|
|
|
|
#endif
|
2009-05-24 15:06:54 +00:00
|
|
|
);
|