@@ -278,6 +278,7 @@ arch_odp_headers = $(srcdir)/arch/arm/odp/api/cpu_arch.h
noinst_HEADERS += ${srcdir}/arch/arm/odp_atomic.h \
${srcdir}/arch/arm/odp_cpu.h \
${srcdir}/arch/arm/odp_cpu_idling.h \
+ ${srcdir}/arch/default/odp_cpu_idling.h \
${srcdir}/arch/arm/odp_llsc.h
endif
if ARCH_IS_AARCH64
@@ -289,6 +290,7 @@ arch_odp_headers = $(srcdir)/arch/aarch64/odp/api/cpu_arch.h
noinst_HEADERS += ${srcdir}/arch/aarch64/odp_atomic.h \
${srcdir}/arch/aarch64/odp_cpu.h \
${srcdir}/arch/aarch64/odp_cpu_idling.h \
+ ${srcdir}/arch/default/odp_cpu_idling.h \
${srcdir}/arch/aarch64/odp_llsc.h
endif
if ARCH_IS_MIPS64
@@ -297,7 +299,8 @@ __LIB__libodp_linux_la_SOURCES += arch/mips64/odp_cpu_arch.c \
arch/default/odp_global_time.c \
arch/mips64/odp_sysinfo_parse.c
arch_odp_headers = $(srcdir)/arch/mips64/odp/api/cpu_arch.h
-noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h
+noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h \
+ ${srcdir}/arch/default/odp_cpu_idling.h
endif
if ARCH_IS_POWERPC
__LIB__libodp_linux_la_SOURCES += arch/default/odp_cpu_arch.c \
@@ -305,7 +308,8 @@ __LIB__libodp_linux_la_SOURCES += arch/default/odp_cpu_arch.c \
arch/default/odp_global_time.c \
arch/powerpc/odp_sysinfo_parse.c
arch_odp_headers = $(srcdir)/arch/powerpc/odp/api/cpu_arch.h
-noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h
+noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h \
+ ${srcdir}/arch/default/odp_cpu_idling.h
endif
if ARCH_IS_X86
__LIB__libodp_linux_la_SOURCES += arch/x86/cpu_flags.c \
@@ -315,7 +319,8 @@ __LIB__libodp_linux_la_SOURCES += arch/x86/cpu_flags.c \
arch/x86/odp_sysinfo_parse.c
arch_odp_headers = $(srcdir)/arch/x86/odp/api/cpu_arch.h
noinst_HEADERS += $(srcdir)/arch/x86/cpu_flags.h
-noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h
+noinst_HEADERS += ${srcdir}/arch/default/odp_cpu.h \
+ ${srcdir}/arch/default/odp_cpu_idling.h
endif
noinst_HEADERS += $(srcdir)/arch/default/odp/api/cpu_arch.h
@@ -13,39 +13,33 @@
#error This file should not be included directly, please include odp_cpu.h
#endif
+#ifndef CONFIG_WFE
+
+#include "../default/odp_cpu_idling.h"
+
+#else /* CONFIG_WFE */
+
static inline void sevl(void)
{
-#ifdef CONFIG_WFE
__asm__ volatile("sevl" : : : );
-#endif
}
static inline int wfe(void)
{
-#ifdef CONFIG_WFE
__asm__ volatile("wfe" : : : "memory");
-#endif
return 1;
}
static inline void doze(void)
{
-#ifndef CONFIG_WFE
/* When using WFE do not stall the pipeline using other means */
odp_cpu_pause();
-#endif
}
-#ifdef CONFIG_WFE
#define monitor128(addr, mo) lld((addr), (mo))
#define monitor64(addr, mo) ll64((addr), (mo))
#define monitor32(addr, mo) ll32((addr), (mo))
#define monitor8(addr, mo) ll8((addr), (mo))
-#else
-#define monitor128(addr, mo) __atomic_load_n((addr), (mo))
-#define monitor64(addr, mo) __atomic_load_n((addr), (mo))
-#define monitor32(addr, mo) __atomic_load_n((addr), (mo))
-#define monitor8(addr, mo) __atomic_load_n((addr), (mo))
-#endif
+#endif /* CONFIG_WFE */
#endif /* PLATFORM_LINUXGENERIC_ARCH_ARM_CPU_IDLING_H */
@@ -13,39 +13,33 @@
#error This file should not be included directly, please include odp_cpu.h
#endif
+#ifndef CONFIG_WFE
+
+#include "../default/odp_cpu_idling.h"
+
+#else /* CONFIG_WFE */
+
static inline void sevl(void)
{
-#ifdef CONFIG_WFE
__asm__ volatile("sevl" : : : );
-#endif
}
static inline int wfe(void)
{
-#ifdef CONFIG_WFE
__asm__ volatile("wfe" : : : "memory");
-#endif
return 1;
}
static inline void doze(void)
{
-#ifndef CONFIG_WFE
/* When using WFE do not stall the pipeline using other means */
odp_cpu_pause();
-#endif
}
-#ifdef CONFIG_WFE
#define monitor128(addr, mo) lld((addr), (mo))
#define monitor64(addr, mo) ll64((addr), (mo))
#define monitor32(addr, mo) ll32((addr), (mo))
#define monitor8(addr, mo) ll8((addr), (mo))
-#else
-#define monitor128(addr, mo) __atomic_load_n((addr), (mo))
-#define monitor64(addr, mo) __atomic_load_n((addr), (mo))
-#define monitor32(addr, mo) __atomic_load_n((addr), (mo))
-#define monitor8(addr, mo) __atomic_load_n((addr), (mo))
-#endif
+#endif /* CONFIG_WFE */
#endif /* PLATFORM_LINUXGENERIC_ARCH_ARM_CPU_IDLING_H */
@@ -16,28 +16,6 @@
#define atomic_store_release(loc, val, ro) \
__atomic_store_n(loc, val, __ATOMIC_RELEASE)
-/******************************************************************************
- * Idle mgmt
- *****************************************************************************/
-
-static inline void sevl(void)
-{
- /* empty */
-}
-
-static inline int wfe(void)
-{
- return 1;
-}
-
-#define monitor128(addr, mo) __atomic_load_n((addr), (mo))
-#define monitor64(addr, mo) __atomic_load_n((addr), (mo))
-#define monitor32(addr, mo) __atomic_load_n((addr), (mo))
-#define monitor8(addr, mo) __atomic_load_n((addr), (mo))
-
-static inline void doze(void)
-{
- odp_cpu_pause();
-}
+#include "odp_cpu_idling.h"
#endif
new file mode 100644
@@ -0,0 +1,36 @@
+/* Copyright (c) 2017, ARM Limited. All rights reserved.
+ *
+ * Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef ODP_DEFAULT_CPU_IDLING_H_
+#define ODP_DEFAULT_CPU_IDLING_H_
+
+/******************************************************************************
+ * Idle mgmt
+ *****************************************************************************/
+
+static inline void sevl(void)
+{
+ /* empty */
+}
+
+static inline int wfe(void)
+{
+ return 1;
+}
+
+#define monitor128(addr, mo) __atomic_load_n((addr), (mo))
+#define monitor64(addr, mo) __atomic_load_n((addr), (mo))
+#define monitor32(addr, mo) __atomic_load_n((addr), (mo))
+#define monitor8(addr, mo) __atomic_load_n((addr), (mo))
+
+static inline void doze(void)
+{
+ odp_cpu_pause();
+}
+
+#endif