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/include/cpu/x86/cache.h | |
parent | cf9ea55473cde8b9a2b9494eca452df7783376e5 (diff) |
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/include/cpu/x86/cache.h')
-rw-r--r-- | src/include/cpu/x86/cache.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/include/cpu/x86/cache.h b/src/include/cpu/x86/cache.h index e0a335971b..81d2ae7223 100644 --- a/src/include/cpu/x86/cache.h +++ b/src/include/cpu/x86/cache.h @@ -16,6 +16,7 @@ #ifndef CPU_X86_CACHE #define CPU_X86_CACHE +#include <compiler.h> #include <cpu/x86/cr.h> #define CR0_CacheDisable (CR0_CD) @@ -55,7 +56,7 @@ static inline void clflush(void *addr) asm volatile ("clflush (%0)"::"r" (addr)); } -/* The following functions require the always_inline due to AMD +/* The following functions require the __always_inline due to AMD * function STOP_CAR_AND_CPU that disables cache as * RAM, the cache as RAM stack can no longer be used. Called * functions must be inlined to avoid stack usage. Also, the @@ -63,9 +64,9 @@ static inline void clflush(void *addr) * allocated them from the stack. With gcc 4.5.0, some functions * declared as inline are not being inlined. This patch forces * these functions to always be inlined by adding the qualifier - * __attribute__((always_inline)) to their declaration. + * __always_inline to their declaration. */ -static inline __attribute__((always_inline)) void enable_cache(void) +static __always_inline void enable_cache(void) { unsigned long cr0; cr0 = read_cr0(); @@ -73,7 +74,7 @@ static inline __attribute__((always_inline)) void enable_cache(void) write_cr0(cr0); } -static inline __attribute__((always_inline)) void disable_cache(void) +static __always_inline void disable_cache(void) { /* Disable and write back the cache */ unsigned long cr0; |