* [PATCH 1/1] cmd: add more implementation IDs to sbi command
@ 2021-01-19 19:44 Heinrich Schuchardt
2021-01-30 19:21 ` Tom Rini
0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2021-01-19 19:44 UTC (permalink / raw)
To: u-boot
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>
---
cmd/riscv/sbi.c | 37 +++++++++++++++++++++----------------
1 file changed, 21 insertions(+), 16 deletions(-)
diff --git a/cmd/riscv/sbi.c b/cmd/riscv/sbi.c
index 9897483eb6..90c0811e14 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" },
@@ -43,23 +57,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) {
--
2.28.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 1/1] cmd: add more implementation IDs to sbi command
2021-01-19 19:44 [PATCH 1/1] cmd: add more implementation IDs to sbi command Heinrich Schuchardt
@ 2021-01-30 19:21 ` Tom Rini
0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2021-01-30 19:21 UTC (permalink / raw)
To: u-boot
On Tue, Jan 19, 2021 at 07:44:45PM +0000, Heinrich Schuchardt wrote:
> 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>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210130/6915684e/attachment.sig>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-01-30 19:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19 19:44 [PATCH 1/1] cmd: add more implementation IDs to sbi command Heinrich Schuchardt
2021-01-30 19:21 ` Tom Rini
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.