From: Heinrich Schuchardt Date: Mon, 25 Oct 2021 13:09:34 +0000 (+0200) Subject: riscv: function to retrieve SBI implementation version X-Git-Tag: v2022.01~55^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=afb8e1f06730a35d436c58367f2b15c7dbf90cf1;p=platform%2Fkernel%2Fu-boot.git riscv: function to retrieve SBI implementation version Provide function sbi_get_impl_version() to retrieve the SBI implementation version. Signed-off-by: Heinrich Schuchardt Reviewed-by: Leo Yu-Chi Liang Reviewed-by: Rick Chen --- diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h index 5030892..bfcd204 100644 --- a/arch/riscv/include/asm/sbi.h +++ b/arch/riscv/include/asm/sbi.h @@ -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); diff --git a/arch/riscv/lib/sbi.c b/arch/riscv/lib/sbi.c index 2b53896..d427d1b 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. *