]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
cmd/sbi: add missing SBI information
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Thu, 17 Mar 2022 06:36:15 +0000 (07:36 +0100)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Wed, 6 Apr 2022 01:40:05 +0000 (09:40 +0800)
Let the sbi command display:

* 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>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
cmd/riscv/sbi.c

index 83491239252cf6c8f77267969b9b1917ffe35792..8fc8ab0ac5196cfda340046314c0bfa44bceb947 100644 (file)
@@ -52,6 +52,7 @@ static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc,
 {
        int i, impl_id;
        long ret;
+       long mvendorid, marchid, mimpid;
 
        ret = sbi_get_spec_version();
        if (ret >= 0)
@@ -77,7 +78,17 @@ static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc,
                if (i == ARRAY_SIZE(implementations))
                        printf("Unknown implementation ID %ld", ret);
        }
-       printf("\nExtensions:\n");
+       printf("\nMachine:\n");
+       ret = sbi_get_mvendorid(&mvendorid);
+       if (!ret)
+               printf("  Vendor ID %lx\n", mvendorid);
+       ret = sbi_get_marchid(&marchid);
+       if (!ret)
+               printf("  Architecture ID %lx\n", marchid);
+       ret = sbi_get_mimpid(&mimpid);
+       if (!ret)
+               printf("  Implementation ID %lx\n", mimpid);
+       printf("Extensions:\n");
        for (i = 0; i < ARRAY_SIZE(extensions); ++i) {
                ret = sbi_probe_extension(extensions[i].id);
                if (ret > 0)