* [PATCH 0/2] cmd: sbi: show SBI implementation version @ 2021-10-25 13:09 Heinrich Schuchardt 2021-10-25 13:09 ` [PATCH 1/2] riscv: function to retrieve " Heinrich Schuchardt 2021-10-25 13:09 ` [PATCH 2/2] cmd: sbi: show " Heinrich Schuchardt 0 siblings, 2 replies; 7+ messages in thread From: Heinrich Schuchardt @ 2021-10-25 13:09 UTC (permalink / raw) To: Rick Chen, Leo; +Cc: u-boot, Heinrich Schuchardt The sbi command can already show the SBI implementation (e.g. OpenSBI). But the implementation version is no displayed. Heinrich Schuchardt (2): riscv: function to retrieve SBI implementation version cmd: sbi: show SBI implementation version arch/riscv/include/asm/sbi.h | 1 + arch/riscv/lib/sbi.c | 19 +++++++++++++++++++ cmd/riscv/sbi.c | 26 ++++++++++++++++++-------- 3 files changed, 38 insertions(+), 8 deletions(-) -- 2.32.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] riscv: function to retrieve SBI implementation version 2021-10-25 13:09 [PATCH 0/2] cmd: sbi: show SBI implementation version Heinrich Schuchardt @ 2021-10-25 13:09 ` Heinrich Schuchardt 2021-10-27 9:06 ` Leo Liang [not found] ` <HK0PR03MB2994DCCDB332F854D25A0209C1869@HK0PR03MB2994.apcprd03.prod.outlook.com> 2021-10-25 13:09 ` [PATCH 2/2] cmd: sbi: show " Heinrich Schuchardt 1 sibling, 2 replies; 7+ messages in thread From: Heinrich Schuchardt @ 2021-10-25 13:09 UTC (permalink / raw) To: Rick Chen, Leo; +Cc: u-boot, Heinrich Schuchardt Provide function sbi_get_impl_version() to retrieve the SBI implementation version. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> --- arch/riscv/include/asm/sbi.h | 1 + arch/riscv/lib/sbi.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h index 53ca316180..110ec28ef5 100644 --- a/arch/riscv/include/asm/sbi.h +++ b/arch/riscv/include/asm/sbi.h @@ -117,6 +117,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); #endif diff --git a/arch/riscv/lib/sbi.c b/arch/riscv/lib/sbi.c index 77845a73ca..cf13a2f17e 100644 --- a/arch/riscv/lib/sbi.c +++ b/arch/riscv/lib/sbi.c @@ -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. -- 2.32.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] riscv: function to retrieve SBI implementation version 2021-10-25 13:09 ` [PATCH 1/2] riscv: function to retrieve " Heinrich Schuchardt @ 2021-10-27 9:06 ` Leo Liang [not found] ` <HK0PR03MB2994DCCDB332F854D25A0209C1869@HK0PR03MB2994.apcprd03.prod.outlook.com> 1 sibling, 0 replies; 7+ messages in thread From: Leo Liang @ 2021-10-27 9:06 UTC (permalink / raw) To: Heinrich Schuchardt; +Cc: Rick Chen, u-boot On Mon, Oct 25, 2021 at 03:09:34PM +0200, Heinrich Schuchardt wrote: > Provide function sbi_get_impl_version() to retrieve the SBI implementation > version. > > Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> > --- > arch/riscv/include/asm/sbi.h | 1 + > arch/riscv/lib/sbi.c | 19 +++++++++++++++++++ > 2 files changed, 20 insertions(+) Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com> ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <HK0PR03MB2994DCCDB332F854D25A0209C1869@HK0PR03MB2994.apcprd03.prod.outlook.com>]
* Re: [PATCH 1/2] riscv: function to retrieve SBI implementation version [not found] ` <HK0PR03MB2994DCCDB332F854D25A0209C1869@HK0PR03MB2994.apcprd03.prod.outlook.com> @ 2021-10-28 0:17 ` Rick Chen 0 siblings, 0 replies; 7+ messages in thread From: Rick Chen @ 2021-10-28 0:17 UTC (permalink / raw) To: Heinrich Schuchardt; +Cc: U-Boot Mailing List, Leo Liang, rick > From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> > Sent: Monday, October 25, 2021 9:10 PM > To: Rick Jian-Zhi Chen(陳建志) <rick@andestech.com>; Leo Yu-Chi Liang(梁育齊) <ycliang@andestech.com> > Cc: u-boot@lists.denx.de; Heinrich Schuchardt <heinrich.schuchardt@canonical.com> > Subject: [PATCH 1/2] 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> > --- > arch/riscv/include/asm/sbi.h | 1 + > arch/riscv/lib/sbi.c | 19 +++++++++++++++++++ > 2 files changed, 20 insertions(+) Reviewed-by: Rick Chen <rick@andestech.com> ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] cmd: sbi: show SBI implementation version 2021-10-25 13:09 [PATCH 0/2] cmd: sbi: show SBI implementation version Heinrich Schuchardt 2021-10-25 13:09 ` [PATCH 1/2] riscv: function to retrieve " Heinrich Schuchardt @ 2021-10-25 13:09 ` Heinrich Schuchardt 2021-10-27 9:07 ` Leo Liang [not found] ` <HK0PR03MB299416F7A497EDFC219F4509C1869@HK0PR03MB2994.apcprd03.prod.outlook.com> 1 sibling, 2 replies; 7+ messages in thread From: Heinrich Schuchardt @ 2021-10-25 13:09 UTC (permalink / raw) To: Rick Chen, Leo; +Cc: u-boot, Heinrich Schuchardt Let the sbi command show the SBI implementation version Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> --- cmd/riscv/sbi.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/cmd/riscv/sbi.c b/cmd/riscv/sbi.c index 90c0811e14..ed0960c2f2 100644 --- a/cmd/riscv/sbi.c +++ b/cmd/riscv/sbi.c @@ -49,24 +49,34 @@ static struct sbi_ext extensions[] = { static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { - int i; + int i, impl_id; long ret; ret = sbi_get_spec_version(); if (ret >= 0) - printf("SBI %ld.%ld\n", ret >> 24, ret & 0xffffff); - ret = sbi_get_impl_id(); - if (ret >= 0) { + printf("SBI %ld.%ld", ret >> 24, ret & 0xffffff); + impl_id = sbi_get_impl_id(); + if (impl_id >= 0) { for (i = 0; i < ARRAY_SIZE(implementations); ++i) { - if (ret == implementations[i].id) { - printf("%s\n", implementations[i].name); + if (impl_id == implementations[i].id) { + long vers; + + printf("\n%s ", implementations[i].name); + ret = sbi_get_impl_version(&vers); + if (ret < 0) + break; + if (impl_id == 1) + printf("%ld.%ld", + vers >> 16, vers & 0xffff); + else + printf("0x%lx", vers); break; } } if (i == ARRAY_SIZE(implementations)) - printf("Unknown implementation ID %ld\n", ret); + printf("Unknown implementation ID %ld", ret); } - printf("Extensions:\n"); + printf("\nExtensions:\n"); for (i = 0; i < ARRAY_SIZE(extensions); ++i) { ret = sbi_probe_extension(extensions[i].id); if (ret > 0) -- 2.32.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] cmd: sbi: show SBI implementation version 2021-10-25 13:09 ` [PATCH 2/2] cmd: sbi: show " Heinrich Schuchardt @ 2021-10-27 9:07 ` Leo Liang [not found] ` <HK0PR03MB299416F7A497EDFC219F4509C1869@HK0PR03MB2994.apcprd03.prod.outlook.com> 1 sibling, 0 replies; 7+ messages in thread From: Leo Liang @ 2021-10-27 9:07 UTC (permalink / raw) To: Heinrich Schuchardt; +Cc: Rick Chen, u-boot On Mon, Oct 25, 2021 at 03:09:35PM +0200, Heinrich Schuchardt wrote: > Let the sbi command show the SBI implementation version > > Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> > --- > cmd/riscv/sbi.c | 26 ++++++++++++++++++-------- > 1 file changed, 18 insertions(+), 8 deletions(-) Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com> ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <HK0PR03MB299416F7A497EDFC219F4509C1869@HK0PR03MB2994.apcprd03.prod.outlook.com>]
* Re: [PATCH 2/2] cmd: sbi: show SBI implementation version [not found] ` <HK0PR03MB299416F7A497EDFC219F4509C1869@HK0PR03MB2994.apcprd03.prod.outlook.com> @ 2021-10-28 0:18 ` Rick Chen 0 siblings, 0 replies; 7+ messages in thread From: Rick Chen @ 2021-10-28 0:18 UTC (permalink / raw) To: Heinrich Schuchardt; +Cc: U-Boot Mailing List, Leo Liang, rick > From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> > Sent: Monday, October 25, 2021 9:10 PM > To: Rick Jian-Zhi Chen(陳建志) <rick@andestech.com>; Leo Yu-Chi Liang(梁育齊) <ycliang@andestech.com> > Cc: u-boot@lists.denx.de; Heinrich Schuchardt <heinrich.schuchardt@canonical.com> > Subject: [PATCH 2/2] cmd: sbi: show SBI implementation version > > Let the sbi command show the SBI implementation version > > Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> > --- > cmd/riscv/sbi.c | 26 ++++++++++++++++++-------- > 1 file changed, 18 insertions(+), 8 deletions(-) Reviewed-by: Rick Chen <rick@andestech.com> ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-10-28 0:18 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-25 13:09 [PATCH 0/2] cmd: sbi: show SBI implementation version Heinrich Schuchardt
2021-10-25 13:09 ` [PATCH 1/2] riscv: function to retrieve " Heinrich Schuchardt
2021-10-27 9:06 ` Leo Liang
[not found] ` <HK0PR03MB2994DCCDB332F854D25A0209C1869@HK0PR03MB2994.apcprd03.prod.outlook.com>
2021-10-28 0:17 ` Rick Chen
2021-10-25 13:09 ` [PATCH 2/2] cmd: sbi: show " Heinrich Schuchardt
2021-10-27 9:07 ` Leo Liang
[not found] ` <HK0PR03MB299416F7A497EDFC219F4509C1869@HK0PR03MB2994.apcprd03.prod.outlook.com>
2021-10-28 0:18 ` Rick Chen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox