summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/schedulerprioritysmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/score/src/schedulerprioritysmp.c')
-rw-r--r--cpukit/score/src/schedulerprioritysmp.c97
1 files changed, 47 insertions, 50 deletions
diff --git a/cpukit/score/src/schedulerprioritysmp.c b/cpukit/score/src/schedulerprioritysmp.c
index 5361023b4a..025d9601fd 100644
--- a/cpukit/score/src/schedulerprioritysmp.c
+++ b/cpukit/score/src/schedulerprioritysmp.c
@@ -29,40 +29,37 @@
#include <rtems/score/schedulersmpimpl.h>
#include <rtems/score/wkspace.h>
-static Scheduler_priority_SMP_Control *
-_Scheduler_priority_SMP_Self_from_base( Scheduler_Control *base )
+static Scheduler_priority_SMP_Context *
+_Scheduler_priority_SMP_Get_context( const Scheduler_Control *scheduler )
{
- return (Scheduler_priority_SMP_Control *) base->information;
+ return (Scheduler_priority_SMP_Context *) scheduler->context;
}
-static Scheduler_priority_SMP_Control *
-_Scheduler_priority_SMP_Self_from_SMP_base( Scheduler_SMP_Control *smp_base )
+static Scheduler_priority_SMP_Context *
+_Scheduler_priority_SMP_Self_from_SMP_base( Scheduler_SMP_Context *smp_base )
{
- return (Scheduler_priority_SMP_Control *)
+ return (Scheduler_priority_SMP_Context *)
( (char *) smp_base
- - offsetof( Scheduler_priority_SMP_Control, Base ) );
+ - offsetof( Scheduler_priority_SMP_Context, Base ) );
}
-void _Scheduler_priority_SMP_Initialize( void )
+void _Scheduler_priority_SMP_Initialize( const Scheduler_Control *scheduler )
{
- Scheduler_priority_SMP_Control *self = _Workspace_Allocate_or_fatal_error(
- sizeof( *self ) + PRIORITY_MAXIMUM * sizeof( Chain_Control )
- );
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_SMP_Initialize( &self->Base );
_Priority_bit_map_Initialize( &self->Bit_map );
_Scheduler_priority_Ready_queue_initialize( &self->Ready[ 0 ] );
-
- _Scheduler.information = self;
}
void _Scheduler_priority_SMP_Update(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
- Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_base( base );
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_priority_Update_body(
thread,
@@ -72,10 +69,10 @@ void _Scheduler_priority_SMP_Update(
}
static Thread_Control *_Scheduler_priority_SMP_Get_highest_ready(
- Scheduler_SMP_Control *smp_base
+ Scheduler_SMP_Context *smp_base
)
{
- Scheduler_priority_SMP_Control *self =
+ Scheduler_priority_SMP_Context *self =
_Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
Thread_Control *highest_ready = NULL;
@@ -90,11 +87,11 @@ static Thread_Control *_Scheduler_priority_SMP_Get_highest_ready(
}
static void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
- Scheduler_SMP_Control *smp_base,
+ Scheduler_SMP_Context *smp_base,
Thread_Control *scheduled_to_ready
)
{
- Scheduler_priority_SMP_Control *self =
+ Scheduler_priority_SMP_Context *self =
_Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
_Chain_Extract_unprotected( &scheduled_to_ready->Object.Node );
@@ -105,11 +102,11 @@ static void _Scheduler_priority_SMP_Move_from_scheduled_to_ready(
}
static void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
- Scheduler_SMP_Control *smp_base,
+ Scheduler_SMP_Context *smp_base,
Thread_Control *ready_to_scheduled
)
{
- Scheduler_priority_SMP_Control *self =
+ Scheduler_priority_SMP_Context *self =
_Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
_Scheduler_priority_Ready_queue_extract(
@@ -123,33 +120,33 @@ static void _Scheduler_priority_SMP_Move_from_ready_to_scheduled(
}
static void _Scheduler_priority_SMP_Insert_ready_lifo(
- Scheduler_SMP_Control *smp_base,
+ Scheduler_SMP_Context *smp_base,
Thread_Control *thread
)
{
- Scheduler_priority_SMP_Control *self =
+ Scheduler_priority_SMP_Context *self =
_Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
_Scheduler_priority_Ready_queue_enqueue( thread, &self->Bit_map );
}
static void _Scheduler_priority_SMP_Insert_ready_fifo(
- Scheduler_SMP_Control *smp_base,
+ Scheduler_SMP_Context *smp_base,
Thread_Control *thread
)
{
- Scheduler_priority_SMP_Control *self =
+ Scheduler_priority_SMP_Context *self =
_Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
_Scheduler_priority_Ready_queue_enqueue_first( thread, &self->Bit_map );
}
static void _Scheduler_priority_SMP_Do_extract(
- Scheduler_SMP_Control *smp_base,
+ Scheduler_SMP_Context *smp_base,
Thread_Control *thread
)
{
- Scheduler_priority_SMP_Control *self =
+ Scheduler_priority_SMP_Context *self =
_Scheduler_priority_SMP_Self_from_SMP_base( smp_base );
bool is_scheduled = thread->is_scheduled;
@@ -164,12 +161,12 @@ static void _Scheduler_priority_SMP_Do_extract(
}
void _Scheduler_priority_SMP_Block(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
- Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_base( base );
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_SMP_Block(
&self->Base,
@@ -181,7 +178,7 @@ void _Scheduler_priority_SMP_Block(
}
static void _Scheduler_priority_SMP_Enqueue_ordered(
- Scheduler_SMP_Control *self,
+ Scheduler_SMP_Context *self,
Thread_Control *thread,
Chain_Node_order order,
Scheduler_SMP_Insert insert_ready,
@@ -201,12 +198,12 @@ static void _Scheduler_priority_SMP_Enqueue_ordered(
}
void _Scheduler_priority_SMP_Enqueue_lifo(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
- Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_base( base );
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_priority_SMP_Enqueue_ordered(
&self->Base,
@@ -218,12 +215,12 @@ void _Scheduler_priority_SMP_Enqueue_lifo(
}
void _Scheduler_priority_SMP_Enqueue_fifo(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
- Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_base( base );
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_priority_SMP_Enqueue_ordered(
&self->Base,
@@ -235,12 +232,12 @@ void _Scheduler_priority_SMP_Enqueue_fifo(
}
void _Scheduler_priority_SMP_Extract(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
- Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_base( base );
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_SMP_Extract(
&self->Base,
@@ -250,7 +247,7 @@ void _Scheduler_priority_SMP_Extract(
}
void _Scheduler_priority_SMP_Yield(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
@@ -258,19 +255,19 @@ void _Scheduler_priority_SMP_Yield(
_ISR_Disable( level );
- _Scheduler_priority_SMP_Extract( base, thread );
- _Scheduler_priority_SMP_Enqueue_fifo( base, thread );
+ _Scheduler_priority_SMP_Extract( scheduler, thread );
+ _Scheduler_priority_SMP_Enqueue_fifo( scheduler, thread );
_ISR_Enable( level );
}
void _Scheduler_priority_SMP_Schedule(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread
)
{
- Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_base( base );
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_SMP_Schedule(
&self->Base,
@@ -281,13 +278,13 @@ void _Scheduler_priority_SMP_Schedule(
}
void _Scheduler_priority_SMP_Start_idle(
- Scheduler_Control *base,
+ const Scheduler_Control *scheduler,
Thread_Control *thread,
Per_CPU_Control *cpu
)
{
- Scheduler_priority_SMP_Control *self =
- _Scheduler_priority_SMP_Self_from_base( base );
+ Scheduler_priority_SMP_Context *self =
+ _Scheduler_priority_SMP_Get_context( scheduler );
_Scheduler_SMP_Start_idle( &self->Base, thread, cpu );
}