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

Leo Liang ycliang at andestech.com
Mon Mar 8 07:25:39 CET 2021


On Thu, Mar 04, 2021 at 05:00:48PM +0000, Heinrich Schuchardt wrote:
> Use constants for extension IDs.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
>  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[] = {
> -	{ 0x00000000, "sbi_set_timer" },
> -	{ 0x00000001, "sbi_console_putchar" },
> -	{ 0x00000002, "sbi_console_getchar" },
> -	{ 0x00000003, "sbi_clear_ipi" },
> -	{ 0x00000004, "sbi_send_ipi" },
> -	{ 0x00000005, "sbi_remote_fence_i" },
> -	{ 0x00000006, "sbi_remote_sfence_vma" },
> -	{ 0x00000007, "sbi_remote_sfence_vma_asid" },
> -	{ 0x00000008, "sbi_shutdown" },
> -	{ 0x00000010, "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 <ycliang at andestech.com>


More information about the U-Boot mailing list