]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
cmd_mp: Add support for showing all CPU status by one command
authorMichal Simek <michal.simek@xilinx.com>
Mon, 22 Jun 2015 08:46:40 +0000 (10:46 +0200)
committerMichal Simek <michal.simek@xilinx.com>
Fri, 31 Jul 2015 06:25:37 +0000 (08:25 +0200)
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 <michal.simek@xilinx.com>
common/cmd_mp.c

index 328b338068b812f613bbe3c8998ef221e8e90897..ebc33c2db1e672457a80fbb9a6a9c09038d74489 100644 (file)
@@ -7,11 +7,30 @@
 #include <common.h>
 #include <command.h>
 
+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[] =
            "<num> reset                 - Reset cpu <num>\n"
+       "cpu status                      - Status of all cpus\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]"