]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
riscv: function to retrieve SBI implementation version
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Mon, 25 Oct 2021 13:09:34 +0000 (15:09 +0200)
committerLeo Yu-Chi Liang <ycliang@andestech.com>
Mon, 8 Nov 2021 07:35:55 +0000 (15:35 +0800)
Provide function sbi_get_impl_version() to retrieve the SBI implementation
version.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
Reviewed-by: Rick Chen <rick@andestech.com>
arch/riscv/include/asm/sbi.h
arch/riscv/lib/sbi.c

index 5030892b4791eb118492826569b17f399238d8c2..bfcd20495374a39fc431df565b2ecafbad8a5279 100644 (file)
@@ -152,6 +152,7 @@ void sbi_remote_sfence_vma_asid(const unsigned long *hart_mask,
 void sbi_set_timer(uint64_t stime_value);
 long sbi_get_spec_version(void);
 int sbi_get_impl_id(void);
+int sbi_get_impl_version(long *version);
 int sbi_probe_extension(int ext);
 void sbi_srst_reset(unsigned long type, unsigned long reason);
 
index 2b53896b8a3ba1e623e0e26c0fb92195155177b5..d427d1b29eaf70feee5731841b95cbcd031a036a 100644 (file)
@@ -89,6 +89,25 @@ int sbi_get_impl_id(void)
        return -ENOTSUPP;
 }
 
+/**
+ * sbi_get_impl_version() - get SBI implementation version
+ *
+ * @version:   pointer to receive version
+ * Return:     0 on success, -ENOTSUPP otherwise
+ */
+int sbi_get_impl_version(long *version)
+{
+       struct sbiret ret;
+
+       ret = sbi_ecall(SBI_EXT_BASE, SBI_EXT_BASE_GET_IMP_VERSION,
+                       0, 0, 0, 0, 0, 0);
+       if (ret.error)
+               return -ENOTSUPP;
+       if (version)
+               *version = ret.value;
+       return 0;
+}
+
 /**
  * sbi_probe_extension() - Check if an SBI extension ID is supported or not.
  * @extid: The extension ID to be probed.