summaryrefslogtreecommitdiff
path: root/arch/riscv/lib
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2021-10-25 15:09:34 +0200
committerLeo Yu-Chi Liang <ycliang@andestech.com>2021-11-08 15:35:55 +0800
commitafb8e1f06730a35d436c58367f2b15c7dbf90cf1 (patch)
tree735d73398e406570f6683e4255bedc39b1fc8e97 /arch/riscv/lib
parent52207514ba419a69a8105d16997b025f966c8879 (diff)
riscv: function to retrieve SBI implementation version
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>
Diffstat (limited to 'arch/riscv/lib')
-rw-r--r--arch/riscv/lib/sbi.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/riscv/lib/sbi.c b/arch/riscv/lib/sbi.c
index 2b53896b8a3..d427d1b29ea 100644
--- a/arch/riscv/lib/sbi.c
+++ b/arch/riscv/lib/sbi.c
@@ -90,6 +90,25 @@ int sbi_get_impl_id(void)
}
/**
+ * 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.
*