All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: Rick Chen <rick@andestech.com>
Cc: Leo <ycliang@andestech.com>, Bin Meng <bin.meng@windriver.com>,
	Atish Patra <atish.patra@wdc.com>,
	Pragnesh Patel <pragnesh.patel@openfive.com>,
	u-boot@lists.denx.de,
	Dimitri John Ledkov <dimitri.ledkov@canonical.com>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Subject: [PATCH 2/2] cmd/sbi: add missing SBI information
Date: Mon, 19 Jul 2021 22:28:35 +0200	[thread overview]
Message-ID: <20210719202835.23081-3-xypron.glpk@gmx.de> (raw)
In-Reply-To: <20210719202835.23081-1-xypron.glpk@gmx.de>

Let the sbi command display:

* SBI implementation version
* machine vendor ID
* machine architecture ID
* machine implementation ID

With this patch the output for the HiFive Unmatched looks like

    => sbi
    SBI 0.3
    OpenSBI 0.9
    Machine:
      Vendor ID 489
      Architecture ID 8000000000000007
      Implementation ID 20181004
    Extensions:
      sbi_set_timer
      sbi_console_putchar
      sbi_console_getchar
      sbi_clear_ipi
      sbi_send_ipi
      sbi_remote_fence_i
      sbi_remote_sfence_vma
      sbi_remote_sfence_vma_asid
      sbi_shutdown
      SBI Base Functionality
      Timer Extension
      IPI Extension
      RFENCE Extension
      Hart State Management Extension
      System Reset Extension

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 cmd/riscv/sbi.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/cmd/riscv/sbi.c b/cmd/riscv/sbi.c
index 90c0811e14..c0db763ba7 100644
--- a/cmd/riscv/sbi.c
+++ b/cmd/riscv/sbi.c
@@ -59,13 +59,30 @@ static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc,
 	if (ret >= 0) {
 		for (i = 0; i < ARRAY_SIZE(implementations); ++i) {
 			if (ret == implementations[i].id) {
-				printf("%s\n", implementations[i].name);
+				printf("%s", implementations[i].name);
+				ret = sbi_get_impl_version();
+				if (ret > 0) {
+					/* OpenSBI specific version encoding */
+					printf(" %ld", ret >> 16);
+					printf(".%ld", ret & 0xffff);
+				}
+				printf("\n");
 				break;
 			}
 		}
 		if (i == ARRAY_SIZE(implementations))
 			printf("Unknown implementation ID %ld\n", ret);
 	}
+	printf("Machine:\n");
+	ret = sbi_get_mvendorid();
+	if (ret != -ENOTSUPP)
+		printf("  Vendor ID %lx\n", ret);
+	ret = sbi_get_marchid();
+	if (ret != -ENOTSUPP)
+		printf("  Architecture ID %lx\n", ret);
+	ret = sbi_get_mimpid();
+	if (ret != -ENOTSUPP)
+		printf("  Implementation ID %lx\n", ret);
 	printf("Extensions:\n");
 	for (i = 0; i < ARRAY_SIZE(extensions); ++i) {
 		ret = sbi_probe_extension(extensions[i].id);
--
2.30.2


  parent reply	other threads:[~2021-07-19 20:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19 20:28 [PATCH 0/2] cmd/sbi: add missing SBI information Heinrich Schuchardt
2021-07-19 20:28 ` [PATCH 1/2] riscv: provide missing base extension functions Heinrich Schuchardt
2021-07-20  1:07   ` Sean Anderson
2021-07-26  6:44   ` Leo Liang
2021-07-19 20:28 ` Heinrich Schuchardt [this message]
2021-07-20  1:11   ` [PATCH 2/2] cmd/sbi: add missing SBI information Sean Anderson
2021-07-20  4:59     ` Heinrich Schuchardt
2021-07-20  5:13       ` Sean Anderson
2021-07-26  7:08         ` Leo Liang

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=20210719202835.23081-3-xypron.glpk@gmx.de \
    --to=xypron.glpk@gmx.de \
    --cc=atish.patra@wdc.com \
    --cc=bin.meng@windriver.com \
    --cc=dimitri.ledkov@canonical.com \
    --cc=heinrich.schuchardt@canonical.com \
    --cc=pragnesh.patel@openfive.com \
    --cc=rick@andestech.com \
    --cc=u-boot@lists.denx.de \
    --cc=ycliang@andestech.com \
    /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.