Skip to contentSkip to conversation

cmd_mp: Add support for showing all CPU status by one command

PATCH New Michal Simek 2 participants 2 messages Jun 22, 2015 – Jun 23, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---

 common/cmd_mp.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
common/cmd_mp.c +22 -0
index 328b338068b8..a80c6421575e 100644
@@ -7,11 +7,32 @@
 #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) {
+				printf("Core num: %lu is not valid\n", cpuid);
+				return 1;
+			}
+			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 +69,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]"
Signature · 1 line
2.3.5
#1 lore raw

PATCH 1/1 cmd_mp: Add support for showing all CPU status by one command

Quoted 4 lines · Michal Simek

Use one command for showing overall CPU status than several without knowing how many cpus is available in the system.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150623/750af2dc/attachment.sig>