Re: [PATCH 2/5] cmd/sbi: use constants instead of numerical values

2021-03-07 Thread Leo Liang
On Thu, Mar 04, 2021 at 05:00:48PM +, Heinrich Schuchardt wrote:
> Use constants for extension IDs.
> 
> Signed-off-by: Heinrich Schuchardt 
> ---
>  cmd/riscv/sbi.c | 30 +++---
>  1 file changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/cmd/riscv/sbi.c b/cmd/riscv/sbi.c
> index 90c0811e14..65a2c93290 100644
> --- a/cmd/riscv/sbi.c
> +++ b/cmd/riscv/sbi.c
> @@ -29,21 +29,21 @@ static struct sbi_imp implementations[] = {
>  };
> 
>  static struct sbi_ext extensions[] = {
> - { 0x, "sbi_set_timer" },
> - { 0x0001, "sbi_console_putchar" },
> - { 0x0002, "sbi_console_getchar" },
> - { 0x0003, "sbi_clear_ipi" },
> - { 0x0004, "sbi_send_ipi" },
> - { 0x0005, "sbi_remote_fence_i" },
> - { 0x0006, "sbi_remote_sfence_vma" },
> - { 0x0007, "sbi_remote_sfence_vma_asid" },
> - { 0x0008, "sbi_shutdown" },
> - { 0x0010, "SBI Base Functionality" },
> - { 0x54494D45, "Timer Extension" },
> - { 0x00735049, "IPI Extension" },
> - { 0x52464E43, "RFENCE Extension" },
> - { 0x0048534D, "Hart State Management Extension" },
> - { 0x53525354, "System Reset Extension" },
> + { 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_BASE,   "SBI Base Functionality" },
> + { SBI_EXT_TIME,   "Timer Extension" },
> + { SBI_EXT_IPI,"IPI Extension" },
> + { SBI_EXT_RFENCE, "RFENCE Extension" },
> + { SBI_EXT_HSM,"Hart State Management Extension" 
> },
> + { SBI_EXT_SRST,   "System Reset Extension" },
>  };
> 
>  static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc,
> --
> 2.30.1
>

Reviewed-by: Leo Yu-Chi Liang 


Re: [PATCH 2/5] cmd/sbi: use constants instead of numerical values

2021-03-04 Thread Sean Anderson

On 3/4/21 12:00 PM, Heinrich Schuchardt wrote:

Use constants for extension IDs.

Signed-off-by: Heinrich Schuchardt 
---
  cmd/riscv/sbi.c | 30 +++---
  1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/cmd/riscv/sbi.c b/cmd/riscv/sbi.c
index 90c0811e14..65a2c93290 100644
--- a/cmd/riscv/sbi.c
+++ b/cmd/riscv/sbi.c
@@ -29,21 +29,21 @@ static struct sbi_imp implementations[] = {
  };

  static struct sbi_ext extensions[] = {
-   { 0x, "sbi_set_timer" },
-   { 0x0001, "sbi_console_putchar" },
-   { 0x0002, "sbi_console_getchar" },
-   { 0x0003, "sbi_clear_ipi" },
-   { 0x0004, "sbi_send_ipi" },
-   { 0x0005, "sbi_remote_fence_i" },
-   { 0x0006, "sbi_remote_sfence_vma" },
-   { 0x0007, "sbi_remote_sfence_vma_asid" },
-   { 0x0008, "sbi_shutdown" },
-   { 0x0010, "SBI Base Functionality" },
-   { 0x54494D45, "Timer Extension" },
-   { 0x00735049, "IPI Extension" },
-   { 0x52464E43, "RFENCE Extension" },
-   { 0x0048534D, "Hart State Management Extension" },
-   { 0x53525354, "System Reset Extension" },
+   { 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_BASE,   "SBI Base Functionality" },
+   { SBI_EXT_TIME,   "Timer Extension" },
+   { SBI_EXT_IPI,"IPI Extension" },
+   { SBI_EXT_RFENCE, "RFENCE Extension" },
+   { SBI_EXT_HSM,"Hart State Management Extension" 
},
+   { SBI_EXT_SRST,   "System Reset Extension" },
  };

  static int do_sbi(struct cmd_tbl *cmdtp, int flag, int argc,
--
2.30.1



Reviewed-by: Sean Anderson