summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2021-01-19 19:44:45 +0000
committerTom Rini <trini@konsulko.com>2021-01-29 10:36:49 -0500
commit7fd892b21530a60753c48db22f64e3415216faf6 (patch)
tree486a33a76338e968e18cef06f626f1c7b45aba9a
parent9d43b4106e23a241b398544a6d2aa5bb541e62cb (diff)
downloadu-boot-WIP/2021-01-29-assorted-fixes.tar.gz
cmd: add more implementation IDs to sbi commandWIP/2021-01-29-assorted-fixes
Additional SBI implementation IDs have been added to the upcoming next version of the SBI specification. https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adoc Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
-rw-r--r--cmd/riscv/sbi.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/cmd/riscv/sbi.c b/cmd/riscv/sbi.c
index e66fc8e41d..2c905f1f8f 100644
--- a/cmd/riscv/sbi.c
+++ b/cmd/riscv/sbi.c
@@ -9,11 +9,25 @@
#include <command.h>
#include <asm/sbi.h>
+struct sbi_imp {
+ const long id;
+ const char *name;
+};
+
struct sbi_ext {
const u32 id;
const char *name;
};
+static struct sbi_imp implementations[] = {
+ { 0, "Berkeley Boot Loader (BBL)" },
+ { 1, "OpenSBI" },
+ { 2, "Xvisor" },
+ { 3, "KVM" },
+ { 4, "RustSBI" },
+ { 5, "Diosix" },
+};
+
static struct sbi_ext extensions[] = {
{ 0x00000000, "sbi_set_timer" },
{ 0x00000001, "sbi_console_putchar" },
@@ -42,23 +56,14 @@ static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc,
printf("SBI %ld.%ld\n", ret >> 24, ret & 0xffffff);
ret = sbi_get_impl_id();
if (ret >= 0) {
- switch (ret) {
- case 0:
- printf("Berkeley Boot Loader (BBL)\n");
- break;
- case 1:
- printf("OpenSBI\n");
- break;
- case 2:
- printf("Xvisor\n");
- break;
- case 3:
- printf("KVM\n");
- break;
- default:
- printf("Unknown implementation\n");
- break;
+ for (i = 0; i < ARRAY_SIZE(implementations); ++i) {
+ if (ret == implementations[i].id) {
+ printf("%s\n", implementations[i].name);
+ break;
+ }
}
+ if (i == ARRAY_SIZE(implementations))
+ printf("Unknown implementation ID %ld\n", ret);
}
printf("Extensions:\n");
for (i = 0; i < ARRAY_SIZE(extensions); ++i) {