[rtems commit] score: Add per-CPU state function

Sebastian Huber sebh at rtems.org
Mon Mar 31 08:09:15 UTC 2014


Module:    rtems
Branch:    master
Commit:    79e2d9b65efa5bd70ff12373b2454027a35b9788
Changeset: http://git.rtems.org/rtems/commit/?id=79e2d9b65efa5bd70ff12373b2454027a35b9788

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Mar  6 11:11:59 2014 +0100

score: Add per-CPU state function

Add _Per_CPU_State_wait_for_ready_to_start_multitasking().  Add new
fatal SMP error SMP_FATAL_SHUTDOWN_EARLY.

---

 cpukit/score/include/rtems/score/percpu.h  |   39 ++++++++++++++++++++++++++++
 cpukit/score/include/rtems/score/smpimpl.h |    3 +-
 2 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/cpukit/score/include/rtems/score/percpu.h b/cpukit/score/include/rtems/score/percpu.h
index 607de54..75ff3e2 100644
--- a/cpukit/score/include/rtems/score/percpu.h
+++ b/cpukit/score/include/rtems/score/percpu.h
@@ -472,6 +472,45 @@ void _Per_CPU_State_change(
   Per_CPU_State new_state
 );
 
+/**
+ * @brief Waits for all other processors to enter the ready to start
+ * multitasking state with a timeout in microseconds.
+ *
+ * In case one processor enters the shutdown state, this function does not
+ * return and terminates the system with the SMP_FATAL_SHUTDOWN_EARLY fatal SMP
+ * error.
+ *
+ * This function should be called only in _CPU_SMP_Initialize() if required by
+ * the CPU port or BSP.
+ *
+ * @code
+ * uint32_t _CPU_SMP_Initialize(uint32_t configured_cpu_count)
+ * {
+ *   uint32_t cnt = MIN(get_hardware_cpu_count(), configured_cpu_count);
+ *   uint32_t timeout = 123456;
+ *
+ *   do_some_stuff();
+ *
+ *   return _Per_CPU_State_wait_for_ready_to_start_multitasking(cnt, timeout);
+ * }
+ * @endcode
+ *
+ * In case the timeout expires the count of processors is reduced to reflect
+ * the set of processors which is actually available at this point in time.
+ *
+ * @param[in] processor_count The processor count is the minimum value of the
+ * configured count of processors and the processor count offered by the actual
+ * hardware.
+ * @param[in] timeout_in_us The timeout in microseconds.
+ *
+ * @return The count of processors available for the application in the system.
+ * This value is less than or equal to the processor count.
+ */
+uint32_t _Per_CPU_State_wait_for_ready_to_start_multitasking(
+  uint32_t processor_count,
+  uint32_t timeout_in_us
+);
+
 #endif /* defined( RTEMS_SMP ) */
 
 /*
diff --git a/cpukit/score/include/rtems/score/smpimpl.h b/cpukit/score/include/rtems/score/smpimpl.h
index 0c5882b..c32d4a2 100644
--- a/cpukit/score/include/rtems/score/smpimpl.h
+++ b/cpukit/score/include/rtems/score/smpimpl.h
@@ -47,7 +47,8 @@ extern "C" {
  * @brief SMP fatal codes.
  */
 typedef enum {
-  SMP_FATAL_SHUTDOWN
+  SMP_FATAL_SHUTDOWN,
+  SMP_FATAL_SHUTDOWN_EARLY
 } SMP_Fatal_code;
 
 /**




More information about the vc mailing list