summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/score/include/rtems/score')
-rw-r--r--cpukit/score/include/rtems/score/corebarrierimpl.h103
-rw-r--r--cpukit/score/include/rtems/score/coremsgimpl.h304
-rw-r--r--cpukit/score/include/rtems/score/coremuteximpl.h64
-rw-r--r--cpukit/score/include/rtems/score/coresemimpl.h94
-rw-r--r--cpukit/score/include/rtems/score/thread.h14
-rw-r--r--cpukit/score/include/rtems/score/threadq.h16
-rw-r--r--cpukit/score/include/rtems/score/threadqimpl.h213
7 files changed, 581 insertions, 227 deletions
diff --git a/cpukit/score/include/rtems/score/corebarrierimpl.h b/cpukit/score/include/rtems/score/corebarrierimpl.h
index 7e1c0ab31a..8754cecdac 100644
--- a/cpukit/score/include/rtems/score/corebarrierimpl.h
+++ b/cpukit/score/include/rtems/score/corebarrierimpl.h
@@ -65,15 +65,6 @@ typedef enum {
#define CORE_BARRIER_TQ_OPERATIONS &_Thread_queue_Operations_FIFO
/**
- * The following type defines the callout which the API provides
- * to support global/multiprocessor operations on barriers.
- */
-typedef void ( *CORE_barrier_API_mp_support_callout )(
- Thread_Control *,
- Objects_Id
- );
-
-/**
* @brief Initialize core barrier.
*
* This routine initializes the barrier based on the parameters passed.
@@ -93,6 +84,18 @@ RTEMS_INLINE_ROUTINE void _CORE_barrier_Destroy(
_Thread_queue_Destroy( &the_barrier->Wait_queue );
}
+void _CORE_barrier_Do_wait(
+ CORE_barrier_Control *the_barrier,
+ Thread_Control *executing,
+ bool wait,
+ Watchdog_Interval timeout
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ Thread_queue_MP_callout mp_callout,
+ Objects_Id mp_id
+#endif
+);
+
/**
* @brief Wait for the barrier.
*
@@ -103,22 +106,56 @@ RTEMS_INLINE_ROUTINE void _CORE_barrier_Destroy(
*
* @param[in] the_barrier is the barrier to wait for
* @param[in,out] executing The currently executing thread.
- * @param[in] id is the id of the object being waited upon
* @param[in] wait is true if the calling thread is willing to wait
* @param[in] timeout is the number of ticks the calling thread is willing
* to wait if @a wait is true.
- * @param[in] api_barrier_mp_support is the routine to invoke if the
+ * @param[in] mp_callout is the routine to invoke if the
* thread unblocked is remote
+ * @param[in] mp_id is the id of the object being waited upon
*
* @note Status is returned via the thread control block.
*/
-void _CORE_barrier_Wait(
- CORE_barrier_Control *the_barrier,
- Thread_Control *executing,
- Objects_Id id,
- bool wait,
- Watchdog_Interval timeout,
- CORE_barrier_API_mp_support_callout api_barrier_mp_support
+#if defined(RTEMS_MULTIPROCESSING)
+ #define _CORE_barrier_Wait( \
+ the_barrier, \
+ executing, \
+ wait, \
+ timeout, \
+ mp_callout, \
+ mp_id \
+ ) \
+ _CORE_barrier_Do_wait( \
+ the_barrier, \
+ executing, \
+ wait, \
+ timeout, \
+ mp_callout, \
+ mp_id \
+ )
+#else
+ #define _CORE_barrier_Wait( \
+ the_barrier, \
+ executing, \
+ wait, \
+ timeout, \
+ mp_callout, \
+ mp_id \
+ ) \
+ _CORE_barrier_Do_wait( \
+ the_barrier, \
+ executing, \
+ wait, \
+ timeout \
+ )
+#endif
+
+uint32_t _CORE_barrier_Do_release(
+ CORE_barrier_Control *the_barrier
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ Thread_queue_MP_callout mp_callout,
+ Objects_Id mp_id
+#endif
);
/**
@@ -128,17 +165,33 @@ void _CORE_barrier_Wait(
* for the barrier will be readied.
*
* @param[in] the_barrier is the barrier to surrender
- * @param[in] id is the id of the object for a remote unblock
- * @param[in] api_barrier_mp_support is the routine to invoke if the
+ * @param[in] mp_callout is the routine to invoke if the
* thread unblocked is remote
+ * @param[in] mp_id is the id of the object for a remote unblock
*
* @retval the number of unblocked threads
*/
-uint32_t _CORE_barrier_Release(
- CORE_barrier_Control *the_barrier,
- Objects_Id id,
- CORE_barrier_API_mp_support_callout api_barrier_mp_support
-);
+#if defined(RTEMS_MULTIPROCESSING)
+ #define _CORE_barrier_Release( \
+ the_barrier, \
+ mp_callout, \
+ mp_id \
+ ) \
+ _CORE_barrier_Do_release( \
+ the_barrier, \
+ mp_callout, \
+ mp_id \
+ )
+#else
+ #define _CORE_barrier_Release( \
+ the_barrier, \
+ mp_callout, \
+ mp_id \
+ ) \
+ _CORE_barrier_Do_release( \
+ the_barrier \
+ )
+#endif
/* Must be a macro due to the multiprocessing dependent parameters */
#define _CORE_barrier_Flush( \
diff --git a/cpukit/score/include/rtems/score/coremsgimpl.h b/cpukit/score/include/rtems/score/coremsgimpl.h
index 5b7abb2594..d7d5c468f6 100644
--- a/cpukit/score/include/rtems/score/coremsgimpl.h
+++ b/cpukit/score/include/rtems/score/coremsgimpl.h
@@ -101,17 +101,6 @@ typedef enum {
#define CORE_MESSAGE_QUEUE_STATUS_LAST CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_WAIT
/**
- * @brief Callout provides to support global/multiprocessor operations.
- *
- * The following type defines the callout which the API provides
- * to support global/multiprocessor operations on message_queues.
- */
-typedef void ( *CORE_message_queue_API_mp_support_callout )(
- Thread_Control *,
- Objects_Id
- );
-
-/**
* @brief Initialize a message queue.
*
* This package is the implementation of the CORE Message Queue Handler.
@@ -229,6 +218,18 @@ uint32_t _CORE_message_queue_Flush(
);
#endif
+CORE_message_queue_Status _CORE_message_queue_Do_broadcast(
+ CORE_message_queue_Control *the_message_queue,
+ const void *buffer,
+ size_t size,
+#if defined(RTEMS_MULTIPROCESSING)
+ Thread_queue_MP_callout mp_callout,
+ Objects_Id mp_id,
+#endif
+ uint32_t *count,
+ ISR_lock_Context *lock_context
+);
+
/**
* @brief Broadcast a message to the message queue.
*
@@ -242,24 +243,67 @@ uint32_t _CORE_message_queue_Flush(
* @param[in] the_message_queue points to the message queue
* @param[in] buffer is the starting address of the message to broadcast
* @param[in] size is the size of the message being broadcast
- * @param[in] id is the RTEMS object Id associated with this message queue.
- * It is used when unblocking a remote thread.
- * @param[in] api_message_queue_mp_support is the routine to invoke if
+ * @param[in] mp_callout is the routine to invoke if
* a thread that is unblocked is actually a remote thread.
+ * @param[in] mp_id is the RTEMS object Id associated with this message queue.
+ * It is used when unblocking a remote thread.
* @param[out] count points to the variable that will contain the
* number of tasks that are sent this message
* @param[in] lock_context The lock context of the interrupt disable.
* @retval @a *count will contain the number of messages sent
* @retval indication of the successful completion or reason for failure
*/
-CORE_message_queue_Status _CORE_message_queue_Broadcast(
- CORE_message_queue_Control *the_message_queue,
- const void *buffer,
- size_t size,
- Objects_Id id,
- CORE_message_queue_API_mp_support_callout api_message_queue_mp_support,
- uint32_t *count,
- ISR_lock_Context *lock_context
+#if defined(RTEMS_MULTIPROCESSING)
+ #define _CORE_message_queue_Broadcast( \
+ the_message_queue, \
+ buffer, \
+ size, \
+ mp_callout, \
+ mp_id, \
+ count, \
+ lock_context \
+ ) \
+ _CORE_message_queue_Do_broadcast( \
+ the_message_queue, \
+ buffer, \
+ size, \
+ mp_callout, \
+ mp_id, \
+ count, \
+ lock_context \
+ )
+#else
+ #define _CORE_message_queue_Broadcast( \
+ the_message_queue, \
+ buffer, \
+ size, \
+ mp_callout, \
+ mp_id, \
+ count, \
+ lock_context \
+ ) \
+ _CORE_message_queue_Do_broadcast( \
+ the_message_queue, \
+ buffer, \
+ size, \
+ count, \
+ lock_context \
+ )
+#endif
+
+CORE_message_queue_Status _CORE_message_queue_Do_submit(
+ CORE_message_queue_Control *the_message_queue,
+ Thread_Control *executing,
+ const void *buffer,
+ size_t size,
+#if defined(RTEMS_MULTIPROCESSING)
+ Thread_queue_MP_callout mp_callout,
+ Objects_Id mp_id,
+#endif
+ CORE_message_queue_Submit_types submit_type,
+ bool wait,
+ Watchdog_Interval timeout,
+ ISR_lock_Context *lock_context
);
/**
@@ -275,10 +319,10 @@ CORE_message_queue_Status _CORE_message_queue_Broadcast(
* @param[in] the_message_queue points to the message queue
* @param[in] buffer is the starting address of the message to send
* @param[in] size is the size of the message being send
- * @param[in] id is the RTEMS object Id associated with this message queue.
- * It is used when unblocking a remote thread.
- * @param[in] api_message_queue_mp_support is the routine to invoke if
+ * @param[in] mp_callout is the routine to invoke if
* a thread that is unblocked is actually a remote thread.
+ * @param[in] mp_id is the RTEMS object Id associated with this message queue.
+ * It is used when unblocking a remote thread.
* @param[in] submit_type determines whether the message is prepended,
* appended, or enqueued in priority order.
* @param[in] wait indicates whether the calling thread is willing to block
@@ -288,18 +332,55 @@ CORE_message_queue_Status _CORE_message_queue_Broadcast(
* @param[in] lock_context The lock context of the interrupt disable.
* @retval indication of the successful completion or reason for failure
*/
-CORE_message_queue_Status _CORE_message_queue_Submit(
- CORE_message_queue_Control *the_message_queue,
- Thread_Control *executing,
- const void *buffer,
- size_t size,
- Objects_Id id,
- CORE_message_queue_API_mp_support_callout api_message_queue_mp_support,
- CORE_message_queue_Submit_types submit_type,
- bool wait,
- Watchdog_Interval timeout,
- ISR_lock_Context *lock_context
-);
+#if defined(RTEMS_MULTIPROCESSING)
+ #define _CORE_message_queue_Submit( \
+ the_message_queue, \
+ executing, \
+ buffer, \
+ size, \
+ mp_callout, \
+ mp_id, \
+ submit_type, \
+ wait, \
+ timeout, \
+ lock_context \
+ ) \
+ _CORE_message_queue_Do_submit( \
+ the_message_queue, \
+ executing, \
+ buffer, \
+ size, \
+ mp_callout, \
+ mp_id, \
+ submit_type, \
+ wait, \
+ timeout, \
+ lock_context \
+ )
+#else
+ #define _CORE_message_queue_Submit( \
+ the_message_queue, \
+ executing, \
+ buffer, \
+ size, \
+ mp_callout, \
+ mp_id, \
+ submit_type, \
+ wait, \
+ timeout, \
+ lock_context \
+ ) \
+ _CORE_message_queue_Do_submit( \
+ the_message_queue, \
+ executing, \
+ buffer, \
+ size, \
+ submit_type, \
+ wait, \
+ timeout, \
+ lock_context \
+ )
+#endif
/**
* @brief Size a message from the message queue.
@@ -371,58 +452,54 @@ void _CORE_message_queue_Insert_message(
/**
* This routine sends a message to the end of the specified message queue.
*/
-RTEMS_INLINE_ROUTINE CORE_message_queue_Status _CORE_message_queue_Send(
- CORE_message_queue_Control *the_message_queue,
- const void *buffer,
- size_t size,
- Objects_Id id,
- CORE_message_queue_API_mp_support_callout api_message_queue_mp_support,
- bool wait,
- Watchdog_Interval timeout,
- ISR_lock_Context *lock_context
-)
-{
- return _CORE_message_queue_Submit(
- the_message_queue,
- _Thread_Executing,
- buffer,
- size,
- id,
- api_message_queue_mp_support,
- CORE_MESSAGE_QUEUE_SEND_REQUEST,
- wait, /* sender may block */
- timeout, /* timeout interval */
- lock_context
- );
-}
+#define _CORE_message_queue_Send( \
+ the_message_queue, \
+ buffer, \
+ size, \
+ mp_callout, \
+ mp_id, \
+ wait, \
+ timeout, \
+ lock_context \
+) \
+ _CORE_message_queue_Submit( \
+ the_message_queue, \
+ _Thread_Executing, \
+ buffer, \
+ size, \
+ mp_callout, \
+ mp_id, \
+ CORE_MESSAGE_QUEUE_SEND_REQUEST, \
+ wait, \
+ timeout, \
+ lock_context \
+ )
/**
* This routine sends a message to the front of the specified message queue.
*/
-RTEMS_INLINE_ROUTINE CORE_message_queue_Status _CORE_message_queue_Urgent(
- CORE_message_queue_Control *the_message_queue,
- const void *buffer,
- size_t size,
- Objects_Id id,
- CORE_message_queue_API_mp_support_callout api_message_queue_mp_support,
- bool wait,
- Watchdog_Interval timeout,
- ISR_lock_Context *lock_context
-)
-{
- return _CORE_message_queue_Submit(
- the_message_queue,
- _Thread_Executing,
- buffer,
- size,
- id,
- api_message_queue_mp_support,
- CORE_MESSAGE_QUEUE_URGENT_REQUEST,
- wait, /* sender may block */
- timeout, /* timeout interval */
- lock_context
- );
-}
+#define _CORE_message_queue_Urgent( \
+ the_message_queue, \
+ buffer, \
+ size, \
+ mp_callout, \
+ mp_id, \
+ wait, \
+ timeout, \
+ lock_context \
+) \
+ _CORE_message_queue_Submit( \
+ the_message_queue, \
+ _Thread_Executing, \
+ buffer, \
+ size, \
+ mp_callout, \
+ mp_id, \
+ CORE_MESSAGE_QUEUE_URGENT_REQUEST, \
+ wait,\
+ timeout, \
+ lock_context \
+ )
RTEMS_INLINE_ROUTINE void _CORE_message_queue_Acquire(
CORE_message_queue_Control *the_message_queue,
@@ -438,14 +515,6 @@ RTEMS_INLINE_ROUTINE void _CORE_message_queue_Acquire_critical(
)
{
_Thread_queue_Acquire_critical( &the_message_queue->Wait_queue, lock_context );
-
- #if defined(RTEMS_MULTIPROCESSING)
- /*
- * In case RTEMS_MULTIPROCESSING is enabled, then we have to prevent
- * deletion of the executing thread after the thread queue operations.
- */
- _Thread_Dispatch_disable();
- #endif
}
RTEMS_INLINE_ROUTINE void _CORE_message_queue_Release(
@@ -454,9 +523,6 @@ RTEMS_INLINE_ROUTINE void _CORE_message_queue_Release(
)
{
_Thread_queue_Release( &the_message_queue->Wait_queue, lock_context );
- #if defined(RTEMS_MULTIPROCESSING)
- _Thread_Dispatch_enable( _Per_CPU_Get() );
- #endif
}
/**
@@ -576,10 +642,14 @@ RTEMS_INLINE_ROUTINE
the_message_queue, the_handler, the_argument )
#endif
-RTEMS_INLINE_ROUTINE Thread_Control *_CORE_message_queue_Dequeue_receiver(
+RTEMS_INLINE_ROUTINE Thread_Control *_CORE_message_queue_Do_dequeue_receiver(
CORE_message_queue_Control *the_message_queue,
const void *buffer,
size_t size,
+#if defined(RTEMS_MULTIPROCESSING)
+ Thread_queue_MP_callout mp_callout,
+ Objects_Id mp_id,
+#endif
CORE_message_queue_Submit_types submit_type,
ISR_lock_Context *lock_context
)
@@ -623,12 +693,52 @@ RTEMS_INLINE_ROUTINE Thread_Control *_CORE_message_queue_Dequeue_receiver(
&the_message_queue->Wait_queue.Queue,
the_message_queue->operations,
the_thread,
+ mp_callout,
+ mp_id,
lock_context
);
return the_thread;
}
+#if defined(RTEMS_MULTIPROCESSING)
+ #define _CORE_message_queue_Dequeue_receiver( \
+ the_message_queue, \
+ buffer, \
+ size, \
+ mp_callout, \
+ mp_id, \
+ submit_type, \
+ lock_context \
+ ) \
+ _CORE_message_queue_Do_dequeue_receiver( \
+ the_message_queue, \
+ buffer, \
+ size, \
+ mp_callout, \
+ mp_id, \
+ submit_type, \
+ lock_context \
+ )
+#else
+ #define _CORE_message_queue_Dequeue_receiver( \
+ the_message_queue, \
+ buffer, \
+ size, \
+ mp_callout, \
+ mp_id, \
+ submit_type, \
+ lock_context \
+ ) \
+ _CORE_message_queue_Do_dequeue_receiver( \
+ the_message_queue, \
+ buffer, \
+ size, \
+ submit_type, \
+ lock_context \
+ )
+#endif
+
/** @} */
#ifdef __cplusplus
diff --git a/cpukit/score/include/rtems/score/coremuteximpl.h b/cpukit/score/include/rtems/score/coremuteximpl.h
index 812b6ba9cb..7facabb7c5 100644
--- a/cpukit/score/include/rtems/score/coremuteximpl.h
+++ b/cpukit/score/include/rtems/score/coremuteximpl.h
@@ -34,17 +34,6 @@ extern "C" {
/**@{**/
/**
- * @brief Callout which provides to support global/multiprocessor operations.
- *
- * The following type defines the callout which the API provides
- * to support global/multiprocessor operations on mutexes.
- */
-typedef void ( *CORE_mutex_API_mp_support_callout )(
- Thread_Control *,
- Objects_Id
- );
-
-/**
* @brief The possible Mutex handler return statuses.
*
* This enumerated type defines the possible Mutex handler return statuses.
@@ -302,28 +291,41 @@ RTEMS_INLINE_ROUTINE void _CORE_mutex_Seize_body(
_the_mutex, _executing, _id, _wait, _timeout, _lock_context )
#endif
-/**
- * @brief Frees a unit to the mutex.
- *
- * This routine frees a unit to the mutex. If a task was blocked waiting for
- * a unit from this mutex, then that task will be readied and the unit
- * given to that task. Otherwise, the unit will be returned to the mutex.
- *
- * @param[in] the_mutex is the mutex to surrender
- * @param[in] id is the id of the RTEMS Object associated with this mutex
- * @param[in] api_mutex_mp_support is the routine that will be called when
- * unblocking a remote mutex
- * @param[in] lock_context is the interrupt level
- *
- * @retval an indication of whether the routine succeeded or failed
- */
-CORE_mutex_Status _CORE_mutex_Surrender(
- CORE_mutex_Control *the_mutex,
- Objects_Id id,
- CORE_mutex_API_mp_support_callout api_mutex_mp_support,
- ISR_lock_Context *lock_context
+CORE_mutex_Status _CORE_mutex_Do_surrender(
+ CORE_mutex_Control *the_mutex,
+#if defined(RTEMS_MULTIPROCESSING)
+ Thread_queue_MP_callout mp_callout,
+ Objects_Id mp_id,
+#endif
+ ISR_lock_Context *lock_context
);
+#if defined(RTEMS_MULTIPROCESSING)
+ #define _CORE_mutex_Surrender( \
+ the_mutex, \
+ mp_callout, \
+ mp_id, \
+ lock_context \
+ ) \
+ _CORE_mutex_Do_surrender( \
+ the_mutex, \
+ mp_callout, \
+ mp_id, \
+ lock_context \
+ )
+#else
+ #define _CORE_mutex_Surrender( \
+ the_mutex, \
+ mp_callout, \
+ mp_id, \
+ lock_context \
+ ) \
+ _CORE_mutex_Do_surrender( \
+ the_mutex, \
+ lock_context \
+ )
+#endif
+
/* Must be a macro due to the multiprocessing dependent parameters */
#define _CORE_mutex_Flush( \
the_mutex, \
diff --git a/cpukit/score/include/rtems/score/coresemimpl.h b/cpukit/score/include/rtems/score/coresemimpl.h
index bde3e5b493..79d907c6b4 100644
--- a/cpukit/score/include/rtems/score/coresemimpl.h
+++ b/cpukit/score/include/rtems/score/coresemimpl.h
@@ -68,15 +68,6 @@ typedef enum {
#define CORE_SEMAPHORE_STATUS_LAST CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED
/**
- * The following type defines the callout which the API provides
- * to support global/multiprocessor operations on semaphores.
- */
-typedef void ( *CORE_semaphore_API_mp_support_callout )(
- Thread_Control *,
- Objects_Id
- );
-
-/**
* @brief Initialize the semaphore based on the parameters passed.
*
* This package is the implementation of the CORE Semaphore Handler.
@@ -102,28 +93,13 @@ RTEMS_INLINE_ROUTINE void _CORE_semaphore_Destroy(
_Thread_queue_Destroy( &the_semaphore->Wait_queue );
}
-/**
- * @brief Surrender a unit to a semaphore.
- *
- * This routine frees a unit to the semaphore. If a task was blocked waiting
- * for a unit from this semaphore, then that task will be readied and the unit
- * given to that task. Otherwise, the unit will be returned to the semaphore.
- *
- * @param[in] the_semaphore is the semaphore to surrender
- * @param[in] id is the Id of the API level Semaphore object associated
- * with this instance of a SuperCore Semaphore
- * @param[in] api_semaphore_mp_support is the routine to invoke if the
- * thread unblocked is remote
- * @param[in] lock_context is a temporary variable used to contain the ISR
- * disable level cookie
- *
- * @retval an indication of whether the routine succeeded or failed
- */
-RTEMS_INLINE_ROUTINE CORE_semaphore_Status _CORE_semaphore_Surrender(
- CORE_semaphore_Control *the_semaphore,
- Objects_Id id,
- CORE_semaphore_API_mp_support_callout api_semaphore_mp_support,
- ISR_lock_Context *lock_context
+RTEMS_INLINE_ROUTINE CORE_semaphore_Status _CORE_semaphore_Do_surrender(
+ CORE_semaphore_Control *the_semaphore,
+#if defined(RTEMS_MULTIPROCESSING)
+ Thread_queue_MP_callout mp_callout,
+ Objects_Id mp_id,
+#endif
+ ISR_lock_Context *lock_context
)
{
Thread_Control *the_thread;
@@ -138,23 +114,14 @@ RTEMS_INLINE_ROUTINE CORE_semaphore_Status _CORE_semaphore_Surrender(
the_semaphore->operations
);
if ( the_thread != NULL ) {
-#if defined(RTEMS_MULTIPROCESSING)
- _Thread_Dispatch_disable();
-#endif
-
_Thread_queue_Extract_critical(
&the_semaphore->Wait_queue.Queue,
the_semaphore->operations,
the_thread,
+ mp_callout,
+ mp_id,
lock_context
);
-
-#if defined(RTEMS_MULTIPROCESSING)
- if ( !_Objects_Is_local_id( the_thread->Object.id ) )
- (*api_semaphore_mp_support) ( the_thread, id );
-
- _Thread_Dispatch_enable( _Per_CPU_Get() );
-#endif
} else {
if ( the_semaphore->count < UINT32_MAX )
the_semaphore->count += 1;
@@ -167,6 +134,49 @@ RTEMS_INLINE_ROUTINE CORE_semaphore_Status _CORE_semaphore_Surrender(
return status;
}
+/**
+ * @brief Surrender a unit to a semaphore.
+ *
+ * This routine frees a unit to the semaphore. If a task was blocked waiting
+ * for a unit from this semaphore, then that task will be readied and the unit
+ * given to that task. Otherwise, the unit will be returned to the semaphore.
+ *
+ * @param[in] the_semaphore is the semaphore to surrender
+ * @param[in] mp_callout is the routine to invoke if the
+ * thread unblocked is remote
+ * @param[in] mp_id is the Id of the API level Semaphore object associated
+ * with this instance of a SuperCore Semaphore
+ * @param[in] lock_context is a temporary variable used to contain the ISR
+ * disable level cookie
+ *
+ * @retval an indication of whether the routine succeeded or failed
+ */
+#if defined(RTEMS_MULTIPROCESSING)
+ #define _CORE_semaphore_Surrender( \
+ the_semaphore, \
+ mp_callout, \
+ mp_id, \
+ lock_context \
+ ) \
+ _CORE_semaphore_Do_surrender( \
+ the_semaphore, \
+ mp_callout, \
+ mp_id, \
+ lock_context \
+ )
+#else
+ #define _CORE_semaphore_Surrender( \
+ the_semaphore, \
+ mp_callout, \
+ mp_id, \
+ lock_context \
+ ) \
+ _CORE_semaphore_Do_surrender( \
+ the_semaphore, \
+ lock_context \
+ )
+#endif
+
/* Must be a macro due to the multiprocessing dependent parameters */
#define _CORE_semaphore_Flush( \
the_semaphore, \
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index 949e8ca5ed..7bb65e418c 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -418,8 +418,19 @@ typedef struct {
#if defined(RTEMS_MULTIPROCESSING)
/** This field is the received response packet in an MP system. */
MP_packet_Prefix *receive_packet;
-#endif
/****************** end of common block ********************/
+
+ /**
+ * @brief Thread queue callout for _Thread_queue_Enqueue_critical().
+ */
+ Thread_queue_MP_callout thread_queue_callout;
+
+ /**
+ * @brief Thread queue object identifier for
+ * _Thread_queue_Enqueue_critical().
+ */
+ Objects_Id thread_queue_id;
+
/** This field is used to manage the set of proxies in the system. */
Chain_Node Active;
@@ -431,6 +442,7 @@ typedef struct {
* same storage place for the thread queue heads.
*/
Thread_queue_Heads Thread_queue_heads[ RTEMS_ZERO_LENGTH_ARRAY ];
+#endif
} Thread_Proxy_control;
/**
diff --git a/cpukit/score/include/rtems/score/threadq.h b/cpukit/score/include/rtems/score/threadq.h
index fbd53293ee..fb2014833a 100644
--- a/cpukit/score/include/rtems/score/threadq.h
+++ b/cpukit/score/include/rtems/score/threadq.h
@@ -21,6 +21,7 @@
#include <rtems/score/chain.h>
#include <rtems/score/isrlock.h>
+#include <rtems/score/object.h>
#include <rtems/score/priority.h>
#include <rtems/score/rbtree.h>
@@ -41,6 +42,21 @@ extern "C" {
typedef struct _Thread_Control Thread_Control;
+#if defined(RTEMS_MULTIPROCESSING)
+/**
+ * @brief Multiprocessing (MP) support callout for thread queue operations.
+ *
+ * @param the_proxy The thread proxy of the thread queue operation. A thread
+ * control is actually a thread proxy if and only if
+ * _Objects_Is_local_id( the_proxy->Object.id ) is false.
+ * @param mp_id Object identifier of the object containing the thread queue.
+ */
+typedef void ( *Thread_queue_MP_callout )(
+ Thread_Control *the_proxy,
+ Objects_Id mp_id
+);
+#endif
+
/**
* @brief Thread priority queue.
*/
diff --git a/cpukit/score/include/rtems/score/threadqimpl.h b/cpukit/score/include/rtems/score/threadqimpl.h
index 76f29d37f6..d56be79a45 100644
--- a/cpukit/score/include/rtems/score/threadqimpl.h
+++ b/cpukit/score/include/rtems/score/threadqimpl.h
@@ -153,20 +153,15 @@ RTEMS_INLINE_ROUTINE void _Thread_queue_Release(
);
}
+Thread_Control *_Thread_queue_Do_dequeue(
+ Thread_queue_Control *the_thread_queue,
+ const Thread_queue_Operations *operations
#if defined(RTEMS_MULTIPROCESSING)
-/**
- * @brief Multiprocessing (MP) support callout for thread queue operations.
- *
- * @param the_proxy The thread proxy of the thread queue operation. A thread
- * control is actually a thread proxy if and only if
- * _Objects_Is_local_id( the_proxy->Object.id ) is false.
- * @param mp_id Object identifier of the object containing the thread queue.
- */
-typedef void ( *Thread_queue_MP_callout )(
- Thread_Control *the_proxy,
- Objects_Id mp_id
-);
+ ,
+ Thread_queue_MP_callout mp_callout,
+ Objects_Id mp_id
#endif
+);
/**
* @brief Gets a pointer to a thread waiting on the_thread_queue.
@@ -179,10 +174,31 @@ typedef void ( *Thread_queue_MP_callout )(
* - INTERRUPT LATENCY:
* + single case
*/
-Thread_Control *_Thread_queue_Dequeue(
- Thread_queue_Control *the_thread_queue,
- const Thread_queue_Operations *operations
-);
+#if defined(RTEMS_MULTIPROCESSING)
+ #define _Thread_queue_Dequeue( \
+ the_thread_queue, \
+ operations, \
+ mp_callout, \
+ mp_id \
+ ) \
+ _Thread_queue_Do_dequeue( \
+ the_thread_queue, \
+ operations, \
+ mp_callout, \
+ mp_id \
+ )
+#else
+ #define _Thread_queue_Dequeue( \
+ the_thread_queue, \
+ operations, \
+ mp_callout, \
+ mp_id \
+ ) \
+ _Thread_queue_Do_dequeue( \
+ the_thread_queue, \
+ operations \
+ )
+#endif
/**
* @brief Blocks the thread and places it on the thread queue.
@@ -283,6 +299,17 @@ RTEMS_INLINE_ROUTINE void _Thread_queue_Enqueue(
);
}
+bool _Thread_queue_Do_extract_locked(
+ Thread_queue_Queue *queue,
+ const Thread_queue_Operations *operations,
+ Thread_Control *the_thread
+#if defined(RTEMS_MULTIPROCESSING)
+ ,
+ Thread_queue_MP_callout mp_callout,
+ Objects_Id mp_id
+#endif
+);
+
/**
* @brief Extracts the thread from the thread queue, restores the default wait
* operations and restores the default thread lock.
@@ -293,6 +320,11 @@ RTEMS_INLINE_ROUTINE void _Thread_queue_Enqueue(
* @param[in] queue The actual thread queue.
* @param[in] operations The thread queue operations.
* @param[in] the_thread The thread to extract.
+ * @param[in] mp_callout Callout to unblock the thread in case it is actually a
+ * thread proxy. This parameter is only used on multiprocessing
+ * configurations.
+ * @param[in] mp_id Object identifier of the object containing the thread
+ * queue. This parameter is only used on multiprocessing configurations.
*
* @return Returns the unblock indicator for _Thread_queue_Unblock_critical().
* True indicates, that this thread must be unblocked by the scheduler later in
@@ -302,10 +334,45 @@ RTEMS_INLINE_ROUTINE void _Thread_queue_Enqueue(
* since this thread may already block on another resource in an SMP
* configuration.
*/
-bool _Thread_queue_Extract_locked(
- Thread_queue_Queue *queue,
- const Thread_queue_Operations *operations,
- Thread_Control *the_thread
+#if defined(RTEMS_MULTIPROCESSING)
+ #define _Thread_queue_Extract_locked( \
+ unblock, \
+ queue, \
+ the_thread, \
+ mp_callout, \
+ mp_id \
+ ) \
+ _Thread_queue_Do_extract_locked( \
+ unblock, \
+ queue, \
+ the_thread, \
+ mp_callout, \
+ mp_id \
+ )
+#else
+ #define _Thread_queue_Extract_locked( \
+ unblock, \
+ queue, \
+ the_thread, \
+ mp_callout, \
+ mp_id \
+ ) \
+ _Thread_queue_Do_extract_locked( \
+ unblock, \
+ queue, \
+ the_thread \
+ )
+#endif
+
+void _Thread_queue_Do_unblock_critical(
+ bool unblock,
+ Thread_queue_Queue *queue,
+ Thread_Control *the_thread,
+#if defined(RTEMS_MULTIPROCESSING)
+ Thread_queue_MP_callout mp_callout,
+ Objects_Id mp_id,
+#endif
+ ISR_lock_Context *lock_context
);
/**
@@ -320,13 +387,56 @@ bool _Thread_queue_Extract_locked(
* _Thread_queue_Extract_locked().
* @param[in] queue The actual thread queue.
* @param[in] the_thread The thread to extract.
+ * @param[in] mp_callout Callout to unblock the thread in case it is actually a
+ * thread proxy. This parameter is only used on multiprocessing
+ * configurations.
+ * @param[in] mp_id Object identifier of the object containing the thread
+ * queue. This parameter is only used on multiprocessing configurations.
* @param[in] lock_context The lock context of the lock acquire.
*/
-void _Thread_queue_Unblock_critical(
- bool unblock,
- Thread_queue_Queue *queue,
- Thread_Control *the_thread,
- ISR_lock_Context *lock_context
+#if defined(RTEMS_MULTIPROCESSING)
+ #define _Thread_queue_Unblock_critical( \
+ unblock, \
+ queue, \
+ the_thread, \
+ mp_callout, \
+ mp_id, \
+ lock_context \
+ ) \
+ _Thread_queue_Do_unblock_critical( \
+ unblock, \
+ queue, \
+ the_thread, \
+ mp_callout, \
+ mp_id, \
+ lock_context \
+ )
+#else
+ #define _Thread_queue_Unblock_critical( \
+ unblock, \
+ queue, \
+ the_thread, \
+ mp_callout, \
+ mp_id, \
+ lock_context \
+ ) \
+ _Thread_queue_Do_unblock_critical( \
+ unblock, \
+ queue, \
+ the_thread, \
+ lock_context \
+ )
+#endif
+
+void _Thread_queue_Do_extract_critical(
+ Thread_queue_Queue *queue,
+ const Thread_queue_Operations *operations,
+ Thread_Control *the_thread,
+#if defined(RTEMS_MULTIPROCESSING)
+ Thread_queue_MP_callout mp_callout,
+ Objects_Id mp_id,
+#endif
+ ISR_lock_Context *lock_context
);
/**
@@ -364,6 +474,8 @@ void _Thread_queue_Unblock_critical(
* &mutex->Queue.Queue,
* mutex->Queue.operations,
* first,
+ * NULL,
+ * 0,
* &lock_context
* );
* }
@@ -372,14 +484,46 @@ void _Thread_queue_Unblock_critical(
* @param[in] queue The actual thread queue.
* @param[in] operations The thread queue operations.
* @param[in] the_thread The thread to extract.
+ * @param[in] mp_callout Callout to unblock the thread in case it is actually a
+ * thread proxy. This parameter is only used on multiprocessing
+ * configurations.
+ * @param[in] mp_id Object identifier of the object containing the thread
+ * queue. This parameter is only used on multiprocessing configurations.
* @param[in] lock_context The lock context of the lock acquire.
*/
-void _Thread_queue_Extract_critical(
- Thread_queue_Queue *queue,
- const Thread_queue_Operations *operations,
- Thread_Control *the_thread,
- ISR_lock_Context *lock_context
-);
+#if defined(RTEMS_MULTIPROCESSING)
+ #define _Thread_queue_Extract_critical( \
+ queue, \
+ operations, \
+ the_thread, \
+ mp_callout, \
+ mp_id, \
+ lock_context \
+ ) \
+ _Thread_queue_Do_extract_critical( \
+ queue, \
+ operations, \
+ the_thread, \
+ mp_callout, \
+ mp_id, \
+ lock_context \
+ )
+#else
+ #define _Thread_queue_Extract_critical( \
+ queue, \
+ operations, \
+ the_thread, \
+ mp_callout, \
+ mp_id, \
+ lock_context \
+ ) \
+ _Thread_queue_Do_extract_critical( \
+ queue, \
+ operations, \
+ the_thread, \
+ lock_context \
+ )
+#endif
/**
* @brief Extracts thread from thread queue.
@@ -574,6 +718,13 @@ RBTree_Compare_result _Thread_queue_Compare_priority(
const RBTree_Node *right
);
+#if defined(RTEMS_MULTIPROCESSING)
+void _Thread_queue_MP_callout_do_nothing(
+ Thread_Control *the_proxy,
+ Objects_Id mp_id
+);
+#endif
+
extern const Thread_queue_Operations _Thread_queue_Operations_default;
extern const Thread_queue_Operations _Thread_queue_Operations_FIFO;