diff options
author | Olof Johansson <olof@lixom.net> | 2019-04-10 17:41:46 -0700 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2019-04-24 09:49:46 +0530 |
commit | fbf986ac2a0b926ae97e6796b87e366610d7589e (patch) | |
tree | 1d65814b7832b1173c4094e4f91c7da9f491e87a | |
parent | 97fb8c0e3bcd4d7915ea35020e4d95999d389cd3 (diff) |
all: Annotate some tables to have clang-format leave them alone
One of the shortcomings of clang-format is that it doesn't allow
for aligned define tables, which is used for a number of constants.
Add annotation to disable the automatic formatting where needed.
Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r-- | include/sbi/riscv_asm.h | 4 | ||||
-rw-r--r-- | include/sbi/riscv_barrier.h | 4 | ||||
-rw-r--r-- | include/sbi/riscv_encoding.h | 3 | ||||
-rw-r--r-- | include/sbi/riscv_io.h | 5 | ||||
-rw-r--r-- | include/sbi/sbi_const.h | 4 | ||||
-rw-r--r-- | include/sbi/sbi_ecall_interface.h | 4 | ||||
-rw-r--r-- | include/sbi/sbi_error.h | 4 | ||||
-rw-r--r-- | include/sbi/sbi_ipi.h | 4 | ||||
-rw-r--r-- | include/sbi/sbi_scratch.h | 4 | ||||
-rw-r--r-- | include/sbi/sbi_trap.h | 4 | ||||
-rw-r--r-- | include/sbi/sbi_types.h | 4 | ||||
-rw-r--r-- | platform/common/serial/sifive-uart.c | 4 | ||||
-rw-r--r-- | platform/common/serial/uart8250.c | 4 | ||||
-rw-r--r-- | platform/kendryte/k210/platform.h | 5 | ||||
-rw-r--r-- | platform/kendryte/k210/uarths.h | 4 | ||||
-rw-r--r-- | platform/qemu/sifive_u/platform.c | 4 | ||||
-rw-r--r-- | platform/qemu/virt/platform.c | 4 | ||||
-rw-r--r-- | platform/sifive/fu540/platform.c | 4 |
18 files changed, 72 insertions, 1 deletions
diff --git a/include/sbi/riscv_asm.h b/include/sbi/riscv_asm.h index 9648629..39a7615 100644 --- a/include/sbi/riscv_asm.h +++ b/include/sbi/riscv_asm.h @@ -12,6 +12,8 @@ #include <sbi/riscv_encoding.h> +/* clang-format off */ + #ifdef __ASSEMBLY__ #define __ASM_STR(x) x #else @@ -78,6 +80,8 @@ #error "Unexpected __SIZEOF_SHORT__" #endif +/* clang-format on */ + #ifndef __ASSEMBLY__ #define csr_swap(csr, val) \ diff --git a/include/sbi/riscv_barrier.h b/include/sbi/riscv_barrier.h index ce4b5d1..14ebecc 100644 --- a/include/sbi/riscv_barrier.h +++ b/include/sbi/riscv_barrier.h @@ -10,6 +10,8 @@ #ifndef __RISCV_BARRIER_H__ #define __RISCV_BARRIER_H__ +/* clang-format off */ + #define RISCV_ACQUIRE_BARRIER "\tfence r , rw\n" #define RISCV_RELEASE_BARRIER "\tfence rw, w\n" @@ -37,6 +39,8 @@ /* CPU relax for busy loop */ #define cpu_relax() asm volatile ("" : : : "memory") +/* clang-format on */ + #define __smp_store_release(p, v) \ do { \ RISCV_FENCE(rw,w); \ diff --git a/include/sbi/riscv_encoding.h b/include/sbi/riscv_encoding.h index 1448f58..5a5086a 100644 --- a/include/sbi/riscv_encoding.h +++ b/include/sbi/riscv_encoding.h @@ -14,6 +14,7 @@ /* TODO: Make constants usable in assembly with _AC() macro */ +/* clang-format off */ #define MSTATUS_UIE 0x00000001 #define MSTATUS_SIE 0x00000002 #define MSTATUS_HIE 0x00000004 @@ -561,4 +562,6 @@ (s32)(((insn) >> 7) & 0x1f)) #define MASK_FUNCT3 0x7000 +/* clang-format on */ + #endif diff --git a/include/sbi/riscv_io.h b/include/sbi/riscv_io.h index ea29c44..e4bdc27 100644 --- a/include/sbi/riscv_io.h +++ b/include/sbi/riscv_io.h @@ -70,6 +70,9 @@ static inline u64 __raw_readq(const volatile void *addr) #endif /* FIXME: These are now the same as asm-generic */ + +/* clang-format off */ + #define __io_rbr() do {} while (0) #define __io_rar() do {} while (0) #define __io_rbw() do {} while (0) @@ -106,4 +109,6 @@ static inline u64 __raw_readq(const volatile void *addr) #define writeq(v,c) ({ __io_bw(); __raw_writeq((v),(c)); __io_aw(); }) #endif +/* clang-format on */ + #endif diff --git a/include/sbi/sbi_const.h b/include/sbi/sbi_const.h index e90b752..423d2cf 100644 --- a/include/sbi/sbi_const.h +++ b/include/sbi/sbi_const.h @@ -19,6 +19,8 @@ * leave it unchanged in asm. */ +/* clang-format off */ + #ifdef __ASSEMBLY__ #define _AC(X,Y) X #define _AT(T,X) X @@ -40,4 +42,6 @@ #define __STR(s) #s #define STRINGIFY(s) __STR(s) +/* clang-format on */ + #endif diff --git a/include/sbi/sbi_ecall_interface.h b/include/sbi/sbi_ecall_interface.h index 2bf004d..8e79e24 100644 --- a/include/sbi/sbi_ecall_interface.h +++ b/include/sbi/sbi_ecall_interface.h @@ -10,6 +10,8 @@ #ifndef __SBI_ECALL_INTERFACE_H__ #define __SBI_ECALL_INTERFACE_H__ +/* clang-format off */ + #define SBI_ECALL_SET_TIMER 0 #define SBI_ECALL_CONSOLE_PUTCHAR 1 #define SBI_ECALL_CONSOLE_GETCHAR 2 @@ -20,6 +22,8 @@ #define SBI_ECALL_REMOTE_SFENCE_VMA_ASID 7 #define SBI_ECALL_SHUTDOWN 8 +/* clang-format on */ + #define SBI_ECALL(__num, __a0, __a1, __a2) ({ \ register unsigned long a0 asm ("a0") = (unsigned long)(__a0); \ register unsigned long a1 asm ("a1") = (unsigned long)(__a1); \ diff --git a/include/sbi/sbi_error.h b/include/sbi/sbi_error.h index 300ee74..39a3864 100644 --- a/include/sbi/sbi_error.h +++ b/include/sbi/sbi_error.h @@ -10,6 +10,8 @@ #ifndef __SBI_ERROR_H__ #define __SBI_ERROR_H__ +/* clang-format off */ + #define SBI_OK 0 #define SBI_EUNKNOWN -1 #define SBI_EFAIL -2 @@ -23,4 +25,6 @@ #define SBI_EILL -10 #define SBI_ENOSPC -11 +/* clang-format on */ + #endif diff --git a/include/sbi/sbi_ipi.h b/include/sbi/sbi_ipi.h index 609598e..f68e8fe 100644 --- a/include/sbi/sbi_ipi.h +++ b/include/sbi/sbi_ipi.h @@ -12,12 +12,16 @@ #include <sbi/sbi_types.h> +/* clang-format off */ + #define SBI_IPI_EVENT_SOFT 0x1 #define SBI_IPI_EVENT_FENCE_I 0x2 #define SBI_IPI_EVENT_SFENCE_VMA 0x4 #define SBI_IPI_EVENT_SFENCE_VMA_ASID 0x8 #define SBI_IPI_EVENT_HALT 0x10 +/* clang-format on */ + #define SBI_TLB_FIFO_NUM_ENTRIES 4 enum sbi_tlb_info_types { SBI_TLB_FLUSH_VMA, diff --git a/include/sbi/sbi_scratch.h b/include/sbi/sbi_scratch.h index a41549c..fabbab0 100644 --- a/include/sbi/sbi_scratch.h +++ b/include/sbi/sbi_scratch.h @@ -12,6 +12,8 @@ #include <sbi/riscv_asm.h> +/* clang-format off */ + /** Offset of fw_start member in sbi_scratch */ #define SBI_SCRATCH_FW_START_OFFSET (0 * __SIZEOF_POINTER__) /** Offset of fw_size member in sbi_scratch */ @@ -43,6 +45,8 @@ /** Maximum size of sbi_scratch and sbi_ipi_data */ #define SBI_SCRATCH_SIZE (64 * __SIZEOF_POINTER__) +/* clang-format on */ + #ifndef __ASSEMBLY__ #include <sbi/sbi_types.h> diff --git a/include/sbi/sbi_trap.h b/include/sbi/sbi_trap.h index 504e7dd..e2a52b5 100644 --- a/include/sbi/sbi_trap.h +++ b/include/sbi/sbi_trap.h @@ -10,6 +10,8 @@ #ifndef __SBI_TRAP_H__ #define __SBI_TRAP_H__ +/* clang-format off */ + /** Index of zero member in sbi_trap_regs */ #define SBI_TRAP_REGS_zero 0 /** Index of ra member in sbi_trap_regs */ @@ -81,6 +83,8 @@ /** Last member index in sbi_trap_regs */ #define SBI_TRAP_REGS_last 34 +/* clang-format on */ + /** Get offset of member with name 'x' in sbi_trap_regs */ #define SBI_TRAP_REGS_OFFSET(x) \ ((SBI_TRAP_REGS_##x) * __SIZEOF_POINTER__) diff --git a/include/sbi/sbi_types.h b/include/sbi/sbi_types.h index 40909f6..f51d888 100644 --- a/include/sbi/sbi_types.h +++ b/include/sbi/sbi_types.h @@ -10,6 +10,8 @@ #ifndef __SBI_TYPES_H__ #define __SBI_TYPES_H__ +/* clang-format off */ + typedef char s8; typedef unsigned char u8; typedef unsigned char uint8_t; @@ -58,4 +60,6 @@ typedef unsigned long physical_size_t; #define __packed __attribute__((packed)) #define __noreturn __attribute__((noreturn)) +/* clang-format on */ + #endif diff --git a/platform/common/serial/sifive-uart.c b/platform/common/serial/sifive-uart.c index 08cc485..9d9490c 100644 --- a/platform/common/serial/sifive-uart.c +++ b/platform/common/serial/sifive-uart.c @@ -11,6 +11,8 @@ #include <sbi/sbi_console.h> #include <plat/serial/sifive-uart.h> +/* clang-format off */ + #define UART_REG_TXFIFO 0 #define UART_REG_RXFIFO 1 #define UART_REG_TXCTRL 2 @@ -25,6 +27,8 @@ #define UART_TXCTRL_TXEN 0x1 #define UART_RXCTRL_RXEN 0x1 +/* clang-format on */ + static volatile void *uart_base; static u32 uart_in_freq; static u32 uart_baudrate; diff --git a/platform/common/serial/uart8250.c b/platform/common/serial/uart8250.c index ce0f4ca..ba67c73 100644 --- a/platform/common/serial/uart8250.c +++ b/platform/common/serial/uart8250.c @@ -10,6 +10,8 @@ #include <sbi/riscv_io.h> #include <plat/serial/uart8250.h> +/* clang-format off */ + #define UART_RBR_OFFSET 0 /* In: Recieve Buffer Register */ #define UART_THR_OFFSET 0 /* Out: Transmitter Holding Register */ #define UART_DLL_OFFSET 0 /* Out: Divisor Latch Low */ @@ -34,6 +36,8 @@ #define UART_LSR_DR 0x01 /* Receiver data ready */ #define UART_LSR_BRK_ERROR_BITS 0x1E /* BI, FE, PE, OE bits */ +/* clang-format on */ + static volatile void *uart8250_base; static u32 uart8250_in_freq; static u32 uart8250_baudrate; diff --git a/platform/kendryte/k210/platform.h b/platform/kendryte/k210/platform.h index 982d942..8694ea8 100644 --- a/platform/kendryte/k210/platform.h +++ b/platform/kendryte/k210/platform.h @@ -22,6 +22,8 @@ #include <sbi/riscv_asm.h> +/* clang-format off */ + #define K210_HART_COUNT 2 #define K210_HART_STACK_SIZE 4096 @@ -171,5 +173,6 @@ enum plic_irq { #define PLIC_NUM_SOURCES (IRQN_MAX - 1) #define PLIC_NUM_PRIORITIES (7) -#endif /* _PLATFORM_H_ */ +/* clang-format on */ +#endif /* _PLATFORM_H_ */ diff --git a/platform/kendryte/k210/uarths.h b/platform/kendryte/k210/uarths.h index ad3308c..3bfb8d5 100644 --- a/platform/kendryte/k210/uarths.h +++ b/platform/kendryte/k210/uarths.h @@ -50,6 +50,8 @@ #include <sbi/sbi_types.h> +/* clang-format off */ + /* Base register address */ #define UARTHS_BASE_ADDR (0x38000000U) @@ -74,6 +76,8 @@ #define UARTHS_IP_TXWM 0x01 #define UARTHS_IP_RXWM 0x02 +/* clang-format on */ + struct uarths_txdata { /* Bits [7:0] is data */ u32 data : 8; diff --git a/platform/qemu/sifive_u/platform.c b/platform/qemu/sifive_u/platform.c index cc8993d..9ea090a 100644 --- a/platform/qemu/sifive_u/platform.c +++ b/platform/qemu/sifive_u/platform.c @@ -15,6 +15,8 @@ #include <plat/serial/sifive-uart.h> #include <plat/sys/clint.h> +/* clang-format off */ + #define SIFIVE_U_HART_COUNT 1 #define SIFIVE_U_HART_STACK_SIZE 8192 @@ -30,6 +32,8 @@ #define SIFIVE_U_UART0_ADDR 0x10013000 #define SIFIVE_U_UART1_ADDR 0x10023000 +/* clang-format on */ + static int sifive_u_final_init(bool cold_boot) { void *fdt; diff --git a/platform/qemu/virt/platform.c b/platform/qemu/virt/platform.c index fd4d829..df62991 100644 --- a/platform/qemu/virt/platform.c +++ b/platform/qemu/virt/platform.c @@ -17,6 +17,8 @@ #include <plat/serial/uart8250.h> #include <plat/sys/clint.h> +/* clang-format off */ + #define VIRT_HART_COUNT 8 #define VIRT_HART_STACK_SIZE 8192 @@ -34,6 +36,8 @@ #define VIRT_UART_BAUDRATE 115200 #define VIRT_UART_SHIFTREG_ADDR 1843200 +/* clang-format on */ + static int virt_final_init(bool cold_boot) { void *fdt; diff --git a/platform/sifive/fu540/platform.c b/platform/sifive/fu540/platform.c index 325beba..9042d60 100644 --- a/platform/sifive/fu540/platform.c +++ b/platform/sifive/fu540/platform.c @@ -19,6 +19,8 @@ #include <plat/serial/sifive-uart.h> #include <plat/sys/clint.h> +/* clang-format off */ + #define FU540_HART_COUNT 5 #define FU540_HART_STACK_SIZE 8192 @@ -50,6 +52,8 @@ #define FU540_PRCI_CLKMUXSTATUSREG 0x002C #define FU540_PRCI_CLKMUX_STATUS_TLCLKSEL (0x1 << 1) +/* clang-format on */ + static void fu540_modify_dt(void *fdt) { u32 i, size; |