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
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2008-01-17 22:48:33 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <command.h>
|
|
|
|
|
2012-10-29 13:34:31 +00:00
|
|
|
static 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)
|
2011-12-10 08:44:01 +00:00
|
|
|
return CMD_RET_USAGE;
|
2008-01-17 22:48:33 +00:00
|
|
|
|
|
|
|
cpuid = simple_strtoul(argv[1], NULL, 10);
|
2011-08-05 21:15:24 +00:00
|
|
|
if (!is_core_valid(cpuid)) {
|
|
|
|
printf ("Core num: %lu is not valid\n", cpuid);
|
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
|
2011-12-10 08:44:01 +00:00
|
|
|
return CMD_RET_USAGE;
|
2010-07-16 23:06:04 +00:00
|
|
|
|
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)
|
2011-12-10 08:44:01 +00:00
|
|
|
return CMD_RET_USAGE;
|
2008-01-17 22:48:33 +00:00
|
|
|
|
2010-07-16 23:06:04 +00:00
|
|
|
if (cpu_release(cpuid, argc - 3, argv + 3))
|
2011-12-10 08:44:01 +00:00
|
|
|
return CMD_RET_USAGE;
|
2008-01-17 22:48:33 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-10-29 13:34:31 +00:00
|
|
|
#ifdef CONFIG_SYS_LONGHELP
|
|
|
|
static char cpu_help_text[] =
|
|
|
|
"<num> reset - Reset cpu <num>\n"
|
|
|
|
"cpu <num> status - Status of cpu <num>\n"
|
|
|
|
"cpu <num> disable - Disable cpu <num>\n"
|
|
|
|
"cpu <num> release <addr> [args] - Release cpu <num> at <addr> with [args]"
|
2008-01-17 22:48:33 +00:00
|
|
|
#ifdef CONFIG_PPC
|
2012-10-29 13:34:31 +00:00
|
|
|
"\n"
|
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
|
2012-10-29 13:34:31 +00:00
|
|
|
"";
|
|
|
|
#endif
|
2008-01-17 22:48:33 +00:00
|
|
|
|
|
|
|
U_BOOT_CMD(
|
2008-10-16 13:01:15 +00:00
|
|
|
cpu, CONFIG_SYS_MAXARGS, 1, cpu_cmd,
|
2012-10-29 13:34:31 +00:00
|
|
|
"Multiprocessor CPU boot manipulation and release", cpu_help_text
|
2009-05-24 15:06:54 +00:00
|
|
|
);
|