lib: sbi: Fix coding style issues

This fixes various coding style issues found in the SBI codes.
No functional changes.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
Bin Meng 2020-03-08 20:52:41 -07:00 committed by Anup Patel
parent 6e87507db6
commit 650c0e525c
19 changed files with 113 additions and 103 deletions

View file

@ -10,7 +10,8 @@
#ifndef __SBI_CONST_H__ #ifndef __SBI_CONST_H__
#define __SBI_CONST_H__ #define __SBI_CONST_H__
/* Some constant macros are used in both assembler and /*
* Some constant macros are used in both assembler and
* C code. Therefore we cannot annotate them always with * C code. Therefore we cannot annotate them always with
* 'UL' and other type specifiers unilaterally. We * 'UL' and other type specifiers unilaterally. We
* use the following macros to deal with this. * use the following macros to deal with this.

View file

@ -25,7 +25,8 @@ struct sbi_ipi_event_ops {
/** Name of the IPI event operations */ /** Name of the IPI event operations */
char name[32]; char name[32];
/** Update callback to save/enqueue data for remote HART /**
* Update callback to save/enqueue data for remote HART
* Note: This is an optional callback and it is called just before * Note: This is an optional callback and it is called just before
* triggering IPI to remote HART. * triggering IPI to remote HART.
*/ */
@ -33,13 +34,15 @@ struct sbi_ipi_event_ops {
struct sbi_scratch *remote_scratch, struct sbi_scratch *remote_scratch,
u32 remote_hartid, void *data); u32 remote_hartid, void *data);
/** Sync callback to wait for remote HART /**
* Sync callback to wait for remote HART
* Note: This is an optional callback and it is called just after * Note: This is an optional callback and it is called just after
* triggering IPI to remote HART. * triggering IPI to remote HART.
*/ */
void (* sync)(struct sbi_scratch *scratch); void (* sync)(struct sbi_scratch *scratch);
/** Process callback to handle IPI event /**
* Process callback to handle IPI event
* Note: This is a mandatory callback and it is called on the * Note: This is a mandatory callback and it is called on the
* remote HART after IPI is triggered. * remote HART after IPI is triggered.
*/ */

View file

@ -10,7 +10,8 @@
#ifndef __SBI_PLATFORM_H__ #ifndef __SBI_PLATFORM_H__
#define __SBI_PLATFORM_H__ #define __SBI_PLATFORM_H__
/** OpenSBI 32-bit platform version with: /**
* OpenSBI 32-bit platform version with:
* 1. upper 16-bits as major number * 1. upper 16-bits as major number
* 2. lower 16-bits as minor number * 2. lower 16-bits as minor number
*/ */
@ -81,12 +82,14 @@ struct sbi_platform_operations {
/** Platform final exit */ /** Platform final exit */
void (*final_exit)(void); void (*final_exit)(void);
/** For platforms that do not implement misa, non-standard /**
* For platforms that do not implement misa, non-standard
* methods are needed to determine cpu extension. * methods are needed to determine cpu extension.
*/ */
int (*misa_check_extension)(char ext); int (*misa_check_extension)(char ext);
/** For platforms that do not implement misa, non-standard /**
* For platforms that do not implement misa, non-standard
* methods are needed to get MXL field of misa. * methods are needed to get MXL field of misa.
*/ */
int (*misa_get_xlen)(void); int (*misa_get_xlen)(void);

View file

@ -85,7 +85,8 @@ enum sbi_scratch_options {
#define sbi_scratch_thishart_arg1_ptr() \ #define sbi_scratch_thishart_arg1_ptr() \
((void *)(sbi_scratch_thishart_ptr()->next_arg1)) ((void *)(sbi_scratch_thishart_ptr()->next_arg1))
/** Allocate from extra space in sbi_scratch /**
* Allocate from extra space in sbi_scratch
* *
* @return zero on failure and non-zero (>= SBI_SCRATCH_EXTRA_SPACE_OFFSET) * @return zero on failure and non-zero (>= SBI_SCRATCH_EXTRA_SPACE_OFFSET)
* on success * on success

View file

@ -89,7 +89,8 @@ typedef unsigned long physical_size_t;
/* clang-format on */ /* clang-format on */
#else #else
/* OPENSBI_EXTERNAL_SBI_TYPES could be defined in CFLAGS for using the /*
* OPENSBI_EXTERNAL_SBI_TYPES could be defined in CFLAGS for using the
* external definitions of data types and common macros. * external definitions of data types and common macros.
* OPENSBI_EXTERNAL_SBI_TYPES is the file name to external header file, * OPENSBI_EXTERNAL_SBI_TYPES is the file name to external header file,
* the external build system should address the additional include * the external build system should address the additional include

View file

@ -105,7 +105,8 @@ int sbi_ecall_handler(u32 hartid, ulong mcause, struct sbi_trap_regs *regs,
trap.epc = regs->mepc; trap.epc = regs->mepc;
sbi_trap_redirect(regs, &trap, scratch); sbi_trap_redirect(regs, &trap, scratch);
} else { } else {
/* This function should return non-zero value only in case of /*
* This function should return non-zero value only in case of
* fatal error. However, there is no good way to distinguish * fatal error. However, there is no good way to distinguish
* between a fatal and non-fatal errors yet. That's why we treat * between a fatal and non-fatal errors yet. That's why we treat
* every return value except ETRAP as non-fatal and just return * every return value except ETRAP as non-fatal and just return

View file

@ -75,7 +75,7 @@ static int delegate_traps(struct sbi_scratch *scratch, u32 hartid)
unsigned long interrupts, exceptions; unsigned long interrupts, exceptions;
if (!misa_extension('S')) if (!misa_extension('S'))
/* No delegation possible as mideleg does not exist*/ /* No delegation possible as mideleg does not exist */
return 0; return 0;
/* Send M-mode interrupts and most exceptions to S-mode */ /* Send M-mode interrupts and most exceptions to S-mode */

View file

@ -178,7 +178,7 @@ int sbi_trap_redirect(struct sbi_trap_regs *regs,
regs->mstatus &= ~MSTATUS_MPP; regs->mstatus &= ~MSTATUS_MPP;
regs->mstatus |= (PRV_S << MSTATUS_MPP_SHIFT); regs->mstatus |= (PRV_S << MSTATUS_MPP_SHIFT);
/* Set SPP for S-mode*/ /* Set SPP for S-mode */
regs->mstatus &= ~MSTATUS_SPP; regs->mstatus &= ~MSTATUS_SPP;
if (prev_mode == PRV_S) if (prev_mode == PRV_S)
regs->mstatus |= (1UL << MSTATUS_SPP_SHIFT); regs->mstatus |= (1UL << MSTATUS_SPP_SHIFT);