From ee7ce728f2083b4bcad1b3a08311212ff75e71a5 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Mon, 22 Jun 2015 10:46:40 +0200 Subject: [PATCH] cmd_mp: Add support for showing all CPU status by one command Use one command for showing overall CPU status than several without knowing how many cpus is available in the system. Signed-off-by: Michal Simek --- common/cmd_mp.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/common/cmd_mp.c b/common/cmd_mp.c index 328b338068b..ebc33c2db1e 100644 --- a/common/cmd_mp.c +++ b/common/cmd_mp.c @@ -7,11 +7,30 @@ #include #include +static int cpu_status_all(void) +{ + unsigned long cpuid; + + for (cpuid = 0; ; cpuid++) { + if (!is_core_valid(cpuid)) { + if (cpuid == 0) + return CMD_RET_USAGE; + break; + } + cpu_status(cpuid); + } + + return 0; +} + static int cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { unsigned long cpuid; + if (argc == 2 && strncmp(argv[1], "status", 6) == 0) + return cpu_status_all(); + if (argc < 3) return CMD_RET_USAGE; @@ -48,6 +67,7 @@ cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #ifdef CONFIG_SYS_LONGHELP static char cpu_help_text[] = " reset - Reset cpu \n" + "cpu status - Status of all cpus\n" "cpu status - Status of cpu \n" "cpu disable - Disable cpu \n" "cpu release [args] - Release cpu at with [args]" -- 2.47.3