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>
diff --git a/src/include/cpu/x86/lapic.h b/src/include/cpu/x86/lapic.h
index 6121230..5ac3c5e 100644
--- a/src/include/cpu/x86/lapic.h
+++ b/src/include/cpu/x86/lapic.h
@@ -1,24 +1,23 @@
#ifndef CPU_X86_LAPIC_H
#define CPU_X86_LAPIC_H
+#include <compiler.h>
#include <cpu/x86/lapic_def.h>
#include <cpu/x86/msr.h>
#include <halt.h>
#include <smp/node.h>
-static inline __attribute__((always_inline)) unsigned long lapic_read(
- unsigned long reg)
+static __always_inline unsigned long lapic_read(unsigned long reg)
{
return *((volatile unsigned long *)(LAPIC_DEFAULT_BASE+reg));
}
-static inline __attribute__((always_inline)) void lapic_write(unsigned long reg,
- unsigned long v)
+static __always_inline void lapic_write(unsigned long reg, unsigned long v)
{
*((volatile unsigned long *)(LAPIC_DEFAULT_BASE+reg)) = v;
}
-static inline __attribute__((always_inline)) void lapic_wait_icr_idle(void)
+static __always_inline void lapic_wait_icr_idle(void)
{
do { } while (lapic_read(LAPIC_ICR) & LAPIC_ICR_BUSY);
}
@@ -42,7 +41,7 @@
wrmsr(LAPIC_BASE_MSR, msr);
}
-static inline __attribute__((always_inline)) unsigned long lapicid(void)
+static __always_inline unsigned long lapicid(void)
{
return lapic_read(LAPIC_ID) >> 24;
}
@@ -51,7 +50,7 @@
/* If we need to go back to sipi wait, we use the long non-inlined version of
* this function in lapic_cpu_init.c
*/
-static inline __attribute__((always_inline)) void stop_this_cpu(void)
+static __always_inline void stop_this_cpu(void)
{
/* Called by an AP when it is ready to halt and wait for a new task */
halt();