[PATCH] score: Remove CPU_PROVIDES_IDLE_THREAD_BODY
Sebastian Huber
sebastian.huber at embedded-brains.de
Thu Oct 4 06:46:57 UTC 2018
Remove the CPU_PROVIDES_IDLE_THREAD_BODY option to avoid unnecessary
conditional compilation.
Close #3539.
---
cpukit/include/rtems/confdefs.h | 12 +-----
cpukit/include/rtems/score/thread.h | 11 ------
cpukit/score/cpu/arm/armv7-thread-idle.c | 6 +--
cpukit/score/cpu/arm/include/rtems/score/cpu.h | 10 +----
cpukit/score/cpu/bfin/cpu.c | 2 -
cpukit/score/cpu/bfin/include/rtems/score/cpu.h | 36 ------------------
.../score/cpu/epiphany/include/rtems/score/cpu.h | 34 -----------------
cpukit/score/cpu/i386/Makefile.am | 1 +
cpukit/score/cpu/i386/include/rtems/score/cpu.h | 23 ------------
cpukit/score/cpu/lm32/include/rtems/score/cpu.h | 36 ------------------
cpukit/score/cpu/m32c/include/rtems/score/cpu.h | 36 ------------------
cpukit/score/cpu/m68k/include/rtems/score/cpu.h | 10 -----
cpukit/score/cpu/mips/include/rtems/score/cpu.h | 33 -----------------
cpukit/score/cpu/moxie/Makefile.am | 1 +
cpukit/score/cpu/moxie/include/rtems/score/cpu.h | 43 +---------------------
cpukit/score/cpu/nios2/Makefile.am | 1 +
cpukit/score/cpu/nios2/include/rtems/score/cpu.h | 4 +-
cpukit/score/cpu/no_cpu/Makefile.am | 1 +
cpukit/score/cpu/no_cpu/cpuidle.c | 28 ++++++++++++++
cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h | 29 ---------------
cpukit/score/cpu/or1k/include/rtems/score/cpu.h | 34 -----------------
cpukit/score/cpu/powerpc/Makefile.am | 1 +
cpukit/score/cpu/powerpc/include/rtems/score/cpu.h | 25 +------------
cpukit/score/cpu/riscv/include/rtems/score/cpu.h | 1 -
cpukit/score/cpu/sh/Makefile.am | 1 +
cpukit/score/cpu/sh/cpu.c | 28 --------------
cpukit/score/cpu/sh/include/rtems/score/cpu.h | 32 ----------------
cpukit/score/cpu/sparc/include/rtems/score/cpu.h | 18 +--------
cpukit/score/cpu/sparc64/Makefile.am | 1 +
cpukit/score/cpu/sparc64/include/rtems/score/cpu.h | 24 ------------
cpukit/score/cpu/v850/Makefile.am | 1 +
cpukit/score/cpu/v850/include/rtems/score/cpu.h | 29 +--------------
cpukit/score/cpu/x86_64/Makefile.am | 1 +
cpukit/score/cpu/x86_64/include/rtems/score/cpu.h | 1 -
testsuites/smptests/smpschededf04/init.c | 6 ---
testsuites/smptests/smpthreadpin01/init.c | 6 ---
36 files changed, 51 insertions(+), 515 deletions(-)
create mode 100644 cpukit/score/cpu/no_cpu/cpuidle.c
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index f59e0f7068..2e183c78d9 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -1108,18 +1108,8 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
#ifndef CONFIGURE_IDLE_TASK_BODY
#if defined(BSP_IDLE_TASK_BODY)
#define CONFIGURE_IDLE_TASK_BODY BSP_IDLE_TASK_BODY
- #elif (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE)
- #define CONFIGURE_IDLE_TASK_BODY _CPU_Thread_Idle_body
#else
- /* only instantiate and compile if used */
- #ifdef CONFIGURE_INIT
- void *_Thread_Idle_body(uintptr_t ignored)
- {
- for( ; ; ) ;
- return 0; /* to avoid warning */
- }
- #endif
- #define CONFIGURE_IDLE_TASK_BODY _Thread_Idle_body
+ #define CONFIGURE_IDLE_TASK_BODY _CPU_Thread_Idle_body
#endif
#endif
/**@}*/ /* end of IDLE thread configuration */
diff --git a/cpukit/include/rtems/score/thread.h b/cpukit/include/rtems/score/thread.h
index 4dd1023045..1e97083dd7 100644
--- a/cpukit/include/rtems/score/thread.h
+++ b/cpukit/include/rtems/score/thread.h
@@ -879,17 +879,6 @@ struct _Thread_Control {
void *extensions[ RTEMS_ZERO_LENGTH_ARRAY ];
};
-#if (CPU_PROVIDES_IDLE_THREAD_BODY == FALSE)
-/**
- * This routine is the body of the system idle thread.
- *
- * NOTE: This routine is actually instantiated by confdefs.h when needed.
- */
-void *_Thread_Idle_body(
- uintptr_t ignored
-);
-#endif
-
typedef void (*rtems_per_thread_routine)( Thread_Control * );
/* Use rtems_task_iterate() instead */
diff --git a/cpukit/score/cpu/arm/armv7-thread-idle.c b/cpukit/score/cpu/arm/armv7-thread-idle.c
index 527fbbcc88..dd78a938ef 100644
--- a/cpukit/score/cpu/arm/armv7-thread-idle.c
+++ b/cpukit/score/cpu/arm/armv7-thread-idle.c
@@ -8,7 +8,7 @@
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
- * Obere Lagerstr. 30
+ * Dornierstr. 4
* 82178 Puchheim
* Germany
* <rtems at embedded-brains.de>
@@ -24,13 +24,13 @@
#include <rtems/score/cpu.h>
-#ifdef ARM_MULTILIB_HAS_WFI
void *_CPU_Thread_Idle_body( uintptr_t ignored )
{
while ( true ) {
+#ifdef ARM_MULTILIB_HAS_WFI
__asm__ volatile ("wfi");
+#endif /* ARM_MULTILIB_HAS_WFI */
}
}
-#endif /* ARM_MULTILIB_HAS_WFI */
diff --git a/cpukit/score/cpu/arm/include/rtems/score/cpu.h b/cpukit/score/cpu/arm/include/rtems/score/cpu.h
index 3343b40297..a44abe167e 100644
--- a/cpukit/score/cpu/arm/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/arm/include/rtems/score/cpu.h
@@ -119,12 +119,6 @@
#define CPU_ENABLE_ROBUST_THREAD_DISPATCH TRUE
-#if defined(ARM_MULTILIB_HAS_WFI)
- #define CPU_PROVIDES_IDLE_THREAD_BODY TRUE
-#else
- #define CPU_PROVIDES_IDLE_THREAD_BODY FALSE
-#endif
-
#define CPU_STACK_GROWS_UP FALSE
#if defined(ARM_MULTILIB_CACHE_LINE_MAX_64)
@@ -597,9 +591,7 @@ static inline CPU_Counter_ticks _CPU_Counter_difference(
return second - first;
}
-#if CPU_PROVIDES_IDLE_THREAD_BODY == TRUE
- void *_CPU_Thread_Idle_body( uintptr_t ignored );
-#endif
+void *_CPU_Thread_Idle_body( uintptr_t ignored );
/** @} */
diff --git a/cpukit/score/cpu/bfin/cpu.c b/cpukit/score/cpu/bfin/cpu.c
index 00d0f21b41..0771b4b3cd 100644
--- a/cpukit/score/cpu/bfin/cpu.c
+++ b/cpukit/score/cpu/bfin/cpu.c
@@ -168,14 +168,12 @@ void _CPU_ISR_install_vector(
_CPU_ISR_install_raw_handler( vector, _ISR_Handler, &ignored );
}
-#if (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE)
void *_CPU_Thread_Idle_body(uintptr_t ignored)
{
while (1) {
__asm__ __volatile__("ssync; idle; ssync");
}
}
-#endif
/*
* Copied from the arm port.
diff --git a/cpukit/score/cpu/bfin/include/rtems/score/cpu.h b/cpukit/score/cpu/bfin/include/rtems/score/cpu.h
index af68905edf..329a1b6762 100644
--- a/cpukit/score/cpu/bfin/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/bfin/include/rtems/score/cpu.h
@@ -172,32 +172,6 @@ extern "C" {
#define CPU_ENABLE_ROBUST_THREAD_DISPATCH FALSE
-/**
- * Does this port provide a CPU dependent IDLE task implementation?
- *
- * If TRUE, then the routine @ref _CPU_Thread_Idle_body
- * must be provided and is the default IDLE thread body instead of
- * @ref _CPU_Thread_Idle_body.
- *
- * If FALSE, then use the generic IDLE thread body if the BSP does
- * not provide one.
- *
- * This is intended to allow for supporting processors which have
- * a low power or idle mode. When the IDLE thread is executed, then
- * the CPU can be powered down.
- *
- * The order of precedence for selecting the IDLE thread body is:
- *
- * -# BSP provided
- * -# CPU dependent (if provided)
- * -# generic (if no BSP and no CPU dependent)
- *
- * Port Specific Information:
- *
- * XXX document implementation including references if appropriate
- */
-#define CPU_PROVIDES_IDLE_THREAD_BODY TRUE
-
/**
* Does the stack grow up (toward higher addresses) or down
* (toward lower addresses)?
@@ -719,16 +693,6 @@ void _CPU_ISR_install_vector(
proc_ptr *old_handler
);
-/**
- * This routine is the CPU dependent IDLE thread body.
- *
- * @note It need only be provided if @ref CPU_PROVIDES_IDLE_THREAD_BODY
- * is TRUE.
- *
- * Port Specific Information:
- *
- * XXX document implementation including references if appropriate
- */
void *_CPU_Thread_Idle_body( uintptr_t ignored );
/**
diff --git a/cpukit/score/cpu/epiphany/include/rtems/score/cpu.h b/cpukit/score/cpu/epiphany/include/rtems/score/cpu.h
index 46213ff262..d5c046a1fa 100644
--- a/cpukit/score/cpu/epiphany/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/epiphany/include/rtems/score/cpu.h
@@ -146,30 +146,6 @@ extern "C" {
#define CPU_ENABLE_ROBUST_THREAD_DISPATCH FALSE
-/*
- * Does this port provide a CPU dependent IDLE task implementation?
- *
- * If TRUE, then the routine _CPU_Thread_Idle_body
- * must be provided and is the default IDLE thread body instead of
- * _CPU_Thread_Idle_body.
- *
- * If FALSE, then use the generic IDLE thread body if the BSP does
- * not provide one.
- *
- * This is intended to allow for supporting processors which have
- * a low power or idle mode. When the IDLE thread is executed, then
- * the CPU can be powered down.
- *
- * The order of precedence for selecting the IDLE thread body is:
- *
- * 1. BSP provided
- * 2. CPU dependent (if provided)
- * 3. generic (if no BSP and no CPU dependent)
- *
- */
-
-#define CPU_PROVIDES_IDLE_THREAD_BODY TRUE
-
/*
* Does the stack grow up (toward higher addresses) or down
* (toward lower addresses)?
@@ -636,16 +612,6 @@ void _CPU_ISR_install_vector(
proc_ptr *old_handler
);
-/*
- * _CPU_Thread_Idle_body
- *
- * This routine is the CPU dependent IDLE thread body.
- *
- * NOTE: It need only be provided if CPU_PROVIDES_IDLE_THREAD_BODY
- * is TRUE.
- *
- */
-
void *_CPU_Thread_Idle_body( uintptr_t ignored );
/*
diff --git a/cpukit/score/cpu/i386/Makefile.am b/cpukit/score/cpu/i386/Makefile.am
index b03d8593c4..faef1fbf04 100644
--- a/cpukit/score/cpu/i386/Makefile.am
+++ b/cpukit/score/cpu/i386/Makefile.am
@@ -4,6 +4,7 @@ noinst_LIBRARIES = libscorecpu.a
libscorecpu_a_SOURCES = cpu.c cpu_asm.S
libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
+libscorecpu_a_SOURCES += ../no_cpu/cpuidle.c
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
include $(top_srcdir)/automake/local.am
diff --git a/cpukit/score/cpu/i386/include/rtems/score/cpu.h b/cpukit/score/cpu/i386/include/rtems/score/cpu.h
index 2007426843..d38af9475f 100644
--- a/cpukit/score/cpu/i386/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/i386/include/rtems/score/cpu.h
@@ -96,19 +96,6 @@ extern "C" {
#define CPU_STRUCTURE_ALIGNMENT
-/*
- * Does this port provide a CPU dependent IDLE task implementation?
- *
- * If TRUE, then the routine _CPU_Thread_Idle_body
- * must be provided and is the default IDLE thread body instead of
- * _CPU_Thread_Idle_body.
- *
- * If FALSE, then use the generic IDLE thread body if the BSP does
- * not provide one.
- */
-
-#define CPU_PROVIDES_IDLE_THREAD_BODY FALSE
-
#define CPU_MAXIMUM_PROCESSORS 32
#define I386_CONTEXT_CONTROL_EFLAGS_OFFSET 0
@@ -577,18 +564,8 @@ void _CPU_ISR_install_vector(
proc_ptr *old_handler
);
-/*
- * _CPU_Thread_Idle_body
- *
- * Use the halt instruction of low power mode of a particular i386 model.
- */
-
-#if (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE)
-
void *_CPU_Thread_Idle_body( uintptr_t ignored );
-#endif /* CPU_PROVIDES_IDLE_THREAD_BODY */
-
/*
* _CPU_Context_switch
*
diff --git a/cpukit/score/cpu/lm32/include/rtems/score/cpu.h b/cpukit/score/cpu/lm32/include/rtems/score/cpu.h
index 782412f7d5..80374a6a83 100644
--- a/cpukit/score/cpu/lm32/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/lm32/include/rtems/score/cpu.h
@@ -166,32 +166,6 @@ extern "C" {
#define CPU_ENABLE_ROBUST_THREAD_DISPATCH FALSE
-/**
- * Does this port provide a CPU dependent IDLE task implementation?
- *
- * If TRUE, then the routine @ref _CPU_Thread_Idle_body
- * must be provided and is the default IDLE thread body instead of
- * @ref _CPU_Thread_Idle_body.
- *
- * If FALSE, then use the generic IDLE thread body if the BSP does
- * not provide one.
- *
- * This is intended to allow for supporting processors which have
- * a low power or idle mode. When the IDLE thread is executed, then
- * the CPU can be powered down.
- *
- * The order of precedence for selecting the IDLE thread body is:
- *
- * -# BSP provided
- * -# CPU dependent (if provided)
- * -# generic (if no BSP and no CPU dependent)
- *
- * Port Specific Information:
- *
- * XXX document implementation including references if appropriate
- */
-#define CPU_PROVIDES_IDLE_THREAD_BODY TRUE
-
/**
* Does the stack grow up (toward higher addresses) or down
* (toward lower addresses)?
@@ -753,16 +727,6 @@ void _CPU_ISR_install_vector(
/** @} */
-/**
- * This routine is the CPU dependent IDLE thread body.
- *
- * NOTE: It need only be provided if @ref CPU_PROVIDES_IDLE_THREAD_BODY
- * is TRUE.
- *
- * Port Specific Information:
- *
- * XXX document implementation including references if appropriate
- */
void *_CPU_Thread_Idle_body( uintptr_t ignored );
/**
diff --git a/cpukit/score/cpu/m32c/include/rtems/score/cpu.h b/cpukit/score/cpu/m32c/include/rtems/score/cpu.h
index 7eb3ab326e..3dc6b2a136 100644
--- a/cpukit/score/cpu/m32c/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/m32c/include/rtems/score/cpu.h
@@ -188,32 +188,6 @@ extern "C" {
#define CPU_ENABLE_ROBUST_THREAD_DISPATCH FALSE
-/**
- * Does this port provide a CPU dependent IDLE task implementation?
- *
- * If TRUE, then the routine @ref _CPU_Thread_Idle_body
- * must be provided and is the default IDLE thread body instead of
- * @ref _CPU_Thread_Idle_body.
- *
- * If FALSE, then use the generic IDLE thread body if the BSP does
- * not provide one.
- *
- * This is intended to allow for supporting processors which have
- * a low power or idle mode. When the IDLE thread is executed, then
- * the CPU can be powered down.
- *
- * The order of precedence for selecting the IDLE thread body is:
- *
- * -# BSP provided
- * -# CPU dependent (if provided)
- * -# generic (if no BSP and no CPU dependent)
- *
- * Port Specific Information:
- *
- * XXX document implementation including references if appropriate
- */
-#define CPU_PROVIDES_IDLE_THREAD_BODY TRUE
-
/**
* Does the stack grow up (toward higher addresses) or down
* (toward lower addresses)?
@@ -738,16 +712,6 @@ void _CPU_ISR_install_vector(
proc_ptr *old_handler
);
-/**
- * This routine is the CPU dependent IDLE thread body.
- *
- * NOTE: It need only be provided if @ref CPU_PROVIDES_IDLE_THREAD_BODY
- * is TRUE.
- *
- * Port Specific Information:
- *
- * XXX document implementation including references if appropriate
- */
void *_CPU_Thread_Idle_body( uintptr_t ignored );
/**
diff --git a/cpukit/score/cpu/m68k/include/rtems/score/cpu.h b/cpukit/score/cpu/m68k/include/rtems/score/cpu.h
index b7ab352cad..cd3f55fe0a 100644
--- a/cpukit/score/cpu/m68k/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/m68k/include/rtems/score/cpu.h
@@ -82,7 +82,6 @@ extern "C" {
#define CPU_USE_DEFERRED_FP_SWITCH TRUE
#define CPU_ENABLE_ROBUST_THREAD_DISPATCH FALSE
-#define CPU_PROVIDES_IDLE_THREAD_BODY TRUE
#define CPU_STACK_GROWS_UP FALSE
/* FIXME: Is this the right value? */
@@ -401,15 +400,6 @@ void _CPU_Context_Initialize(
/* end of Context handler macros */
-/*
- * _CPU_Thread_Idle_body
- *
- * This routine is the CPU dependent IDLE thread body.
- *
- * NOTE: It need only be provided if CPU_PROVIDES_IDLE_THREAD_BODY
- * is TRUE.
- */
-
void *_CPU_Thread_Idle_body( uintptr_t ignored );
/*
diff --git a/cpukit/score/cpu/mips/include/rtems/score/cpu.h b/cpukit/score/cpu/mips/include/rtems/score/cpu.h
index 42eae73b0a..fbb519ed1d 100644
--- a/cpukit/score/cpu/mips/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/mips/include/rtems/score/cpu.h
@@ -174,30 +174,6 @@ extern "C" {
#define CPU_ENABLE_ROBUST_THREAD_DISPATCH FALSE
-/*
- * Does this port provide a CPU dependent IDLE task implementation?
- *
- * If TRUE, then the routine _CPU_Internal_threads_Idle_thread_body
- * must be provided and is the default IDLE thread body instead of
- * _Internal_threads_Idle_thread_body.
- *
- * If FALSE, then use the generic IDLE thread body if the BSP does
- * not provide one.
- *
- * This is intended to allow for supporting processors which have
- * a low power or idle mode. When the IDLE thread is executed, then
- * the CPU can be powered down.
- *
- * The order of precedence for selecting the IDLE thread body is:
- *
- * 1. BSP provided
- * 2. CPU dependent (if provided)
- * 3. generic (if no BSP and no CPU dependent)
- */
-
-/* we can use the low power wait instruction for the IDLE thread */
-#define CPU_PROVIDES_IDLE_THREAD_BODY TRUE
-
/*
* Does the stack grow up (toward higher addresses) or down
* (toward lower addresses)?
@@ -802,15 +778,6 @@ void _CPU_ISR_install_vector(
proc_ptr *old_handler
);
-/*
- * _CPU_Internal_threads_Idle_thread_body
- *
- * This routine is the CPU dependent IDLE thread body.
- *
- * NOTE: It need only be provided if CPU_PROVIDES_IDLE_THREAD_BODY
- * is TRUE.
- */
-
void *_CPU_Thread_Idle_body( uintptr_t ignored );
/*
diff --git a/cpukit/score/cpu/moxie/Makefile.am b/cpukit/score/cpu/moxie/Makefile.am
index d5e8952693..93cf64b82e 100644
--- a/cpukit/score/cpu/moxie/Makefile.am
+++ b/cpukit/score/cpu/moxie/Makefile.am
@@ -8,6 +8,7 @@ noinst_LIBRARIES = libscorecpu.a
libscorecpu_a_SOURCES = cpu.c moxie-exception-frame-print.c cpu_asm.S
libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
+libscorecpu_a_SOURCES += ../no_cpu/cpuidle.c
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
include $(top_srcdir)/automake/local.am
diff --git a/cpukit/score/cpu/moxie/include/rtems/score/cpu.h b/cpukit/score/cpu/moxie/include/rtems/score/cpu.h
index 79c5a61c0c..fbf689438e 100644
--- a/cpukit/score/cpu/moxie/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/moxie/include/rtems/score/cpu.h
@@ -135,35 +135,6 @@ extern "C" {
#define CPU_ENABLE_ROBUST_THREAD_DISPATCH FALSE
-/*
- * Does this port provide a CPU dependent IDLE task implementation?
- *
- * If TRUE, then the routine _CPU_Internal_threads_Idle_thread_body
- * must be provided and is the default IDLE thread body instead of
- * _Internal_threads_Idle_thread_body.
- *
- * If FALSE, then use the generic IDLE thread body if the BSP does
- * not provide one.
- *
- * This is intended to allow for supporting processors which have
- * a low power or idle mode. When the IDLE thread is executed, then
- * the CPU can be powered down.
- *
- * The order of precedence for selecting the IDLE thread body is:
- *
- * 1. BSP provided
- * 2. CPU dependent (if provided)
- * 3. generic (if no BSP and no CPU dependent)
- *
- * MOXIE Specific Information:
- *
- * XXX
- * The port initially called a BSP dependent routine called
- * IDLE_Monitor. The idle task body can be overridden by
- * the BSP in newer versions of RTEMS.
- */
-#define CPU_PROVIDES_IDLE_THREAD_BODY FALSE
-
/*
* Does the stack grow up (toward higher addresses) or down
* (toward lower addresses)?
@@ -598,19 +569,7 @@ void _CPU_ISR_install_vector(
proc_ptr *old_handler
);
-/*
- * _CPU_Internal_threads_Idle_thread_body
- *
- * This routine is the CPU dependent IDLE thread body.
- *
- * NOTE: It need only be provided if CPU_PROVIDES_IDLE_THREAD_BODY
- * is TRUE.
- *
- * MOXIE Specific Information:
- *
- * XXX
- */
-void *_CPU_Thread_Idle_body( uint32_t );
+void *_CPU_Thread_Idle_body( uintptr_t );
/*
* _CPU_Context_switch
diff --git a/cpukit/score/cpu/nios2/Makefile.am b/cpukit/score/cpu/nios2/Makefile.am
index a0ecab3345..4619db0b28 100644
--- a/cpukit/score/cpu/nios2/Makefile.am
+++ b/cpukit/score/cpu/nios2/Makefile.am
@@ -7,6 +7,7 @@ noinst_LIBRARIES = libscorecpu.a
libscorecpu_a_SOURCES =
libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
+libscorecpu_a_SOURCES += ../no_cpu/cpuidle.c
libscorecpu_a_SOURCES += nios2-context-initialize.c
libscorecpu_a_SOURCES += nios2-context-switch.S
libscorecpu_a_SOURCES += nios2-context-validate.S
diff --git a/cpukit/score/cpu/nios2/include/rtems/score/cpu.h b/cpukit/score/cpu/nios2/include/rtems/score/cpu.h
index fa052842c8..c86b13bb73 100644
--- a/cpukit/score/cpu/nios2/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/nios2/include/rtems/score/cpu.h
@@ -51,8 +51,6 @@ extern "C" {
#define CPU_ENABLE_ROBUST_THREAD_DISPATCH FALSE
-#define CPU_PROVIDES_IDLE_THREAD_BODY FALSE
-
#define CPU_STACK_GROWS_UP FALSE
/* FIXME: Is this the right value? */
@@ -316,6 +314,8 @@ void _CPU_ISR_install_vector(
proc_ptr *old_handler
);
+void *_CPU_Thread_Idle_body( uintptr_t ignored );
+
void _CPU_Context_switch( Context_Control *run, Context_Control *heir );
void _CPU_Context_restore(
diff --git a/cpukit/score/cpu/no_cpu/Makefile.am b/cpukit/score/cpu/no_cpu/Makefile.am
index 0d89f5af2b..b5f59e56f8 100644
--- a/cpukit/score/cpu/no_cpu/Makefile.am
+++ b/cpukit/score/cpu/no_cpu/Makefile.am
@@ -4,6 +4,7 @@ noinst_LIBRARIES = libscorecpu.a
libscorecpu_a_SOURCES = cpu.c cpu_asm.c
libscorecpu_a_SOURCES += cpucounterfrequency.c
libscorecpu_a_SOURCES += cpucounterread.c
+libscorecpu_a_SOURCES += cpuidle.c
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
include $(top_srcdir)/automake/local.am
diff --git a/cpukit/score/cpu/no_cpu/cpuidle.c b/cpukit/score/cpu/no_cpu/cpuidle.c
new file mode 100644
index 0000000000..de66b39faa
--- /dev/null
+++ b/cpukit/score/cpu/no_cpu/cpuidle.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2013-2014 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems at embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/score/cpu.h>
+
+void *_CPU_Thread_Idle_body( uintptr_t ignored )
+{
+ while ( true ) {
+ /* Do nothing */
+ }
+
+ return NULL;
+}
diff --git a/cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h b/cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h
index 427e381582..8e66182bba 100644
--- a/cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/no_cpu/include/rtems/score/cpu.h
@@ -197,32 +197,6 @@ extern "C" {
*/
#define CPU_ENABLE_ROBUST_THREAD_DISPATCH FALSE
-/**
- * Does this port provide a CPU dependent IDLE task implementation?
- *
- * If TRUE, then the routine @ref _CPU_Thread_Idle_body
- * must be provided and is the default IDLE thread body instead of
- * @ref _CPU_Thread_Idle_body.
- *
- * If FALSE, then use the generic IDLE thread body if the BSP does
- * not provide one.
- *
- * This is intended to allow for supporting processors which have
- * a low power or idle mode. When the IDLE thread is executed, then
- * the CPU can be powered down.
- *
- * The order of precedence for selecting the IDLE thread body is:
- *
- * -# BSP provided
- * -# CPU dependent (if provided)
- * -# generic (if no BSP and no CPU dependent)
- *
- * Port Specific Information:
- *
- * XXX document implementation including references if appropriate
- */
-#define CPU_PROVIDES_IDLE_THREAD_BODY TRUE
-
/**
* Does the stack grow up (toward higher addresses) or down
* (toward lower addresses)?
@@ -1044,9 +1018,6 @@ void _CPU_ISR_install_vector(
/**
* This routine is the CPU dependent IDLE thread body.
*
- * NOTE: It need only be provided if @ref CPU_PROVIDES_IDLE_THREAD_BODY
- * is TRUE.
- *
* Port Specific Information:
*
* XXX document implementation including references if appropriate
diff --git a/cpukit/score/cpu/or1k/include/rtems/score/cpu.h b/cpukit/score/cpu/or1k/include/rtems/score/cpu.h
index 1989417a3f..8d66ccf522 100644
--- a/cpukit/score/cpu/or1k/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/or1k/include/rtems/score/cpu.h
@@ -138,30 +138,6 @@ extern "C" {
#define CPU_ENABLE_ROBUST_THREAD_DISPATCH FALSE
-/*
- * Does this port provide a CPU dependent IDLE task implementation?
- *
- * If TRUE, then the routine _CPU_Thread_Idle_body
- * must be provided and is the default IDLE thread body instead of
- * _CPU_Thread_Idle_body.
- *
- * If FALSE, then use the generic IDLE thread body if the BSP does
- * not provide one.
- *
- * This is intended to allow for supporting processors which have
- * a low power or idle mode. When the IDLE thread is executed, then
- * the CPU can be powered down.
- *
- * The order of precedence for selecting the IDLE thread body is:
- *
- * 1. BSP provided
- * 2. CPU dependent (if provided)
- * 3. generic (if no BSP and no CPU dependent)
- *
- */
-
-#define CPU_PROVIDES_IDLE_THREAD_BODY TRUE
-
/*
* Does the stack grow up (toward higher addresses) or down
* (toward lower addresses)?
@@ -644,16 +620,6 @@ void _CPU_ISR_install_vector(
proc_ptr *old_handler
);
-/*
- * _CPU_Thread_Idle_body
- *
- * This routine is the CPU dependent IDLE thread body.
- *
- * NOTE: It need only be provided if CPU_PROVIDES_IDLE_THREAD_BODY
- * is TRUE.
- *
- */
-
void *_CPU_Thread_Idle_body( uintptr_t ignored );
/*
diff --git a/cpukit/score/cpu/powerpc/Makefile.am b/cpukit/score/cpu/powerpc/Makefile.am
index 05ab2f480d..15736ab809 100644
--- a/cpukit/score/cpu/powerpc/Makefile.am
+++ b/cpukit/score/cpu/powerpc/Makefile.am
@@ -2,6 +2,7 @@ include $(top_srcdir)/automake/compile.am
noinst_LIBRARIES = libscorecpu.a
libscorecpu_a_SOURCES = cpu.c
+libscorecpu_a_SOURCES += ../no_cpu/cpuidle.c
libscorecpu_a_SOURCES += ppc-context-volatile-clobber.S
libscorecpu_a_SOURCES += ppc-context-validate.S
libscorecpu_a_SOURCES += ppc-isr-disable-mask.S
diff --git a/cpukit/score/cpu/powerpc/include/rtems/score/cpu.h b/cpukit/score/cpu/powerpc/include/rtems/score/cpu.h
index beacc2829e..85864ff71b 100644
--- a/cpukit/score/cpu/powerpc/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/powerpc/include/rtems/score/cpu.h
@@ -52,29 +52,6 @@ extern "C" {
/* conditional compilation parameters */
-/*
- * Does this port provide a CPU dependent IDLE task implementation?
- *
- * If TRUE, then the routine _CPU_Thread_Idle_body
- * must be provided and is the default IDLE thread body instead of
- * _CPU_Thread_Idle_body.
- *
- * If FALSE, then use the generic IDLE thread body if the BSP does
- * not provide one.
- *
- * This is intended to allow for supporting processors which have
- * a low power or idle mode. When the IDLE thread is executed, then
- * the CPU can be powered down.
- *
- * The order of precedence for selecting the IDLE thread body is:
- *
- * 1. BSP provided
- * 2. CPU dependent (if provided)
- * 3. generic (if no BSP and no CPU dependent)
- */
-
-#define CPU_PROVIDES_IDLE_THREAD_BODY FALSE
-
/*
* Does the stack grow up (toward higher addresses) or down
* (toward lower addresses)?
@@ -940,6 +917,8 @@ void _CPU_ISR_install_vector(
proc_ptr *old_handler
);
+void *_CPU_Thread_Idle_body( uintptr_t ignored );
+
/*
* _CPU_Context_switch
*
diff --git a/cpukit/score/cpu/riscv/include/rtems/score/cpu.h b/cpukit/score/cpu/riscv/include/rtems/score/cpu.h
index e836ac0919..4a81d0cd87 100644
--- a/cpukit/score/cpu/riscv/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/riscv/include/rtems/score/cpu.h
@@ -52,7 +52,6 @@ extern "C" {
#define CPU_ALL_TASKS_ARE_FP FALSE
#define CPU_IDLE_TASK_IS_FP FALSE
#define CPU_USE_DEFERRED_FP_SWITCH FALSE
-#define CPU_PROVIDES_IDLE_THREAD_BODY TRUE
#define CPU_STACK_GROWS_UP FALSE
#define CPU_STRUCTURE_ALIGNMENT __attribute__ ((aligned (64)))
diff --git a/cpukit/score/cpu/sh/Makefile.am b/cpukit/score/cpu/sh/Makefile.am
index 37188443ff..b4a125fd81 100644
--- a/cpukit/score/cpu/sh/Makefile.am
+++ b/cpukit/score/cpu/sh/Makefile.am
@@ -4,6 +4,7 @@ noinst_LIBRARIES = libscorecpu.a
libscorecpu_a_SOURCES = cpu.c context.c
libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
+libscorecpu_a_SOURCES += ../no_cpu/cpuidle.c
libscorecpu_a_SOURCES += sh-exception-frame-print.c
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
diff --git a/cpukit/score/cpu/sh/cpu.c b/cpukit/score/cpu/sh/cpu.c
index 8988da98ce..b1e8766ff0 100644
--- a/cpukit/score/cpu/sh/cpu.c
+++ b/cpukit/score/cpu/sh/cpu.c
@@ -175,34 +175,6 @@ void _CPU_ISR_install_vector(
_ISR_Vector_table[ vector ] = new_handler;
}
-/*
- * _CPU_Thread_Idle_body
- *
- * NOTES:
- *
- * 1. This is the same as the regular CPU independent algorithm.
- *
- * 2. If you implement this using a "halt", "idle", or "shutdown"
- * instruction, then don't forget to put it in an infinite loop.
- *
- * 3. Be warned. Some processors with onboard DMA have been known
- * to stop the DMA if the CPU were put in IDLE mode. This might
- * also be a problem with other on-chip peripherals. So use this
- * hook with caution.
- */
-
-#if (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE)
-void *_CPU_Thread_Idle_body( uintptr_t ignored )
-{
-
- for( ; ; )
- {
- __asm__ volatile("nop");
- }
- /* insert your "halt" instruction here */ ;
-}
-#endif
-
void _CPU_Context_Initialize(
Context_Control *_the_context,
void *_stack_base,
diff --git a/cpukit/score/cpu/sh/include/rtems/score/cpu.h b/cpukit/score/cpu/sh/include/rtems/score/cpu.h
index a61355d858..61d8e56448 100644
--- a/cpukit/score/cpu/sh/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/sh/include/rtems/score/cpu.h
@@ -147,29 +147,6 @@ extern "C" {
#define CPU_ENABLE_ROBUST_THREAD_DISPATCH FALSE
-/*
- * Does this port provide a CPU dependent IDLE task implementation?
- *
- * If TRUE, then the routine _CPU_Thread_Idle_body
- * must be provided and is the default IDLE thread body instead of
- * _CPU_Thread_Idle_body.
- *
- * If FALSE, then use the generic IDLE thread body if the BSP does
- * not provide one.
- *
- * This is intended to allow for supporting processors which have
- * a low power or idle mode. When the IDLE thread is executed, then
- * the CPU can be powered down.
- *
- * The order of precedence for selecting the IDLE thread body is:
- *
- * 1. BSP provided
- * 2. CPU dependent (if provided)
- * 3. generic (if no BSP and no CPU dependent)
- */
-
-#define CPU_PROVIDES_IDLE_THREAD_BODY TRUE
-
/*
* Does the stack grow up (toward higher addresses) or down
* (toward lower addresses)?
@@ -594,15 +571,6 @@ void _CPU_ISR_install_vector(
proc_ptr *old_handler
);
-/*
- * _CPU_Thread_Idle_body
- *
- * This routine is the CPU dependent IDLE thread body.
- *
- * NOTE: It need only be provided if CPU_PROVIDES_IDLE_THREAD_BODY
- * is TRUE.
- */
-
void *_CPU_Thread_Idle_body( uintptr_t ignored );
/*
diff --git a/cpukit/score/cpu/sparc/include/rtems/score/cpu.h b/cpukit/score/cpu/sparc/include/rtems/score/cpu.h
index a53791ce3f..8c6212725d 100644
--- a/cpukit/score/cpu/sparc/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/sparc/include/rtems/score/cpu.h
@@ -135,22 +135,6 @@ extern "C" {
#define CPU_ENABLE_ROBUST_THREAD_DISPATCH FALSE
-/**
- * Does this port provide a CPU dependent IDLE task implementation?
- *
- * - If TRUE, then the routine _CPU_Thread_Idle_body
- * must be provided and is the default IDLE thread body instead of
- * _CPU_Thread_Idle_body.
- *
- * - If FALSE, then use the generic IDLE thread body if the BSP does
- * not provide one.
- *
- * The SPARC architecture does not have a low power or halt instruction.
- * It is left to the BSP and/or CPU specific code to provide an IDLE
- * thread body which is aware of low power modes.
- */
-#define CPU_PROVIDES_IDLE_THREAD_BODY FALSE
-
/**
* Does the stack grow up (toward higher addresses) or down
* (toward lower addresses)?
@@ -988,6 +972,8 @@ void _CPU_ISR_install_vector(
proc_ptr *old_handler
);
+void *_CPU_Thread_Idle_body( uintptr_t ignored );
+
/**
* @brief SPARC specific context switch.
*
diff --git a/cpukit/score/cpu/sparc64/Makefile.am b/cpukit/score/cpu/sparc64/Makefile.am
index 711036e41a..0d3d649c77 100644
--- a/cpukit/score/cpu/sparc64/Makefile.am
+++ b/cpukit/score/cpu/sparc64/Makefile.am
@@ -7,6 +7,7 @@ libscorecpu_a_SOURCES += cpu.c
libscorecpu_a_SOURCES += interrupt.S
libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
+libscorecpu_a_SOURCES += ../no_cpu/cpuidle.c
libscorecpu_a_SOURCES += sparc64-exception-frame-print.c
libscorecpu_a_SOURCES += sparc64-syscall.S
diff --git a/cpukit/score/cpu/sparc64/include/rtems/score/cpu.h b/cpukit/score/cpu/sparc64/include/rtems/score/cpu.h
index 9175a2c888..0249023f94 100644
--- a/cpukit/score/cpu/sparc64/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/sparc64/include/rtems/score/cpu.h
@@ -106,19 +106,6 @@ extern "C" {
#define CPU_ENABLE_ROBUST_THREAD_DISPATCH FALSE
-/*
- * Does this port provide a CPU dependent IDLE task implementation?
- *
- * If TRUE, then the routine _CPU_Thread_Idle_body
- * must be provided and is the default IDLE thread body instead of
- * _CPU_Thread_Idle_body.
- *
- * If FALSE, then use the generic IDLE thread body if the BSP does
- * not provide one.
- */
-
-#define CPU_PROVIDES_IDLE_THREAD_BODY FALSE
-
/*
* Does the stack grow up (toward higher addresses) or down
* (toward lower addresses)?
@@ -877,19 +864,8 @@ void _CPU_ISR_install_vector(
proc_ptr *old_handler
);
-#if (CPU_PROVIDES_IDLE_THREAD_BODY == TRUE)
-
-/*
- * _CPU_Thread_Idle_body
- *
- * Some SPARC implementations have low power, sleep, or idle modes. This
- * tries to take advantage of those models.
- */
-
void *_CPU_Thread_Idle_body( uintptr_t ignored );
-#endif /* CPU_PROVIDES_IDLE_THREAD_BODY */
-
/*
* _CPU_Context_switch
*
diff --git a/cpukit/score/cpu/v850/Makefile.am b/cpukit/score/cpu/v850/Makefile.am
index 8db039c9f5..3e3e8ae94f 100644
--- a/cpukit/score/cpu/v850/Makefile.am
+++ b/cpukit/score/cpu/v850/Makefile.am
@@ -5,6 +5,7 @@ libscorecpu_a_SOURCES = cpu.c
libscorecpu_a_SOURCES += cpu_asm.S
libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
+libscorecpu_a_SOURCES += ../no_cpu/cpuidle.c
libscorecpu_a_SOURCES += v850-exception-frame-print.c
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
diff --git a/cpukit/score/cpu/v850/include/rtems/score/cpu.h b/cpukit/score/cpu/v850/include/rtems/score/cpu.h
index 46e7bca754..7011366ffb 100644
--- a/cpukit/score/cpu/v850/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/v850/include/rtems/score/cpu.h
@@ -164,33 +164,6 @@ extern "C" {
#define CPU_ENABLE_ROBUST_THREAD_DISPATCH FALSE
-/**
- * Does this port provide a CPU dependent IDLE task implementation?
- *
- * If TRUE, then the routine @ref _CPU_Thread_Idle_body
- * must be provided and is the default IDLE thread body instead of
- * @ref _CPU_Thread_Idle_body.
- *
- * If FALSE, then use the generic IDLE thread body if the BSP does
- * not provide one.
- *
- * This is intended to allow for supporting processors which have
- * a low power or idle mode. When the IDLE thread is executed, then
- * the CPU can be powered down.
- *
- * The order of precedence for selecting the IDLE thread body is:
- *
- * -# BSP provided
- * -# CPU dependent (if provided)
- * -# generic (if no BSP and no CPU dependent)
- *
- * Port Specific Information:
- *
- * There does not appear to be a reason for the v850 port itself to provide
- * a special idle task.
- */
-#define CPU_PROVIDES_IDLE_THREAD_BODY FALSE
-
/**
* Does the stack grow up (toward higher addresses) or down
* (toward lower addresses)?
@@ -665,6 +638,8 @@ void _CPU_Context_Initialize(
*/
void _CPU_Initialize(void);
+void *_CPU_Thread_Idle_body( uintptr_t ignored );
+
/**
* @addtogroup CPUContext
*/
diff --git a/cpukit/score/cpu/x86_64/Makefile.am b/cpukit/score/cpu/x86_64/Makefile.am
index db4bd15cd5..556246d9f7 100644
--- a/cpukit/score/cpu/x86_64/Makefile.am
+++ b/cpukit/score/cpu/x86_64/Makefile.am
@@ -4,6 +4,7 @@ noinst_LIBRARIES = libscorecpu.a
libscorecpu_a_SOURCES = cpu.c
libscorecpu_a_SOURCES += ../no_cpu/cpucounterfrequency.c
libscorecpu_a_SOURCES += ../no_cpu/cpucounterread.c
+libscorecpu_a_SOURCES += ../no_cpu/cpuidle.c
libscorecpu_a_SOURCES += x86_64-context-initialize.c
libscorecpu_a_SOURCES += x86_64-context-switch.S
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
diff --git a/cpukit/score/cpu/x86_64/include/rtems/score/cpu.h b/cpukit/score/cpu/x86_64/include/rtems/score/cpu.h
index 8f4a3c8d2e..7f3aed3bb1 100644
--- a/cpukit/score/cpu/x86_64/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/x86_64/include/rtems/score/cpu.h
@@ -52,7 +52,6 @@ extern "C" {
#define CPU_IDLE_TASK_IS_FP FALSE
#define CPU_USE_DEFERRED_FP_SWITCH TRUE
#define CPU_ENABLE_ROBUST_THREAD_DISPATCH FALSE
-#define CPU_PROVIDES_IDLE_THREAD_BODY FALSE
#define CPU_STACK_GROWS_UP FALSE
#define CPU_STRUCTURE_ALIGNMENT RTEMS_ALIGNED(64)
diff --git a/testsuites/smptests/smpschededf04/init.c b/testsuites/smptests/smpschededf04/init.c
index 5387d023a2..3111374a94 100644
--- a/testsuites/smptests/smpschededf04/init.c
+++ b/testsuites/smptests/smpschededf04/init.c
@@ -41,13 +41,7 @@ static void do_nothing_task(rtems_task_argument arg)
{
(void) arg;
-#if CPU_PROVIDES_IDLE_THREAD_BODY == TRUE
_CPU_Thread_Idle_body(0);
-#else
- while (true) {
- /* Do nothing */
- }
-#endif
}
static void test(void)
diff --git a/testsuites/smptests/smpthreadpin01/init.c b/testsuites/smptests/smpthreadpin01/init.c
index c28b3b3d1e..66a8e33054 100644
--- a/testsuites/smptests/smpthreadpin01/init.c
+++ b/testsuites/smptests/smpthreadpin01/init.c
@@ -245,13 +245,7 @@ static void busy_task(rtems_task_argument arg)
{
(void) arg;
-#if CPU_PROVIDES_IDLE_THREAD_BODY == TRUE
_CPU_Thread_Idle_body(0);
-#else
- while (true) {
- /* Do nothing */
- }
-#endif
}
static const char *blocked_or_ready(bool blocked)
--
2.16.4
More information about the devel
mailing list