summaryrefslogtreecommitdiffstats
path: root/cpukit/sapi/include/confdefs.h
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2011-03-16 20:05:06 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2011-03-16 20:05:06 +0000
commit06dcaf09e6c0eae0b3a3c8d84adb663d03a53a4b (patch)
tree931cf314d5a87d1d3dcd6e5c366b5ce58270a6aa /cpukit/sapi/include/confdefs.h
parent2011-03-16 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-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 'cpukit/sapi/include/confdefs.h')
-rw-r--r--cpukit/sapi/include/confdefs.h70
1 files changed, 64 insertions, 6 deletions
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index d194fed1bc..ad81403430 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -174,6 +174,21 @@ rtems_fs_init_functions_t rtems_fs_init_helper =
extern int rtems_telnetd_maximum_ptys;
#endif
+#if defined(RTEMS_SMP)
+ /*
+ * If configured for SMP, then we need to know the maximum CPU cores.
+ */
+ #if !defined(CONFIGURE_SMP_APPLICATION)
+ #if !defined(CONFIGURE_SMP_MAXIMUM_PROCESSORS)
+ #define CONFIGURE_SMP_MAXIMUM_PROCESSORS 1
+ #endif
+ #else
+ #if !defined(CONFIGURE_SMP_MAXIMUM_PROCESSORS)
+ #error "CONFIGURE_SMP_MAXIMUM_PROCESSORS not specified for SMP Application"
+ #endif
+ #endif
+#endif
+
/*
* Filesystems and Mount Table Configuration.
*
@@ -1805,12 +1820,25 @@ rtems_fs_init_functions_t rtems_fs_init_helper =
_Configure_Object_RAM(1, sizeof(API_Mutex_Control))
/**
- * This defines the amount of memory reserved for the IDLE task
- * control structures and stack.
+ * This defines the formula used to compute the amount of memory
+ * reserved for IDLE task control structures and stacks.
+ */
+#define CONFIGURE_IDLE_TASKS(_count) \
+ (CONFIGURE_MEMORY_FOR_TASKS(_count, 0) + \
+ _count * _Configure_From_workspace( \
+ (CONFIGURE_IDLE_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE)))
+
+/**
+ * This calculates the amount of memory reserved for the IDLE tasks.
+ * In an SMP system, each CPU core has its own idle task.
*/
-#define CONFIGURE_MEMORY_FOR_IDLE_TASK \
- (CONFIGURE_MEMORY_FOR_TASKS(1, 0) + \
- (CONFIGURE_IDLE_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE))
+#if defined(RTEMS_SMP)
+ #define CONFIGURE_MEMORY_FOR_IDLE_TASK \
+ CONFIGURE_IDLE_TASKS(CONFIGURE_SMP_MAXIMUM_PROCESSORS)
+#else
+ #define CONFIGURE_MEMORY_FOR_IDLE_TASK \
+ CONFIGURE_IDLE_TASKS(1)
+#endif
/**
* This macro accounts for general RTEMS system overhead.
@@ -1898,6 +1926,15 @@ rtems_fs_init_functions_t rtems_fs_init_helper =
CONFIGURE_MEMORY_FOR_USER_EXTENSIONS(CONFIGURE_MAXIMUM_USER_EXTENSIONS) \
)
+#if defined(RTEMS_SMP)
+ #define CONFIGURE_MEMORY_FOR_SMP \
+ (CONFIGURE_SMP_MAXIMUM_PROCESSORS * \
+ _Configure_From_workspace( CONFIGURE_INTERRUPT_STACK_SIZE ) \
+ )
+#else
+ #define CONFIGURE_MEMORY_FOR_SMP 0
+#endif
+
#if defined(CONFIGURE_CONFDEFS_DEBUG) && defined(CONFIGURE_INIT)
/**
* This is a debug mechanism, so if you need to, the executable will
@@ -2012,10 +2049,11 @@ rtems_fs_init_functions_t rtems_fs_init_helper =
CONFIGURE_MEMORY_FOR_CLASSIC + \
CONFIGURE_MEMORY_FOR_POSIX + \
(CONFIGURE_MAXIMUM_POSIX_THREADS * CONFIGURE_MINIMUM_TASK_STACK_SIZE ) + \
- (CONFIGURE_MAXIMUM_GOROUTINES * CONFIGURE_MINIMUM_TASK_STACK_SIZE ) + \
+ (CONFIGURE_MAXIMUM_GOROUTINES * CONFIGURE_MINIMUM_TASK_STACK_SIZE) + \
CONFIGURE_INITIALIZATION_THREADS_STACKS + \
CONFIGURE_MEMORY_FOR_STATIC_EXTENSIONS + \
CONFIGURE_MEMORY_FOR_MP + \
+ CONFIGURE_MEMORY_FOR_SMP + \
CONFIGURE_MESSAGE_BUFFER_MEMORY + \
(CONFIGURE_MEMORY_OVERHEAD * 1024) + \
(CONFIGURE_EXTRA_TASK_STACKS) + (CONFIGURE_ADA_TASKS_STACK) \
@@ -2117,6 +2155,26 @@ rtems_fs_init_functions_t rtems_fs_init_helper =
#endif /* CONFIGURE_HAS_OWN_CONFIGURATION_TABLE */
+#if defined(RTEMS_SMP)
+ /**
+ * Instantiate the variable which specifies the number of CPUs
+ * in an SMP configuration.
+ */
+ #if defined(CONFIGURE_INIT)
+ uint32_t rtems_smp_maximum_processors = CONFIGURE_SMP_MAXIMUM_PROCESSORS;
+ #else
+ extern uint32_t rtems_smp_maximum_processors;
+ #endif
+ /*
+ * Instantiate the Per CPU information based upon the user configuration.
+ */
+ #if defined(CONFIGURE_INIT)
+ Per_CPU_Control _Per_CPU_Information[CONFIGURE_SMP_MAXIMUM_PROCESSORS];
+ Per_CPU_Control *_Per_CPU_Information_p[CONFIGURE_SMP_MAXIMUM_PROCESSORS];
+ #endif
+
+#endif
+
/*
* If the user has configured a set of Classic API Initialization Tasks,
* then we need to install the code that runs that loop.