diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-12-03 22:23:13 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2007-12-03 22:23:13 +0000 |
commit | 976162a69f6fdfbd2ab507074be7d99a48b4f7f7 (patch) | |
tree | 375dac0660e6845642167a2cba304a6812a33d26 /cpukit/sapi | |
parent | 2007-12-03 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-976162a69f6fdfbd2ab507074be7d99a48b4f7f7.tar.bz2 |
2007-12-03 Joel Sherrill <joel.sherrill@OARcorp.com>
* 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.
Diffstat (limited to 'cpukit/sapi')
-rw-r--r-- | cpukit/sapi/include/confdefs.h | 82 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/config.h | 61 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/init.h | 2 | ||||
-rw-r--r-- | cpukit/sapi/include/rtems/sptables.h | 27 | ||||
-rw-r--r-- | cpukit/sapi/src/exinit.c | 49 |
5 files changed, 171 insertions, 50 deletions
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 @@ -177,6 +179,62 @@ extern int rtems_telnetd_maximum_ptys; #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 <rtems/score/mpci.h> #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 <rtems/config.h> #include <rtems/rtems/intr.h> +#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 <rtems/rtems/signal.h> #include <rtems/rtems/timer.h> +#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. @@ -112,18 +127,6 @@ rtems_interrupt_level rtems_initialize_executive_early( #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; } |