diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-03-16 20:05:06 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-03-16 20:05:06 +0000 |
commit | 06dcaf09e6c0eae0b3a3c8d84adb663d03a53a4b (patch) | |
tree | 931cf314d5a87d1d3dcd6e5c366b5ce58270a6aa /cpukit/score/src/thread.c | |
parent | 2011-03-16 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-06dcaf09e6c0eae0b3a3c8d84adb663d03a53a4b.tar.bz2 |
2011-03-16 Jennifer Averett <jennifer.averett@OARcorp.com>
PR 1729/cpukit
* configure.ac, sapi/include/confdefs.h, sapi/src/exinit.c,
score/Makefile.am, score/preinstall.am,
score/cpu/i386/rtems/score/cpu.h, score/cpu/sparc/cpu_asm.S,
score/cpu/sparc/rtems/score/cpu.h,
score/include/rtems/score/basedefs.h,
score/include/rtems/score/context.h,
score/include/rtems/score/percpu.h, score/src/percpu.c,
score/src/thread.c, score/src/threadcreateidle.c: Add next step in
SMP support. This adds an allocated array of the Per_CPU structures
to support multiple cpus vs a single instance of the structure which
is still used if SMP support is disabled. Configuration support is
also added to explicitly enable or disable SMP. But SMP can only be
enabled for the CPUs which will support it initially -- SPARC and
i386. With the stub BSP support, a BSP can be run as a single core
SMP system from an RTEMS data structure standpoint.
* aclocal/check-smp.m4, aclocal/enable-smp.m4,
score/include/rtems/bspsmp.h, score/include/rtems/score/smplock.h,
score/src/smp.c, score/src/smplock.c: New files.
Diffstat (limited to '')
-rw-r--r-- | cpukit/score/src/thread.c | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/cpukit/score/src/thread.c b/cpukit/score/src/thread.c index 6284e4b3e3..7a0eb38502 100644 --- a/cpukit/score/src/thread.c +++ b/cpukit/score/src/thread.c @@ -2,7 +2,7 @@ * Thread Handler * * - * COPYRIGHT (c) 1989-2008. + * COPYRIGHT (c) 1989-2011. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -33,8 +33,11 @@ #include <rtems/score/wkspace.h> #include <rtems/config.h> -/*PAGE - * +#if defined(RTEMS_SMP) + #include <rtems/bspsmp.h> +#endif + +/* * _Thread_Handler_initialization * * This routine initializes all thread manager related data structures. @@ -48,6 +51,7 @@ void _Thread_Handler_initialization(void) { uint32_t ticks_per_timeslice; uint32_t maximum_extensions; + uint32_t maximum_internal_threads; #if defined(RTEMS_MULTIPROCESSING) uint32_t maximum_proxies; #endif @@ -80,32 +84,40 @@ void _Thread_Handler_initialization(void) _Thread_Ticks_per_timeslice = ticks_per_timeslice; -#if defined(RTEMS_MULTIPROCESSING) - _Thread_MP_Handler_initialization( maximum_proxies ); -#endif + #if defined(RTEMS_MULTIPROCESSING) + _Thread_MP_Handler_initialization( maximum_proxies ); + #endif /* - * Initialize this class of objects. + * Initialize the internal class of threads. We need an IDLE thread + * per CPU in an SMP system. In addition, if this is a loosely + * coupled multiprocessing system, account for the MPCI Server Thread. */ + #if defined(RTEMS_SMP) + maximum_internal_threads = rtems_smp_maximum_processors; + #else + maximum_internal_threads = 1; + #endif + + #if defined(RTEMS_MULTIPROCESSING) + if ( _System_state_Is_multiprocessing ) + maximum_internal_threads += 1; + #endif _Objects_Initialize_information( &_Thread_Internal_information, OBJECTS_INTERNAL_API, OBJECTS_INTERNAL_THREADS, -#if defined(RTEMS_MULTIPROCESSING) - ( _System_state_Is_multiprocessing ) ? 2 : 1, -#else - 1, -#endif + maximum_internal_threads, sizeof( Thread_Control ), /* size of this object's control block */ false, /* true if names for this object are strings */ 8 /* maximum length of each object's name */ -#if defined(RTEMS_MULTIPROCESSING) - , - false, /* true if this is a global object class */ - NULL /* Proxy extraction support callout */ -#endif + #if defined(RTEMS_MULTIPROCESSING) + , + false, /* true if this is a global object class */ + NULL /* Proxy extraction support callout */ + #endif ); } |