From 976162a69f6fdfbd2ab507074be7d99a48b4f7f7 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 3 Dec 2007 22:23:13 +0000 Subject: 2007-12-03 Joel Sherrill * libcsupport/src/malloc.c, libmisc/monitor/mon-command.c, posix/preinstall.am, posix/include/rtems/posix/cond.h, posix/include/rtems/posix/mqueue.h, posix/include/rtems/posix/mutex.h, posix/include/rtems/posix/pthread.h, posix/include/rtems/posix/semaphore.h, posix/src/conddestroy.c, posix/src/mutexdestroy.c, posix/src/mutexinit.c, posix/src/mutexsetprioceiling.c, posix/src/mutexunlock.c, sapi/include/confdefs.h, sapi/include/rtems/config.h, sapi/include/rtems/init.h, sapi/include/rtems/sptables.h, sapi/src/exinit.c, score/include/rtems/system.h, score/include/rtems/score/mpci.h, score/src/mpci.c, score/src/thread.c, score/src/threadcreateidle.c, score/src/threadstackallocate.c, score/src/threadstackfree.c, score/src/wkspace.c: Moved most of the remaining CPU Table fields to the Configuration Table. This included pretasking_hook, predriver_hook, postdriver_hook, idle_task, do_zero_of_workspace, extra_mpci_receive_server_stack, stack_allocate_hook, and stack_free_hook. As a side-effect of this effort some multiprocessing code was made conditional and some style clean up occurred. --- cpukit/ChangeLog | 23 ++++++++ cpukit/libcsupport/src/malloc.c | 2 +- cpukit/libmisc/monitor/mon-command.c | 5 +- cpukit/posix/include/rtems/posix/cond.h | 3 - cpukit/posix/include/rtems/posix/mqueue.h | 3 - cpukit/posix/include/rtems/posix/mutex.h | 3 - cpukit/posix/include/rtems/posix/pthread.h | 3 - cpukit/posix/include/rtems/posix/semaphore.h | 3 - cpukit/posix/preinstall.am | 16 +++++- cpukit/posix/src/conddestroy.c | 17 ------ cpukit/posix/src/mutexdestroy.c | 27 +-------- cpukit/posix/src/mutexinit.c | 23 -------- cpukit/posix/src/mutexsetprioceiling.c | 7 --- cpukit/posix/src/mutexunlock.c | 4 -- cpukit/sapi/include/confdefs.h | 82 +++++++++++++++++++++++++--- cpukit/sapi/include/rtems/config.h | 61 +++++++++++++++++---- cpukit/sapi/include/rtems/init.h | 2 + cpukit/sapi/include/rtems/sptables.h | 27 ++++----- cpukit/sapi/src/exinit.c | 49 ++++++++++------- cpukit/score/include/rtems/score/mpci.h | 10 ---- cpukit/score/include/rtems/system.h | 28 ---------- cpukit/score/src/mpci.c | 9 ++- cpukit/score/src/thread.c | 6 +- cpukit/score/src/threadcreateidle.c | 7 ++- cpukit/score/src/threadstackallocate.c | 5 +- cpukit/score/src/threadstackfree.c | 7 ++- cpukit/score/src/wkspace.c | 19 ++----- 27 files changed, 242 insertions(+), 209 deletions(-) (limited to 'cpukit') diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index c0dc235877..ac2bf54c12 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,26 @@ +2007-12-03 Joel Sherrill + + * libcsupport/src/malloc.c, libmisc/monitor/mon-command.c, + posix/preinstall.am, posix/include/rtems/posix/cond.h, + posix/include/rtems/posix/mqueue.h, + posix/include/rtems/posix/mutex.h, + posix/include/rtems/posix/pthread.h, + posix/include/rtems/posix/semaphore.h, posix/src/conddestroy.c, + posix/src/mutexdestroy.c, posix/src/mutexinit.c, + posix/src/mutexsetprioceiling.c, posix/src/mutexunlock.c, + sapi/include/confdefs.h, sapi/include/rtems/config.h, + sapi/include/rtems/init.h, sapi/include/rtems/sptables.h, + sapi/src/exinit.c, score/include/rtems/system.h, + score/include/rtems/score/mpci.h, score/src/mpci.c, + score/src/thread.c, score/src/threadcreateidle.c, + score/src/threadstackallocate.c, score/src/threadstackfree.c, + score/src/wkspace.c: Moved most of the remaining CPU Table fields to + the Configuration Table. This included pretasking_hook, + predriver_hook, postdriver_hook, idle_task, do_zero_of_workspace, + extra_mpci_receive_server_stack, stack_allocate_hook, and + stack_free_hook. As a side-effect of this effort some multiprocessing + code was made conditional and some style clean up occurred. + 2007-12-03 Chris Johns * libmisc/shell/shell.h: Added comments for the parameters to the diff --git a/cpukit/libcsupport/src/malloc.c b/cpukit/libcsupport/src/malloc.c index 4ce197599f..6a8f584a98 100644 --- a/cpukit/libcsupport/src/malloc.c +++ b/cpukit/libcsupport/src/malloc.c @@ -175,7 +175,7 @@ void RTEMS_Malloc_Initialize( * left over from another process. This would be a security violation. */ - if ( rtems_cpu_configuration_get_do_zero_of_workspace() ) + if ( rtems_configuration_get_do_zero_of_workspace() ) memset( starting_address, 0, length ); /* diff --git a/cpukit/libmisc/monitor/mon-command.c b/cpukit/libmisc/monitor/mon-command.c index 617252b1f5..d007871089 100644 --- a/cpukit/libmisc/monitor/mon-command.c +++ b/cpukit/libmisc/monitor/mon-command.c @@ -498,10 +498,13 @@ rtems_monitor_command_read(char *command, /* * put node number in the prompt if we are multiprocessing */ +#if defined(RTEMS_MULTIPROCESSING) if (!rtems_configuration_get_user_multiprocessing_table ()) sprintf (monitor_prompt, "%s", (env_prompt == NULL) ? MONITOR_PROMPT: env_prompt); - else if (rtems_monitor_default_node != rtems_monitor_node) + else /* .... */ +#endif + if (rtems_monitor_default_node != rtems_monitor_node) sprintf (monitor_prompt, "%" PRId32 "-%s-%" PRId32 "", rtems_monitor_node, (env_prompt == NULL) ? MONITOR_PROMPT : env_prompt, rtems_monitor_default_node); diff --git a/cpukit/posix/include/rtems/posix/cond.h b/cpukit/posix/include/rtems/posix/cond.h index 23b00d9dba..a692ad462f 100644 --- a/cpukit/posix/include/rtems/posix/cond.h +++ b/cpukit/posix/include/rtems/posix/cond.h @@ -159,9 +159,6 @@ int _POSIX_Condition_variables_Wait_support( ); #include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif #ifdef __cplusplus } diff --git a/cpukit/posix/include/rtems/posix/mqueue.h b/cpukit/posix/include/rtems/posix/mqueue.h index 7b831ac141..475f9a2432 100644 --- a/cpukit/posix/include/rtems/posix/mqueue.h +++ b/cpukit/posix/include/rtems/posix/mqueue.h @@ -239,9 +239,6 @@ int _POSIX_Message_queue_Translate_core_message_queue_return_code( #include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif #ifdef __cplusplus } diff --git a/cpukit/posix/include/rtems/posix/mutex.h b/cpukit/posix/include/rtems/posix/mutex.h index 0d61041a83..72551a78fc 100644 --- a/cpukit/posix/include/rtems/posix/mutex.h +++ b/cpukit/posix/include/rtems/posix/mutex.h @@ -148,9 +148,6 @@ int _POSIX_Mutex_Translate_core_mutex_return_code( #include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif #ifdef __cplusplus } diff --git a/cpukit/posix/include/rtems/posix/pthread.h b/cpukit/posix/include/rtems/posix/pthread.h index 1598abc56d..6d0c739f0c 100644 --- a/cpukit/posix/include/rtems/posix/pthread.h +++ b/cpukit/posix/include/rtems/posix/pthread.h @@ -141,9 +141,6 @@ void _POSIX_Threads_Sporadic_budget_TSR( ); #include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif #ifdef __cplusplus } diff --git a/cpukit/posix/include/rtems/posix/semaphore.h b/cpukit/posix/include/rtems/posix/semaphore.h index 6a1645eee0..804a8bd0e3 100644 --- a/cpukit/posix/include/rtems/posix/semaphore.h +++ b/cpukit/posix/include/rtems/posix/semaphore.h @@ -185,9 +185,6 @@ int _POSIX_Semaphore_Translate_core_semaphore_return_code( ); #include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif #ifdef __cplusplus } diff --git a/cpukit/posix/preinstall.am b/cpukit/posix/preinstall.am index 5531e7c852..aeaf59f589 100644 --- a/cpukit/posix/preinstall.am +++ b/cpukit/posix/preinstall.am @@ -8,10 +8,20 @@ endif PREINSTALL_DIRS = DISTCLEANFILES = $(PREINSTALL_DIRS) +all-local: $(TMPINSTALL_FILES) + +TMPINSTALL_FILES = +CLEANFILES = $(TMPINSTALL_FILES) + all-am: $(PREINSTALL_FILES) PREINSTALL_FILES = -CLEANFILES = $(PREINSTALL_FILES) +CLEANFILES += $(PREINSTALL_FILES) + +$(PROJECT_LIB)/$(dirstamp): + @$(MKDIR_P) $(PROJECT_LIB) + @: > $(PROJECT_LIB)/$(dirstamp) +PREINSTALL_DIRS += $(PROJECT_LIB)/$(dirstamp) $(PROJECT_INCLUDE)/$(dirstamp): @$(MKDIR_P) $(PROJECT_INCLUDE) @@ -19,6 +29,10 @@ $(PROJECT_INCLUDE)/$(dirstamp): PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp) if LIBPOSIX +$(PROJECT_LIB)/libposix.a: libposix.a $(PROJECT_LIB)/$(dirstamp) + $(INSTALL_DATA) $< $(PROJECT_LIB)/libposix.a +TMPINSTALL_FILES += $(PROJECT_LIB)/libposix.a + if HAS_PTHREADS $(PROJECT_INCLUDE)/sched.h: include/sched.h $(PROJECT_INCLUDE)/$(dirstamp) $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/sched.h diff --git a/cpukit/posix/src/conddestroy.c b/cpukit/posix/src/conddestroy.c index ae9cbcde92..7fbc4158cb 100644 --- a/cpukit/posix/src/conddestroy.c +++ b/cpukit/posix/src/conddestroy.c @@ -46,23 +46,6 @@ int pthread_cond_destroy( ); _POSIX_Condition_variables_Free( the_cond ); - -#if defined(RTEMS_MULTIPROCESSING) - if ( the_cond->process_shared == PTHREAD_PROCESS_SHARED ) { - - _Objects_MP_Close( - &_POSIX_Condition_variables_Information, - the_cond->Object.id - ); - - _POSIX_Condition_variables_MP_Send_process_packet( - POSIX_CONDITION_VARIABLES_MP_ANNOUNCE_DELETE, - the_cond->Object.id, - 0, /* Not used */ - 0 /* Not used */ - ); - } -#endif _Thread_Enable_dispatch(); return 0; diff --git a/cpukit/posix/src/mutexdestroy.c b/cpukit/posix/src/mutexdestroy.c index 27ccbd9e3c..f6bcaaa0d5 100644 --- a/cpukit/posix/src/mutexdestroy.c +++ b/cpukit/posix/src/mutexdestroy.c @@ -12,9 +12,6 @@ #include #include #include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif #include #include #include @@ -47,31 +44,9 @@ int pthread_mutex_destroy( _Objects_Close( &_POSIX_Mutex_Information, &the_mutex->Object ); - _CORE_mutex_Flush( - &the_mutex->Mutex, -#if defined(RTEMS_MULTIPROCESSING) - _POSIX_Mutex_MP_Send_object_was_deleted, -#else - NULL, -#endif - EINVAL - ); + _CORE_mutex_Flush( &the_mutex->Mutex, NULL, EINVAL ); _POSIX_Mutex_Free( the_mutex ); - -#if defined(RTEMS_MULTIPROCESSING) - if ( the_mutex->process_shared == PTHREAD_PROCESS_SHARED ) { - - _Objects_MP_Close( &_POSIX_Mutex_Information, the_mutex->Object.id ); - - _POSIX_Mutex_MP_Send_process_packet( - POSIX_MUTEX_MP_ANNOUNCE_DELETE, - the_mutex->Object.id, - 0, /* Not used */ - 0 /* Not used */ - ); - } -#endif _Thread_Enable_dispatch(); return 0; diff --git a/cpukit/posix/src/mutexinit.c b/cpukit/posix/src/mutexinit.c index a743874d42..9751c00179 100644 --- a/cpukit/posix/src/mutexinit.c +++ b/cpukit/posix/src/mutexinit.c @@ -13,9 +13,6 @@ #include #include #include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif #include #include #include @@ -132,16 +129,6 @@ int pthread_mutex_init( return EAGAIN; } -#if defined(RTEMS_MULTIPROCESSING) - if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED && - !( _Objects_MP_Allocate_and_open( &_POSIX_Mutex_Information, 0, - the_mutex->Object.id, FALSE ) ) ) { - _POSIX_Mutex_Free( the_mutex ); - _Thread_Enable_dispatch(); - return EAGAIN; - } -#endif - the_mutex->process_shared = the_attr->process_shared; the_mutex_attr = &the_mutex->Mutex.Attributes; @@ -169,16 +156,6 @@ int pthread_mutex_init( *mutex = the_mutex->Object.id; -#if defined(RTEMS_MULTIPROCESSING) - if ( the_attr->process_shared == PTHREAD_PROCESS_SHARED ) - _POSIX_Mutex_MP_Send_process_packet( - POSIX_MUTEX_MP_ANNOUNCE_CREATE, - the_mutex->Object.id, - 0, /* Name not used */ - 0 /* Not used */ - ); -#endif - _Thread_Enable_dispatch(); return 0; } diff --git a/cpukit/posix/src/mutexsetprioceiling.c b/cpukit/posix/src/mutexsetprioceiling.c index e50c053522..877ae45f70 100644 --- a/cpukit/posix/src/mutexsetprioceiling.c +++ b/cpukit/posix/src/mutexsetprioceiling.c @@ -12,9 +12,6 @@ #include #include #include -#if defined(RTEMS_MULTIPROCESSING) -#include -#endif #include #include #include @@ -62,11 +59,7 @@ int pthread_mutex_setprioceiling( _CORE_mutex_Surrender( &the_mutex->Mutex, the_mutex->Object.id, -#if defined(RTEMS_MULTIPROCESSING) - _POSIX_Threads_mutex_MP_support -#else NULL -#endif ); _Thread_Enable_dispatch(); return 0; diff --git a/cpukit/posix/src/mutexunlock.c b/cpukit/posix/src/mutexunlock.c index 2323dee66d..1c38d427b9 100644 --- a/cpukit/posix/src/mutexunlock.c +++ b/cpukit/posix/src/mutexunlock.c @@ -41,11 +41,7 @@ int pthread_mutex_unlock( status = _CORE_mutex_Surrender( &the_mutex->Mutex, the_mutex->Object.id, -#if defined(RTEMS_MULTIPROCESSING) - _POSIX_Threads_mutex_MP_support -#else NULL -#endif ); _Thread_Enable_dispatch(); return _POSIX_Mutex_Translate_core_mutex_return_code( status ); diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h index 2ae661a5ad..4f7cb1887a 100644 --- a/cpukit/sapi/include/confdefs.h +++ b/cpukit/sapi/include/confdefs.h @@ -52,7 +52,9 @@ extern "C" { extern rtems_initialization_tasks_table Initialization_tasks[]; extern rtems_driver_address_table Device_drivers[]; extern rtems_configuration_table Configuration; -extern rtems_multiprocessing_table Multiprocessing_configuration; +#if defined(RTEMS_MULTIPROCESSING) + extern rtems_multiprocessing_table Multiprocessing_configuration; +#endif #ifdef RTEMS_POSIX_API extern posix_api_configuration_table Configuration_POSIX_API; #endif @@ -176,6 +178,62 @@ extern int rtems_telnetd_maximum_ptys; #endif #endif +/* + * Idle task body configuration + * + * There is a default IDLE thread body provided by RTEMS which + * has the possibility of being CPU specific. There may be a + * BSP specific override of the RTEMS default body and in turn, + * the application may override and provide its own. + */ +#ifndef CONFIGURE_IDLE_TASK_BODY + #ifdef BSP_IDLE_TASK_BODY + #define CONFIGURE_IDLE_TASK_BODY BSP_IDLE_TASK_BODY + #else + #define CONFIGURE_IDLE_TASK_BODY NULL + #endif +#endif + +/* + * Idle task stack size configuration + * + * By default, the IDLE task will have a stack of minimum size. + * The BSP or application may override this value. + */ +#ifndef CONFIGURE_IDLE_TASK_STACK_SIZE + #ifdef BSP_IDLE_TASK_STACK_SIZE + #define CONFIGURE_IDLE_TASK_STACK_SIZE BSP_IDLE_TASK_STACK_SIZE + #else + #define CONFIGURE_IDLE_TASK_STACK_SIZE RTEMS_MINIMUM_STACK_SIZE + #endif +#endif + +/* + * Task stack allocator configuration + */ + +#ifndef CONFIGURE_TASK_STACK_ALLOCATOR + #define CONFIGURE_TASK_STACK_ALLOCATOR NULL +#endif + +#ifndef CONFIGURE_TASK_STACK_DEALLOCATOR + #define CONFIGURE_TASK_STACK_DEALLOCATOR NULL +#endif + +/* + * Should the RTEMS Workspace and C Program Heap be cleared automatically + * at system start up? + */ + +#ifndef CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY + #ifdef BSP_ZERO_WORKSPACE_AUTOMATICALLY + #define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY \ + BSP_ZERO_WORKSPACE_AUTOMATICALLY + #else + #define CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY FALSE + #endif +#endif + /* * Default User Initialization Task Table. This table guarantees that * one user initialization table is defined. @@ -399,6 +457,8 @@ int rtems_bdbuf_configuration_size =( sizeof(rtems_bdbuf_configuration) #endif /* CONFIGURE_INIT */ #endif /* CONFIGURE_HAS_OWN_BDBUF_TABLE */ #endif /* CONFIGURE_APPLICATION_NEEDS_LIBBLOCK */ + +#if defined(RTEMS_MULTIPROCESSING) /* * Default Multiprocessing Configuration Table. The defaults are * appropriate for most of the RTEMS Multiprocessor Test Suite. Each @@ -448,6 +508,7 @@ rtems_multiprocessing_table Multiprocessing_configuration = { #define CONFIGURE_MULTIPROCESSING_TABLE NULL #endif /* CONFIGURE_MP_APPLICATION */ +#endif /* RTEMS_MULTIPROCESSING */ /* * Default Configuration Table. @@ -1178,17 +1239,24 @@ itron_api_configuration_table Configuration_ITRON_API = { rtems_configuration_table Configuration = { CONFIGURE_EXECUTIVE_RAM_WORK_AREA, - CONFIGURE_EXECUTIVE_RAM_SIZE, + CONFIGURE_EXECUTIVE_RAM_SIZE, /* required RTEMS workspace */ CONFIGURE_MAXIMUM_USER_EXTENSIONS + CONFIGURE_NEWLIB_EXTENSION + - CONFIGURE_STACK_CHECKER_EXTENSION, - CONFIGURE_MICROSECONDS_PER_TICK, - CONFIGURE_TICKS_PER_TIMESLICE, - CONFIGURE_MAXIMUM_DRIVERS, - CONFIGURE_NUMBER_OF_DRIVERS, /* number of device drivers */ + CONFIGURE_STACK_CHECKER_EXTENSION, /* maximum user extensions */ + CONFIGURE_MICROSECONDS_PER_TICK, /* microseconds per clock tick */ + CONFIGURE_TICKS_PER_TIMESLICE, /* ticks per timeslice quantum */ + CONFIGURE_IDLE_TASK_BODY, /* user's IDLE task */ + CONFIGURE_IDLE_TASK_STACK_SIZE, /* IDLE task stack size */ + CONFIGURE_TASK_STACK_ALLOCATOR, /* stack allocator */ + CONFIGURE_TASK_STACK_DEALLOCATOR, /* stack deallocator */ + CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY, /* true to clear memory */ + CONFIGURE_MAXIMUM_DRIVERS, /* maximum device drivers */ + CONFIGURE_NUMBER_OF_DRIVERS, /* static device drivers */ Device_drivers, /* pointer to driver table */ CONFIGURE_NUMBER_OF_INITIAL_EXTENSIONS, /* number of initial extensions */ CONFIGURE_INITIAL_EXTENSION_TABLE, /* pointer to initial extensions */ +#if defined(RTEMS_MULTIPROCESSING) CONFIGURE_MULTIPROCESSING_TABLE, /* pointer to MP config table */ +#endif &Configuration_RTEMS_API, /* pointer to RTEMS API config */ #ifdef RTEMS_POSIX_API &Configuration_POSIX_API, /* pointer to POSIX API config */ diff --git a/cpukit/sapi/include/rtems/config.h b/cpukit/sapi/include/rtems/config.h index 2a0f5b4bae..6ba5b28804 100644 --- a/cpukit/sapi/include/rtems/config.h +++ b/cpukit/sapi/include/rtems/config.h @@ -69,24 +69,28 @@ typedef void *itron_api_configuration_table; #include #endif +#if defined(RTEMS_MULTIPROCESSING) /* * The following records define the Multiprocessor Configuration * Table. This table defines the multiprocessor system * characteristics which must be known by RTEMS in a multiprocessor * system. */ - typedef struct { - uint32_t node; /* local node number */ - uint32_t maximum_nodes; /* maximum # nodes in system */ - uint32_t maximum_global_objects; /* maximum # global objects */ - uint32_t maximum_proxies; /* maximum # proxies */ -#if defined(RTEMS_MULTIPROCESSING) + uint32_t node; /* local node number */ + uint32_t maximum_nodes; /* maximum # nodes in system */ + uint32_t maximum_global_objects; /* maximum # global objects */ + uint32_t maximum_proxies; /* maximum # proxies */ + + /** The MPCI Receive server is assumed to have a stack of at least + * minimum stack size. This field specifies the amount of extra + * stack this task will be given in bytes. + */ + uint32_t extra_mpci_receive_server_stack; + rtems_mpci_table *User_mpci_table; /* pointer to MPCI table */ -#else - void *User_mpci_table; /* pointer to MPCI table */ -#endif } rtems_multiprocessing_table; +#endif /* * The following records define the Configuration Table. The @@ -99,19 +103,49 @@ typedef struct { * + clock ticks per task timeslice * + required number of each object type for each API configured */ - typedef struct { void *work_space_start; uint32_t work_space_size; uint32_t maximum_extensions; uint32_t microseconds_per_tick; uint32_t ticks_per_timeslice; + + /** This element points to the BSP's optional idle task which may override + * the default one provided with RTEMS. + */ + void (*idle_task)( void ); + + /** This field specifies the size of the IDLE task's stack. If less than or + * equal to the minimum stack size, then the IDLE task will have the minimum + * stack size. + */ + uint32_t idle_task_stack_size; + + /** The BSP may want to provide it's own stack allocation routines. + * In this case, the BSP will provide this stack allocation hook. + */ + void * (*stack_allocate_hook)( uint32_t ); + + /** The BSP may want to provide it's own stack free routines. + * In this case, the BSP will provide this stack free hook. + */ + void (*stack_free_hook)( void *); + + /** If this element is TRUE, then RTEMS will zero the Executive Workspace. + * When this element is FALSE, it is assumed that the BSP or invoking + * environment has ensured that memory was cleared before RTEMS was + * invoked. + */ + boolean do_zero_of_workspace; + uint32_t maximum_drivers; uint32_t number_of_device_drivers; rtems_driver_address_table *Device_driver_table; uint32_t number_of_initial_extensions; rtems_extensions_table *User_extension_table; +#if defined(RTEMS_MULTIPROCESSING) rtems_multiprocessing_table *User_multiprocessing_table; +#endif rtems_api_configuration_table *RTEMS_api_configuration; posix_api_configuration_table *POSIX_api_configuration; itron_api_configuration_table *ITRON_api_configuration; @@ -152,6 +186,13 @@ SAPI_EXTERN rtems_configuration_table *_Configuration_Table; #define rtems_configuration_get_ticks_per_timeslice() \ (_Configuration_Table->ticks_per_timeslice) +/** + * This macro assists in accessing the field which indicates whether + * RTEMS is responsible for zeroing the Executive Workspace. + */ +#define rtems_configuration_get_do_zero_of_workspace() \ + (_Configuration_Table->do_zero_of_workspace) + #define rtems_configuration_get_maximum_devices() \ (_Configuration_Table->maximum_devices) diff --git a/cpukit/sapi/include/rtems/init.h b/cpukit/sapi/include/rtems/init.h index 6de3a22a6d..a0f854d992 100644 --- a/cpukit/sapi/include/rtems/init.h +++ b/cpukit/sapi/include/rtems/init.h @@ -36,6 +36,7 @@ extern "C" { #include #include +#if defined(RTEMS_MULTIPROCESSING) /* * The following defines the default Multiprocessing Configuration * Table. This table is used in a single processor system. @@ -43,6 +44,7 @@ extern "C" { extern const rtems_multiprocessing_table _Initialization_Default_multiprocessing_table; +#endif /* * rtems_initialize_executive_early diff --git a/cpukit/sapi/include/rtems/sptables.h b/cpukit/sapi/include/rtems/sptables.h index a5af70b171..226c9a30fb 100644 --- a/cpukit/sapi/include/rtems/sptables.h +++ b/cpukit/sapi/include/rtems/sptables.h @@ -47,23 +47,24 @@ extern "C" { #include #include +#if defined(RTEMS_MULTIPROCESSING) /* * This is the default Multiprocessing Configuration Table. * It is used in single processor configurations. */ - -#if defined(SAPI_INIT) -const rtems_multiprocessing_table - _Initialization_Default_multiprocessing_table = { - 1, /* local node number */ - 1, /* maximum number nodes in system */ - 0, /* maximum number global objects */ - 0, /* maximum number proxies */ - NULL, /* pointer to MPCI address table */ -}; -#else -extern const rtems_multiprocessing_table - _Initialization_Default_multiprocessing_table; + #if defined(SAPI_INIT) + const rtems_multiprocessing_table + _Initialization_Default_multiprocessing_table = { + 1, /* local node number */ + 1, /* maximum number nodes in system */ + 0, /* maximum number global objects */ + 0, /* maximum number proxies */ + NULL, /* pointer to MPCI address table */ + }; + #else + extern const rtems_multiprocessing_table + _Initialization_Default_multiprocessing_table; + #endif #endif #ifdef __cplusplus diff --git a/cpukit/sapi/src/exinit.c b/cpukit/sapi/src/exinit.c index 452f50708f..c25c5ec173 100644 --- a/cpukit/sapi/src/exinit.c +++ b/cpukit/sapi/src/exinit.c @@ -92,6 +92,21 @@ rtems_interrupt_level rtems_initialize_executive_early( INTERNAL_ERROR_NO_CPU_TABLE ); + /* + * Grab our own copy of the user's CPU table. + */ + _CPU_Table = *cpu_table; + + /* + * Provide pointers just for later convenience. + */ + _Configuration_Table = configuration_table; + + /* + * Initialize any target architecture specific support as early as possible + */ + _CPU_Initialize( cpu_table, _Thread_Dispatch ); + #if defined(RTEMS_MULTIPROCESSING) /* * Initialize the system state based on whether this is an MP system. @@ -111,18 +126,6 @@ rtems_interrupt_level rtems_initialize_executive_early( _System_state_Handler_initialization( FALSE ); #endif - /* - * Grab our own copy of the user's CPU table. - */ - _CPU_Table = *cpu_table; - - /* - * Provide pointers just for later convenience. - */ - _Configuration_Table = configuration_table; - - _CPU_Initialize( cpu_table, _Thread_Dispatch ); - /* * Do this as early as possible to insure no debugging output * is even attempted to be printed. @@ -173,13 +176,13 @@ rtems_interrupt_level rtems_initialize_executive_early( configuration_table->maximum_extensions #if defined(RTEMS_MULTIPROCESSING) , - multiprocessing_table->maximum_proxies + _Configuration_MP_table->maximum_proxies #endif ); #if defined(RTEMS_MULTIPROCESSING) _MPCI_Handler_initialization( - multiprocessing_table->User_mpci_table, + _Configuration_MP_table->User_mpci_table, RTEMS_TIMEOUT ); #endif @@ -220,8 +223,10 @@ rtems_interrupt_level rtems_initialize_executive_early( * Scheduling can properly occur now as long as we avoid dispatching. */ - if ( cpu_table->pretasking_hook ) - (*cpu_table->pretasking_hook)(); + { + extern void bsp_pretasking_hook(void); + bsp_pretasking_hook(); + } #if defined(RTEMS_MULTIPROCESSING) _MPCI_Create_server(); @@ -233,8 +238,10 @@ rtems_interrupt_level rtems_initialize_executive_early( _API_extensions_Run_predriver(); - if ( _CPU_Table.predriver_hook ) - (*_CPU_Table.predriver_hook)(); + { + extern void bsp_predriver_hook(void); + bsp_predriver_hook(); + } /* * Initialize all the device drivers and initialize the MPCI layer. @@ -261,8 +268,10 @@ rtems_interrupt_level rtems_initialize_executive_early( _API_extensions_Run_postdriver(); - if ( _CPU_Table.postdriver_hook ) - (*_CPU_Table.postdriver_hook)(); + { + extern void bsp_postdriver_hook(void); + bsp_postdriver_hook(); + } return bsp_level; } diff --git a/cpukit/score/include/rtems/score/mpci.h b/cpukit/score/include/rtems/score/mpci.h index 18abdaf043..424875fc8e 100644 --- a/cpukit/score/include/rtems/score/mpci.h +++ b/cpukit/score/include/rtems/score/mpci.h @@ -42,16 +42,6 @@ extern "C" { #include #include -/** - * The following constants define the stack size requirements for - * the system threads. - */ -#define MPCI_RECEIVE_SERVER_STACK_SIZE \ - ( STACK_MINIMUM_SIZE + \ - CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK + \ - _CPU_Table.extra_mpci_receive_server_stack \ - ) - /** * The following defines the node number used when a broadcast is desired. */ diff --git a/cpukit/score/include/rtems/system.h b/cpukit/score/include/rtems/system.h index b3a0b915e0..aba744380c 100644 --- a/cpukit/score/include/rtems/system.h +++ b/cpukit/score/include/rtems/system.h @@ -199,7 +199,6 @@ SCORE_EXTERN rtems_cpu_table _CPU_Table; /** This macro assists in accessing the CPU Specific Configuration Table. */ #define rtems_cpu_configuration_get_table() (&_CPU_Table) - /** This macro assists in accessing the pretasking BSP hook. */ #define rtems_cpu_configuration_get_pretasking_hook() \ (_CPU_Table.pretasking_hook) @@ -212,37 +211,10 @@ SCORE_EXTERN rtems_cpu_table _CPU_Table; #define rtems_cpu_configuration_get_postdriver_hook() \ (_CPU_Table.postdriver_hook) -/** This macro assists in accessing the BSP specific IDLE task entry point. */ -#define rtems_cpu_configuration_get_idle_task() \ - (_CPU_Table.idle_task) - -/** - * This macro assists in accessing the field which indicates whether - * RTEMS is responsible for zeroing the Executive Workspace. - */ -#define rtems_cpu_configuration_get_do_zero_of_workspace() \ - (_CPU_Table.do_zero_of_workspace) - -/** This macro assists in accessing the IDLE task stack point size. */ -#define rtems_cpu_configuration_get_idle_task_stack_size() \ - (_CPU_Table.idle_task_stack_size) - /** This macro assists in accessing the interrupt stack size. */ #define rtems_cpu_configuration_get_interrupt_stack_size() \ (_CPU_Table.interrupt_stack_size) -/** This macro assists in accessing the size of the MPCI receiver server. */ -#define rtems_cpu_configuration_get_extra_mpci_receive_server_stack() \ - (_CPU_Table.extra_mpci_receive_server_stack) - -/** This macro assists in accessing the BSP stack allocation hook. */ -#define rtems_cpu_configuration_get_stack_allocate_hook() \ - (_CPU_Table.stack_allocate_hook) - -/** This macro assists in accessing the BSP stack allocation free hook. */ -#define rtems_cpu_configuration_get_stack_free_hook() \ - (_CPU_Table.stack_free_hook) - /** This macro defines the maximum length of a Classic API name. */ #define RTEMS_MAXIMUM_NAME_LENGTH sizeof(rtems_name) diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c index c6cddd86b8..17eb37625f 100644 --- a/cpukit/score/src/mpci.c +++ b/cpukit/score/src/mpci.c @@ -17,12 +17,12 @@ #endif #include -#include -#include #if defined(RTEMS_MULTIPROCESSING) #include #include #endif +#include +#include #include #include #include @@ -31,6 +31,7 @@ #include #include +#include /*PAGE * @@ -112,7 +113,9 @@ void _MPCI_Create_server( void ) &_Thread_Internal_information, _MPCI_Receive_server_tcb, NULL, /* allocate the stack */ - MPCI_RECEIVE_SERVER_STACK_SIZE, + STACK_MINIMUM_SIZE + + CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK + + _Configuration_MP_table->extra_mpci_receive_server_stack, CPU_ALL_TASKS_ARE_FP, PRIORITY_MINIMUM, FALSE, /* no preempt */ diff --git a/cpukit/score/src/thread.c b/cpukit/score/src/thread.c index 8e924c65cf..a8032598d2 100644 --- a/cpukit/score/src/thread.c +++ b/cpukit/score/src/thread.c @@ -29,6 +29,7 @@ #include #include #include +#include /*PAGE * @@ -58,9 +59,8 @@ void _Thread_Handler_initialization( * BOTH stacks hooks must be set or both must be NULL. * Do not allow mixture. */ - - if ( !( ( _CPU_Table.stack_allocate_hook == 0 ) - == ( _CPU_Table.stack_free_hook == 0 ) ) ) + if ( !( (!_Configuration_Table->stack_allocate_hook) + == (!_Configuration_Table->stack_free_hook) ) ) _Internal_error_Occurred( INTERNAL_ERROR_CORE, TRUE, diff --git a/cpukit/score/src/threadcreateidle.c b/cpukit/score/src/threadcreateidle.c index f9d4d21ba9..602fc7840b 100644 --- a/cpukit/score/src/threadcreateidle.c +++ b/cpukit/score/src/threadcreateidle.c @@ -29,6 +29,7 @@ #include #include #include +#include /*PAGE * @@ -60,10 +61,10 @@ void _Thread_Create_idle( void ) idle = (void *) _Thread_Idle_body; #endif - if ( _CPU_Table.idle_task ) - idle = _CPU_Table.idle_task; + if ( _Configuration_Table->idle_task ) + idle = _Configuration_Table->idle_task; - idle_task_stack_size = _CPU_Table.idle_task_stack_size; + idle_task_stack_size = _Configuration_Table->idle_task_stack_size; if ( idle_task_stack_size < STACK_MINIMUM_SIZE ) idle_task_stack_size = STACK_MINIMUM_SIZE; diff --git a/cpukit/score/src/threadstackallocate.c b/cpukit/score/src/threadstackallocate.c index 9cc4da54f8..b0b131bfc8 100644 --- a/cpukit/score/src/threadstackallocate.c +++ b/cpukit/score/src/threadstackallocate.c @@ -29,6 +29,7 @@ #include #include #include +#include /*PAGE * @@ -57,8 +58,8 @@ size_t _Thread_Stack_Allocate( * routine can call the correct deallocation routine. */ - if ( _CPU_Table.stack_allocate_hook ) { - stack_addr = (*_CPU_Table.stack_allocate_hook)( the_stack_size ); + if ( _Configuration_Table->stack_allocate_hook ) { + stack_addr = (*_Configuration_Table->stack_allocate_hook)( the_stack_size ); } else { /* diff --git a/cpukit/score/src/threadstackfree.c b/cpukit/score/src/threadstackfree.c index 305b1eafba..ad23a57de2 100644 --- a/cpukit/score/src/threadstackfree.c +++ b/cpukit/score/src/threadstackfree.c @@ -29,6 +29,7 @@ #include #include #include +#include /* * _Thread_Stack_Free @@ -53,8 +54,10 @@ void _Thread_Stack_Free( * routine properly matches the allocation of the stack. */ - if ( _CPU_Table.stack_free_hook ) - (*_CPU_Table.stack_free_hook)( the_thread->Start.Initial_stack.area ); + if ( _Configuration_Table->stack_free_hook ) + (*_Configuration_Table->stack_free_hook)( + the_thread->Start.Initial_stack.area + ); else _Workspace_Free( the_thread->Start.Initial_stack.area ); } diff --git a/cpukit/score/src/wkspace.c b/cpukit/score/src/wkspace.c index c5cd84abf7..953981c477 100644 --- a/cpukit/score/src/wkspace.c +++ b/cpukit/score/src/wkspace.c @@ -1,11 +1,7 @@ /* * Workspace Handler * - * XXX - * - * NOTE: - * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2007. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -22,6 +18,9 @@ #include #include #include +#include + +#include /* for memset */ /*PAGE * @@ -33,8 +32,6 @@ void _Workspace_Handler_initialization( size_t size ) { - uint32_t *zero_out_array; - uint32_t index; uint32_t memory_available; if ( !starting_address || !_Addresses_Is_aligned( starting_address ) ) @@ -44,12 +41,8 @@ void _Workspace_Handler_initialization( INTERNAL_ERROR_INVALID_WORKSPACE_ADDRESS ); - if ( _CPU_Table.do_zero_of_workspace ) { - for( zero_out_array = (uint32_t *) starting_address, index = 0 ; - index < size / sizeof( uint32_t ) ; - index++ ) - zero_out_array[ index ] = 0; - } + if ( _Configuration_Table->do_zero_of_workspace ) + memset( starting_address, 0, size ); memory_available = _Heap_Initialize( &_Workspace_Area, -- cgit v1.2.3