All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@xilinx.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] cmd_mp: Add support for showing all CPU status by one command
Date: Mon, 22 Jun 2015 11:17:39 +0200	[thread overview]
Message-ID: <71e080cafed2d36cdc5760b8b1c9718651b46d51.1434964654.git.michal.simek@xilinx.com> (raw)

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 | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/common/cmd_mp.c b/common/cmd_mp.c
index 328b338068b8..a80c6421575e 100644
--- a/common/cmd_mp.c
+++ b/common/cmd_mp.c
@@ -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]"
-- 
2.3.5

             reply	other threads:[~2015-06-22  9:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-22  9:17 Michal Simek [this message]
2015-06-23 14:33 ` [U-Boot] [PATCH] cmd_mp: Add support for showing all CPU status by one command Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=71e080cafed2d36cdc5760b8b1c9718651b46d51.1434964654.git.michal.simek@xilinx.com \
    --to=michal.simek@xilinx.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.