public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 1/1] cmd/sbi: format KVM version
@ 2022-08-14 19:57 Heinrich Schuchardt
  2022-08-30  5:03 ` Leo Liang
  0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2022-08-14 19:57 UTC (permalink / raw)
  To: Rick Chen, Leo; +Cc: u-boot, Heinrich Schuchardt

Format the KVM implementation number in a human readable form.

With the patch output of the sbi command for Linux 5.19.1 looks like:

    => sbi
    SBI 0.3
    KVM 5.19.1
    Machine:
      Vendor ID 0
      Architecture ID 7005c
      Implementation ID 7005c
    Extensions:
      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 | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/cmd/riscv/sbi.c b/cmd/riscv/sbi.c
index ee11e0f88e..522f502435 100644
--- a/cmd/riscv/sbi.c
+++ b/cmd/riscv/sbi.c
@@ -68,11 +68,21 @@ static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc,
 				ret = sbi_get_impl_version(&vers);
 				if (ret < 0)
 					break;
-				if (impl_id == 1)
+				switch (impl_id) {
+				case 1: /* OpenSBI */
 					printf("%ld.%ld",
 					       vers >> 16, vers & 0xffff);
-				else
+					break;
+				case 3: /* KVM */
+					printf("%ld.%ld.%ld",
+					       vers >> 16,
+					       (vers >> 8) & 0xff,
+					       vers & 0xff);
+					break;
+				default:
 					printf("0x%lx", vers);
+					break;
+				}
 				break;
 			}
 		}
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-30  5:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-14 19:57 [PATCH 1/1] cmd/sbi: format KVM version Heinrich Schuchardt
2022-08-30  5:03 ` Leo Liang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox