diff options
author | Bin Meng <bmeng.cn@gmail.com> | 2020-03-09 06:52:41 +0300 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2020-03-10 07:57:28 +0300 |
commit | 650c0e525ce60e80b6756aa8cc4eeae5b20ccbd8 (patch) | |
tree | 579e92ff39fa780818fe483337850d28df5ddb15 /include | |
parent | 6e87507db6ce7be39ccccb33d6283814f0283c09 (diff) | |
download | opensbi-650c0e525ce60e80b6756aa8cc4eeae5b20ccbd8.tar.xz |
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/sbi/riscv_asm.h | 6 | ||||
-rw-r--r-- | include/sbi/sbi_bitops.h | 14 | ||||
-rw-r--r-- | include/sbi/sbi_const.h | 7 | ||||
-rw-r--r-- | include/sbi/sbi_ecall_interface.h | 22 | ||||
-rw-r--r-- | include/sbi/sbi_error.h | 32 | ||||
-rw-r--r-- | include/sbi/sbi_hsm.h | 2 | ||||
-rw-r--r-- | include/sbi/sbi_ipi.h | 21 | ||||
-rw-r--r-- | include/sbi/sbi_platform.h | 17 | ||||
-rw-r--r-- | include/sbi/sbi_scratch.h | 3 | ||||
-rw-r--r-- | include/sbi/sbi_types.h | 3 | ||||
-rw-r--r-- | include/sbi/sbi_version.h | 6 |
11 files changed, 71 insertions, 62 deletions
diff --git a/include/sbi/riscv_asm.h b/include/sbi/riscv_asm.h index 63df3fc..4445fa1 100644 --- a/include/sbi/riscv_asm.h +++ b/include/sbi/riscv_asm.h @@ -28,9 +28,9 @@ #error "Unexpected __riscv_xlen" #endif -#define PAGE_SHIFT (12) -#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE - 1)) +#define PAGE_SHIFT (12) +#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) +#define PAGE_MASK (~(PAGE_SIZE - 1)) #define REG_L __REG_SEL(ld, lw) #define REG_S __REG_SEL(sd, sw) diff --git a/include/sbi/sbi_bitops.h b/include/sbi/sbi_bitops.h index c55ced0..d920086 100644 --- a/include/sbi/sbi_bitops.h +++ b/include/sbi/sbi_bitops.h @@ -215,20 +215,20 @@ static inline unsigned long __fls(unsigned long word) (bit) = find_next_zero_bit((addr), (size), (bit) + 1)) unsigned long find_first_bit(const unsigned long *addr, - unsigned long size); + unsigned long size); unsigned long find_first_zero_bit(const unsigned long *addr, - unsigned long size); + unsigned long size); unsigned long find_last_bit(const unsigned long *addr, - unsigned long size); + unsigned long size); unsigned long find_next_bit(const unsigned long *addr, - unsigned long size, unsigned long offset); + unsigned long size, unsigned long offset); unsigned long find_next_zero_bit(const unsigned long *addr, - unsigned long size, - unsigned long offset); + unsigned long size, + unsigned long offset); /** * __set_bit - Set a bit in memory @@ -242,7 +242,7 @@ static inline void __set_bit(int nr, volatile unsigned long *addr) unsigned long mask = BIT_MASK(nr); unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr); - *p |= mask; + *p |= mask; } /** diff --git a/include/sbi/sbi_const.h b/include/sbi/sbi_const.h index 423d2cf..3786654 100644 --- a/include/sbi/sbi_const.h +++ b/include/sbi/sbi_const.h @@ -10,7 +10,8 @@ #ifndef __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 * 'UL' and other type specifiers unilaterally. We * use the following macros to deal with this. @@ -39,8 +40,8 @@ #define UL(x) (_UL(x)) #define ULL(x) (_ULL(x)) -#define __STR(s) #s -#define STRINGIFY(s) __STR(s) +#define __STR(s) #s +#define STRINGIFY(s) __STR(s) /* clang-format on */ diff --git a/include/sbi/sbi_ecall_interface.h b/include/sbi/sbi_ecall_interface.h index 727a545..225dcd4 100644 --- a/include/sbi/sbi_ecall_interface.h +++ b/include/sbi/sbi_ecall_interface.h @@ -31,11 +31,11 @@ /* SBI function IDs for BASE extension*/ #define SBI_EXT_BASE_GET_SPEC_VERSION 0x0 #define SBI_EXT_BASE_GET_IMP_ID 0x1 -#define SBI_EXT_BASE_GET_IMP_VERSION 0x2 -#define SBI_EXT_BASE_PROBE_EXT 0x3 -#define SBI_EXT_BASE_GET_MVENDORID 0x4 -#define SBI_EXT_BASE_GET_MARCHID 0x5 -#define SBI_EXT_BASE_GET_MIMPID 0x6 +#define SBI_EXT_BASE_GET_IMP_VERSION 0x2 +#define SBI_EXT_BASE_PROBE_EXT 0x3 +#define SBI_EXT_BASE_GET_MVENDORID 0x4 +#define SBI_EXT_BASE_GET_MARCHID 0x5 +#define SBI_EXT_BASE_GET_MIMPID 0x6 /* SBI function IDs for TIME extension*/ #define SBI_EXT_TIME_SET_TIMER 0x0 @@ -44,7 +44,7 @@ #define SBI_EXT_IPI_SEND_IPI 0x0 /* SBI function IDs for RFENCE extension*/ -#define SBI_EXT_RFENCE_REMOTE_FENCE_I 0x0 +#define SBI_EXT_RFENCE_REMOTE_FENCE_I 0x0 #define SBI_EXT_RFENCE_REMOTE_SFENCE_VMA 0x1 #define SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID 0x2 #define SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA 0x3 @@ -62,11 +62,11 @@ #define SBI_HSM_HART_STATUS_START_PENDING 0x2 #define SBI_HSM_HART_STATUS_STOP_PENDING 0x3 -#define SBI_SPEC_VERSION_MAJOR_OFFSET 24 -#define SBI_SPEC_VERSION_MAJOR_MASK 0x7f -#define SBI_SPEC_VERSION_MINOR_MASK 0xffffff -#define SBI_EXT_VENDOR_START 0x09000000 -#define SBI_EXT_VENDOR_END 0x09FFFFFF +#define SBI_SPEC_VERSION_MAJOR_OFFSET 24 +#define SBI_SPEC_VERSION_MAJOR_MASK 0x7f +#define SBI_SPEC_VERSION_MINOR_MASK 0xffffff +#define SBI_EXT_VENDOR_START 0x09000000 +#define SBI_EXT_VENDOR_END 0x09FFFFFF /* clang-format on */ #endif diff --git a/include/sbi/sbi_error.h b/include/sbi/sbi_error.h index 91ba2ee..574a84d 100644 --- a/include/sbi/sbi_error.h +++ b/include/sbi/sbi_error.h @@ -12,22 +12,22 @@ /* clang-format off */ -#define SBI_OK 0 -#define SBI_EFAIL -1 -#define SBI_ENOTSUPP -2 -#define SBI_EINVAL -3 -#define SBI_DENIED -4 -#define SBI_INVALID_ADDR -5 -#define SBI_ENODEV -6 -#define SBI_ENOSYS -7 -#define SBI_ETIMEDOUT -8 -#define SBI_EIO -9 -#define SBI_EILL -10 -#define SBI_ENOSPC -11 -#define SBI_ENOMEM -12 -#define SBI_ETRAP -13 -#define SBI_EUNKNOWN -14 -#define SBI_ENOENT -15 +#define SBI_OK 0 +#define SBI_EFAIL -1 +#define SBI_ENOTSUPP -2 +#define SBI_EINVAL -3 +#define SBI_DENIED -4 +#define SBI_INVALID_ADDR -5 +#define SBI_ENODEV -6 +#define SBI_ENOSYS -7 +#define SBI_ETIMEDOUT -8 +#define SBI_EIO -9 +#define SBI_EILL -10 +#define SBI_ENOSPC -11 +#define SBI_ENOMEM -12 +#define SBI_ETRAP -13 +#define SBI_EUNKNOWN -14 +#define SBI_ENOENT -15 #define SBI_EALREADY_STARTED -16 /* clang-format on */ diff --git a/include/sbi/sbi_hsm.h b/include/sbi/sbi_hsm.h index 11ea7cf..a68eafb 100644 --- a/include/sbi/sbi_hsm.h +++ b/include/sbi/sbi_hsm.h @@ -22,7 +22,7 @@ int sbi_hsm_init(struct sbi_scratch *scratch, u32 hartid, bool cold_boot); void __noreturn sbi_hsm_exit(struct sbi_scratch *scratch); int sbi_hsm_hart_start(struct sbi_scratch *scratch, u32 hartid, - ulong saddr, ulong priv); + ulong saddr, ulong priv); int sbi_hsm_hart_stop(struct sbi_scratch *scratch, bool exitnow); int sbi_hsm_hart_get_state(struct sbi_scratch *scratch, u32 hartid); int sbi_hsm_hart_state_to_status(int state); diff --git a/include/sbi/sbi_ipi.h b/include/sbi/sbi_ipi.h index d680148..bf91142 100644 --- a/include/sbi/sbi_ipi.h +++ b/include/sbi/sbi_ipi.h @@ -25,23 +25,26 @@ struct sbi_ipi_event_ops { /** Name of the IPI event operations */ char name[32]; - /** Update callback to save/enqueue data for remote HART - * Note: This is an optional callback and it is called just before - * triggering IPI to remote HART. + /** + * Update callback to save/enqueue data for remote HART + * Note: This is an optional callback and it is called just before + * triggering IPI to remote HART. */ int (* update)(struct sbi_scratch *scratch, struct sbi_scratch *remote_scratch, u32 remote_hartid, void *data); - /** Sync callback to wait for remote HART - * Note: This is an optional callback and it is called just after - * triggering IPI to remote HART. + /** + * Sync callback to wait for remote HART + * Note: This is an optional callback and it is called just after + * triggering IPI to remote HART. */ void (* sync)(struct sbi_scratch *scratch); - /** Process callback to handle IPI event - * Note: This is a mandatory callback and it is called on the - * remote HART after IPI is triggered. + /** + * Process callback to handle IPI event + * Note: This is a mandatory callback and it is called on the + * remote HART after IPI is triggered. */ void (* process)(struct sbi_scratch *scratch); }; diff --git a/include/sbi/sbi_platform.h b/include/sbi/sbi_platform.h index 462006e..a28bc50 100644 --- a/include/sbi/sbi_platform.h +++ b/include/sbi/sbi_platform.h @@ -10,9 +10,10 @@ #ifndef __SBI_PLATFORM_H__ #define __SBI_PLATFORM_H__ -/** OpenSBI 32-bit platform version with: - * 1. upper 16-bits as major number - * 2. lower 16-bits as minor number +/** + * OpenSBI 32-bit platform version with: + * 1. upper 16-bits as major number + * 2. lower 16-bits as minor number */ #define SBI_PLATFORM_VERSION(Major, Minor) ((Major << 16) | Minor) @@ -81,12 +82,14 @@ struct sbi_platform_operations { /** Platform final exit */ 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. */ 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. */ int (*misa_get_xlen)(void); @@ -138,8 +141,8 @@ struct sbi_platform_operations { /** Bringup the given hart from previous stage **/ int (*hart_start)(u32 hartid, ulong saddr, ulong priv); /** - * Stop the current hart from running. This call doesn't expect to - * return if success. + * Stop the current hart from running. This call doesn't expect to + * return if success. */ int (*hart_stop)(void); diff --git a/include/sbi/sbi_scratch.h b/include/sbi/sbi_scratch.h index 0309349..1c85562 100644 --- a/include/sbi/sbi_scratch.h +++ b/include/sbi/sbi_scratch.h @@ -85,7 +85,8 @@ enum sbi_scratch_options { #define sbi_scratch_thishart_arg1_ptr() \ ((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) * on success diff --git a/include/sbi/sbi_types.h b/include/sbi/sbi_types.h index b1686bf..b59a6ff 100644 --- a/include/sbi/sbi_types.h +++ b/include/sbi/sbi_types.h @@ -89,7 +89,8 @@ typedef unsigned long physical_size_t; /* clang-format on */ #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. * OPENSBI_EXTERNAL_SBI_TYPES is the file name to external header file, * the external build system should address the additional include diff --git a/include/sbi/sbi_version.h b/include/sbi/sbi_version.h index 62615a8..a71de3c 100644 --- a/include/sbi/sbi_version.h +++ b/include/sbi/sbi_version.h @@ -14,9 +14,9 @@ #define OPENSBI_VERSION_MINOR 6 /** - * OpenSBI 32-bit version with: - * 1. upper 16-bits as major number - * 2. lower 16-bits as minor number + * OpenSBI 32-bit version with: + * 1. upper 16-bits as major number + * 2. lower 16-bits as minor number */ #define OPENSBI_VERSION ((OPENSBI_VERSION_MAJOR << 16) | \ (OPENSBI_VERSION_MINOR)) |