From 7045dc425d9416060c9ba862e9eaf8405b688474 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 1 Aug 2013 09:17:51 +0200 Subject: smp: Use ISR lock in per-CPU control Rename _Per_CPU_Lock_acquire() to _Per_CPU_ISR_disable_and_acquire(). Rename _Per_CPU_Lock_release() to _Per_CPU_Release_and_ISR_enable(). Add _Per_CPU_Acquire() and _Per_CPU_Release(). --- cpukit/score/include/rtems/score/percpu.h | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'cpukit/score/include/rtems/score/percpu.h') diff --git a/cpukit/score/include/rtems/score/percpu.h b/cpukit/score/include/rtems/score/percpu.h index e6713bf502..6e3a18e6db 100644 --- a/cpukit/score/include/rtems/score/percpu.h +++ b/cpukit/score/include/rtems/score/percpu.h @@ -23,9 +23,8 @@ #include #else #include - #include + #include #include - #include #include #endif @@ -179,10 +178,13 @@ typedef struct { /** This is the time of the last context switch on this CPU. */ Timestamp_Control time_of_last_context_switch; - #if defined( RTEMS_SMP ) - /** This element is used to lock this structure */ - SMP_lock_Control lock; + /** + * @brief This lock protects the dispatch_necessary, executing, heir and + * message fields. + */ + ISR_lock_Control lock; + #if defined( RTEMS_SMP ) /** * This is the request for the interrupt. * @@ -220,6 +222,18 @@ typedef struct { */ extern Per_CPU_Control_envelope _Per_CPU_Information[] CPU_STRUCTURE_ALIGNMENT; +#define _Per_CPU_ISR_disable_and_acquire( per_cpu, isr_cookie ) \ + _ISR_lock_ISR_disable_and_acquire( &( per_cpu )->lock, isr_cookie ) + +#define _Per_CPU_Release_and_ISR_enable( per_cpu, isr_cookie ) \ + _ISR_lock_Release_and_ISR_enable( &( per_cpu )->lock, isr_cookie ) + +#define _Per_CPU_Acquire( per_cpu ) \ + _ISR_lock_Acquire( &( per_cpu )->lock ) + +#define _Per_CPU_Release( per_cpu ) \ + _ISR_lock_Release( &( per_cpu )->lock ) + #if defined( RTEMS_SMP ) static inline Per_CPU_Control *_Per_CPU_Get( void ) { @@ -275,12 +289,6 @@ void _Per_CPU_Wait_for_state( Per_CPU_State desired_state ); -#define _Per_CPU_Lock_acquire( per_cpu, isr_cookie ) \ - _SMP_lock_ISR_disable_and_acquire( &( per_cpu )->lock, isr_cookie ) - -#define _Per_CPU_Lock_release( per_cpu, isr_cookie ) \ - _SMP_lock_Release_and_ISR_enable( &( per_cpu )->lock, isr_cookie ) - #endif /* defined( RTEMS_SMP ) */ /* -- cgit v1.2.3