All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] sbi/cmd: improve output formatting
@ 2022-10-01  7:39 Heinrich Schuchardt
  2022-10-01  7:39 ` [PATCH 1/3] cmd/sbi: format RustSBI version number Heinrich Schuchardt
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Heinrich Schuchardt @ 2022-10-01  7:39 UTC (permalink / raw)
  To: Rick Chen, Leo; +Cc: u-boot, Heinrich Schuchardt

* correctly format the version number for RustSBI
* provide an error message if the SBI does not implement
  the 'SBI Base Functionality' extension.
* provide user friendly short texts for the legacy extensions

Heinrich Schuchardt (3):
  cmd/sbi: format RustSBI version number
  cmd/sbi: error message for failure to get spec version
  cmd/sbi: user friendly short texts

 cmd/riscv/sbi.c | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

-- 
2.37.2


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] cmd/sbi: format RustSBI version number
  2022-10-01  7:39 [PATCH 0/3] sbi/cmd: improve output formatting Heinrich Schuchardt
@ 2022-10-01  7:39 ` Heinrich Schuchardt
       [not found]   ` <HK0PR03MB2994993437B0AEAE372695DAC15B9@HK0PR03MB2994.apcprd03.prod.outlook.com>
  2022-10-04  6:23   ` Sean Anderson
  2022-10-01  7:39 ` [PATCH 2/3] cmd/sbi: error message for failure to get spec version Heinrich Schuchardt
  2022-10-01  7:39 ` [PATCH 3/3] cmd/sbi: user friendly short texts Heinrich Schuchardt
  2 siblings, 2 replies; 9+ messages in thread
From: Heinrich Schuchardt @ 2022-10-01  7:39 UTC (permalink / raw)
  To: Rick Chen, Leo; +Cc: u-boot, Heinrich Schuchardt

The SBI command can print out the version number of the SBI implementation.
Choose the correct output format for RustSBI.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 cmd/riscv/sbi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/cmd/riscv/sbi.c b/cmd/riscv/sbi.c
index 522f502435..160d7c7b30 100644
--- a/cmd/riscv/sbi.c
+++ b/cmd/riscv/sbi.c
@@ -74,6 +74,7 @@ static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc,
 					       vers >> 16, vers & 0xffff);
 					break;
 				case 3: /* KVM */
++				case 4: /* RustSBI */
 					printf("%ld.%ld.%ld",
 					       vers >> 16,
 					       (vers >> 8) & 0xff,
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] cmd/sbi: error message for failure to get spec version
  2022-10-01  7:39 [PATCH 0/3] sbi/cmd: improve output formatting Heinrich Schuchardt
  2022-10-01  7:39 ` [PATCH 1/3] cmd/sbi: format RustSBI version number Heinrich Schuchardt
@ 2022-10-01  7:39 ` Heinrich Schuchardt
       [not found]   ` <HK0PR03MB2994A74252CD46C27E390C47C15B9@HK0PR03MB2994.apcprd03.prod.outlook.com>
  2022-10-01  7:39 ` [PATCH 3/3] cmd/sbi: user friendly short texts Heinrich Schuchardt
  2 siblings, 1 reply; 9+ messages in thread
From: Heinrich Schuchardt @ 2022-10-01  7:39 UTC (permalink / raw)
  To: Rick Chen, Leo; +Cc: u-boot, Heinrich Schuchardt

If calling 'Get SBI specification version' fails, write an error message
and return CMD_RET_FAILURE.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 cmd/riscv/sbi.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/cmd/riscv/sbi.c b/cmd/riscv/sbi.c
index 160d7c7b30..70574bbc66 100644
--- a/cmd/riscv/sbi.c
+++ b/cmd/riscv/sbi.c
@@ -56,8 +56,11 @@ static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc,
 	long mvendorid, marchid, mimpid;
 
 	ret = sbi_get_spec_version();
-	if (ret >= 0)
-		printf("SBI %ld.%ld", ret >> 24, ret & 0xffffff);
+	if (ret < 0) {
+		printf("No SBI 0.2+\n");
+		return CMD_RET_FAILURE;
+	}
+	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) {
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] cmd/sbi: user friendly short texts
  2022-10-01  7:39 [PATCH 0/3] sbi/cmd: improve output formatting Heinrich Schuchardt
  2022-10-01  7:39 ` [PATCH 1/3] cmd/sbi: format RustSBI version number Heinrich Schuchardt
  2022-10-01  7:39 ` [PATCH 2/3] cmd/sbi: error message for failure to get spec version Heinrich Schuchardt
@ 2022-10-01  7:39 ` Heinrich Schuchardt
       [not found]   ` <HK0PR03MB2994EBF201F5989155DE0036C15B9@HK0PR03MB2994.apcprd03.prod.outlook.com>
  2 siblings, 1 reply; 9+ messages in thread
From: Heinrich Schuchardt @ 2022-10-01  7:39 UTC (permalink / raw)
  To: Rick Chen, Leo; +Cc: u-boot, Heinrich Schuchardt

In the sbi command use the same short texts for the legacy extensions
as the SBI specification 1.0.0.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
 cmd/riscv/sbi.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/cmd/riscv/sbi.c b/cmd/riscv/sbi.c
index 70574bbc66..e9872d7b66 100644
--- a/cmd/riscv/sbi.c
+++ b/cmd/riscv/sbi.c
@@ -30,15 +30,15 @@ static struct sbi_imp implementations[] = {
 };
 
 static struct sbi_ext extensions[] = {
-	{ SBI_EXT_0_1_SET_TIMER,	      "sbi_set_timer" },
-	{ SBI_EXT_0_1_CONSOLE_PUTCHAR,	      "sbi_console_putchar" },
-	{ SBI_EXT_0_1_CONSOLE_GETCHAR,	      "sbi_console_getchar" },
-	{ SBI_EXT_0_1_CLEAR_IPI,	      "sbi_clear_ipi" },
-	{ SBI_EXT_0_1_SEND_IPI,		      "sbi_send_ipi" },
-	{ SBI_EXT_0_1_REMOTE_FENCE_I,	      "sbi_remote_fence_i" },
-	{ SBI_EXT_0_1_REMOTE_SFENCE_VMA,      "sbi_remote_sfence_vma" },
-	{ SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID, "sbi_remote_sfence_vma_asid" },
-	{ SBI_EXT_0_1_SHUTDOWN,		      "sbi_shutdown" },
+	{ SBI_EXT_0_1_SET_TIMER,	      "Set Timer" },
+	{ SBI_EXT_0_1_CONSOLE_PUTCHAR,	      "Console Putchar" },
+	{ SBI_EXT_0_1_CONSOLE_GETCHAR,	      "Console Getchar" },
+	{ SBI_EXT_0_1_CLEAR_IPI,	      "Clear IPI" },
+	{ SBI_EXT_0_1_SEND_IPI,		      "Send IPI" },
+	{ SBI_EXT_0_1_REMOTE_FENCE_I,	      "Remote FENCE.I" },
+	{ SBI_EXT_0_1_REMOTE_SFENCE_VMA,      "Remote SFENCE.VMA" },
+	{ SBI_EXT_0_1_REMOTE_SFENCE_VMA_ASID, "Remote SFENCE.VMA with ASID" },
+	{ SBI_EXT_0_1_SHUTDOWN,		      "System Shutdown" },
 	{ SBI_EXT_BASE,			      "SBI Base Functionality" },
 	{ SBI_EXT_TIME,			      "Timer Extension" },
 	{ SBI_EXT_IPI,			      "IPI Extension" },
-- 
2.37.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] cmd/sbi: format RustSBI version number
       [not found]   ` <HK0PR03MB2994993437B0AEAE372695DAC15B9@HK0PR03MB2994.apcprd03.prod.outlook.com>
@ 2022-10-03  1:00     ` Rick Chen
  0 siblings, 0 replies; 9+ messages in thread
From: Rick Chen @ 2022-10-03  1:00 UTC (permalink / raw)
  To: heinrich.schuchardt; +Cc: U-Boot Mailing List, rick, Leo Liang

> From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> Sent: Saturday, October 01, 2022 3:40 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/3] cmd/sbi: format RustSBI version number
>
> The SBI command can print out the version number of the SBI implementation.
> Choose the correct output format for RustSBI.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  cmd/riscv/sbi.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Rick Chen <rick@andestech.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] cmd/sbi: error message for failure to get spec version
       [not found]   ` <HK0PR03MB2994A74252CD46C27E390C47C15B9@HK0PR03MB2994.apcprd03.prod.outlook.com>
@ 2022-10-03  1:01     ` Rick Chen
  0 siblings, 0 replies; 9+ messages in thread
From: Rick Chen @ 2022-10-03  1:01 UTC (permalink / raw)
  To: heinrich.schuchardt; +Cc: U-Boot Mailing List, rick, Leo Liang

> From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> Sent: Saturday, October 01, 2022 3:40 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/3] cmd/sbi: error message for failure to get spec version
>
> If calling 'Get SBI specification version' fails, write an error message and return CMD_RET_FAILURE.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  cmd/riscv/sbi.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)

Reviewed-by: Rick Chen <rick@andestech.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] cmd/sbi: user friendly short texts
       [not found]   ` <HK0PR03MB2994EBF201F5989155DE0036C15B9@HK0PR03MB2994.apcprd03.prod.outlook.com>
@ 2022-10-03  1:02     ` Rick Chen
  0 siblings, 0 replies; 9+ messages in thread
From: Rick Chen @ 2022-10-03  1:02 UTC (permalink / raw)
  To: heinrich.schuchardt; +Cc: U-Boot Mailing List, rick, Leo Liang

> From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> Sent: Saturday, October 01, 2022 3:40 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 3/3] cmd/sbi: user friendly short texts
>
> In the sbi command use the same short texts for the legacy extensions as the SBI specification 1.0.0.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>  cmd/riscv/sbi.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)

Reviewed-by: Rick Chen <rick@andestech.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] cmd/sbi: format RustSBI version number
  2022-10-01  7:39 ` [PATCH 1/3] cmd/sbi: format RustSBI version number Heinrich Schuchardt
       [not found]   ` <HK0PR03MB2994993437B0AEAE372695DAC15B9@HK0PR03MB2994.apcprd03.prod.outlook.com>
@ 2022-10-04  6:23   ` Sean Anderson
  2022-10-04  7:11     ` Leo Liang
  1 sibling, 1 reply; 9+ messages in thread
From: Sean Anderson @ 2022-10-04  6:23 UTC (permalink / raw)
  To: Heinrich Schuchardt, Rick Chen, Leo; +Cc: u-boot

On 10/1/22 03:39, Heinrich Schuchardt wrote:
> The SBI command can print out the version number of the SBI implementation.
> Choose the correct output format for RustSBI.
> 
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
>   cmd/riscv/sbi.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/cmd/riscv/sbi.c b/cmd/riscv/sbi.c
> index 522f502435..160d7c7b30 100644
> --- a/cmd/riscv/sbi.c
> +++ b/cmd/riscv/sbi.c
> @@ -74,6 +74,7 @@ static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc,
>   					       vers >> 16, vers & 0xffff);
>   					break;
>   				case 3: /* KVM */
> ++				case 4: /* RustSBI */

Did your patch get mangled?

>   					printf("%ld.%ld.%ld",
>   					       vers >> 16,
>   					       (vers >> 8) & 0xff,


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] cmd/sbi: format RustSBI version number
  2022-10-04  6:23   ` Sean Anderson
@ 2022-10-04  7:11     ` Leo Liang
  0 siblings, 0 replies; 9+ messages in thread
From: Leo Liang @ 2022-10-04  7:11 UTC (permalink / raw)
  To: Sean Anderson; +Cc: Heinrich Schuchardt, Rick Chen, u-boot

Hi Sean,
On Tue, Oct 04, 2022 at 02:23:33AM -0400, Sean Anderson wrote:
> On 10/1/22 03:39, Heinrich Schuchardt wrote:
> > The SBI command can print out the version number of the SBI implementation.
> > Choose the correct output format for RustSBI.
> > 
> > Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> > ---
> >   cmd/riscv/sbi.c | 1 +
> >   1 file changed, 1 insertion(+)
> > 
> > diff --git a/cmd/riscv/sbi.c b/cmd/riscv/sbi.c
> > index 522f502435..160d7c7b30 100644
> > --- a/cmd/riscv/sbi.c
> > +++ b/cmd/riscv/sbi.c
> > @@ -74,6 +74,7 @@ static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc,
> >   					       vers >> 16, vers & 0xffff);
> >   					break;
> >   				case 3: /* KVM */
> > ++				case 4: /* RustSBI */
> 
> Did your patch get mangled?

Thanks for the catch.
I will fix that extra '+' when merging the patches.

> 
> >   					printf("%ld.%ld.%ld",
> >   					       vers >> 16,
> >   					       (vers >> 8) & 0xff,
> 

Best regards,
Leo

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-10-04  7:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-01  7:39 [PATCH 0/3] sbi/cmd: improve output formatting Heinrich Schuchardt
2022-10-01  7:39 ` [PATCH 1/3] cmd/sbi: format RustSBI version number Heinrich Schuchardt
     [not found]   ` <HK0PR03MB2994993437B0AEAE372695DAC15B9@HK0PR03MB2994.apcprd03.prod.outlook.com>
2022-10-03  1:00     ` Rick Chen
2022-10-04  6:23   ` Sean Anderson
2022-10-04  7:11     ` Leo Liang
2022-10-01  7:39 ` [PATCH 2/3] cmd/sbi: error message for failure to get spec version Heinrich Schuchardt
     [not found]   ` <HK0PR03MB2994A74252CD46C27E390C47C15B9@HK0PR03MB2994.apcprd03.prod.outlook.com>
2022-10-03  1:01     ` Rick Chen
2022-10-01  7:39 ` [PATCH 3/3] cmd/sbi: user friendly short texts Heinrich Schuchardt
     [not found]   ` <HK0PR03MB2994EBF201F5989155DE0036C15B9@HK0PR03MB2994.apcprd03.prod.outlook.com>
2022-10-03  1:02     ` Rick Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.