cmd_mp.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright 2008-2009 Freescale Semiconductor, Inc.
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <command.h>
  8. static int
  9. cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  10. {
  11. unsigned long cpuid;
  12. if (argc < 3)
  13. return CMD_RET_USAGE;
  14. cpuid = simple_strtoul(argv[1], NULL, 10);
  15. if (!is_core_valid(cpuid)) {
  16. printf ("Core num: %lu is not valid\n", cpuid);
  17. return 1;
  18. }
  19. if (argc == 3) {
  20. if (strncmp(argv[2], "reset", 5) == 0)
  21. cpu_reset(cpuid);
  22. else if (strncmp(argv[2], "status", 6) == 0)
  23. cpu_status(cpuid);
  24. else if (strncmp(argv[2], "disable", 7) == 0)
  25. return cpu_disable(cpuid);
  26. else
  27. return CMD_RET_USAGE;
  28. return 0;
  29. }
  30. /* 4 or greater, make sure its release */
  31. if (strncmp(argv[2], "release", 7) != 0)
  32. return CMD_RET_USAGE;
  33. if (cpu_release(cpuid, argc - 3, argv + 3))
  34. return CMD_RET_USAGE;
  35. return 0;
  36. }
  37. #ifdef CONFIG_SYS_LONGHELP
  38. static char cpu_help_text[] =
  39. "<num> reset - Reset cpu <num>\n"
  40. "cpu <num> status - Status of cpu <num>\n"
  41. "cpu <num> disable - Disable cpu <num>\n"
  42. "cpu <num> release <addr> [args] - Release cpu <num> at <addr> with [args]"
  43. #ifdef CONFIG_PPC
  44. "\n"
  45. " [args] : <pir> <r3> <r6>\n" \
  46. " pir - processor id (if writeable)\n" \
  47. " r3 - value for gpr 3\n" \
  48. " r6 - value for gpr 6\n" \
  49. "\n" \
  50. " Use '-' for any arg if you want the default value.\n" \
  51. " Default for r3 is <num> and r6 is 0\n" \
  52. "\n" \
  53. " When cpu <num> is released r4 and r5 = 0.\n" \
  54. " r7 will contain the size of the initial mapped area"
  55. #endif
  56. "";
  57. #endif
  58. U_BOOT_CMD(
  59. cpu, CONFIG_SYS_MAXARGS, 1, cpu_cmd,
  60. "Multiprocessor CPU boot manipulation and release", cpu_help_text
  61. );