diff options
author | Aaron Durbin <adurbin@chromium.org> | 2018-09-13 02:10:45 -0600 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2018-09-14 08:16:37 +0000 |
commit | 75a62e76486f63f6dadb5492c205570ace81e9d5 (patch) | |
tree | c3338d2ddd7b2f9f51f35432a24087fc289999fb /src/arch/riscv/include | |
parent | cf9ea55473cde8b9a2b9494eca452df7783376e5 (diff) | |
download | coreboot-75a62e76486f63f6dadb5492c205570ace81e9d5.tar.xz |
complier.h: add __always_inline and use it in code base
Add a __always_inline macro that wraps __attribute__((always_inline))
and replace current users with the macro, excluding files under
src/vendorcode.
Change-Id: Ic57e474c1d2ca7cc0405ac677869f78a28d3e529
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: https://review.coreboot.org/28587
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Julius Werner <jwerner@google.com>
Diffstat (limited to 'src/arch/riscv/include')
-rw-r--r-- | src/arch/riscv/include/arch/hlt.h | 4 | ||||
-rw-r--r-- | src/arch/riscv/include/arch/io.h | 13 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/arch/riscv/include/arch/hlt.h b/src/arch/riscv/include/arch/hlt.h index da0277821b..2ea2e01f50 100644 --- a/src/arch/riscv/include/arch/hlt.h +++ b/src/arch/riscv/include/arch/hlt.h @@ -11,7 +11,9 @@ * GNU General Public License for more details. */ -static inline __attribute__((always_inline)) void hlt(void) +#include <compiler.h> + +static __always_inline void hlt(void) { while (1); } diff --git a/src/arch/riscv/include/arch/io.h b/src/arch/riscv/include/arch/io.h index a19f4b5334..9f672f9505 100644 --- a/src/arch/riscv/include/arch/io.h +++ b/src/arch/riscv/include/arch/io.h @@ -15,33 +15,34 @@ #define _ASM_IO_H #include <stdint.h> +#include <compiler.h> -static inline __attribute__((always_inline)) uint8_t read8(const volatile void *addr) +static __always_inline uint8_t read8(const volatile void *addr) { return *((volatile uint8_t *)(addr)); } -static inline __attribute__((always_inline)) uint16_t read16(const volatile void *addr) +static __always_inline uint16_t read16(const volatile void *addr) { return *((volatile uint16_t *)(addr)); } -static inline __attribute__((always_inline)) uint32_t read32(const volatile void *addr) +static __always_inline uint32_t read32(const volatile void *addr) { return *((volatile uint32_t *)(addr)); } -static inline __attribute__((always_inline)) void write8(volatile void *addr, uint8_t value) +static __always_inline void write8(volatile void *addr, uint8_t value) { *((volatile uint8_t *)(addr)) = value; } -static inline __attribute__((always_inline)) void write16(volatile void *addr, uint16_t value) +static __always_inline void write16(volatile void *addr, uint16_t value) { *((volatile uint16_t *)(addr)) = value; } -static inline __attribute__((always_inline)) void write32(volatile void *addr, uint32_t value) +static __always_inline void write32(volatile void *addr, uint32_t value) { *((volatile uint32_t *)(addr)) = value; } |