Use linker set for MPCI initialization

Update #2408.
This commit is contained in:
Sebastian Huber
2016-02-03 10:00:57 +01:00
parent 6bf44a581b
commit 8ca372e9b4
14 changed files with 89 additions and 205 deletions
@@ -46,9 +46,6 @@
#include <bsp/vectors.h>
#include <bsp/vpd.h>
/* for RTEMS_VERSION :-( I dont like the preassembled string */
#include <rtems/sptables.h>
#define SHOW_MORE_INIT_SETTINGS
BSP_output_char_function_type BSP_output_char = BSP_output_char_via_serial;
@@ -41,7 +41,6 @@
#include <rtems/bspIo.h>
#include <rtems/counter.h>
#include <rtems/sptables.h>
/*
#define SHOW_MORE_INIT_SETTINGS
-1
View File
@@ -19,7 +19,6 @@ include_rtems_HEADERS += include/rtems/profiling.h
include_rtems_HEADERS += include/rtems/rbheap.h
include_rtems_HEADERS += include/rtems/rbtree.h
include_rtems_HEADERS += include/rtems/scheduler.h
include_rtems_HEADERS += include/rtems/sptables.h
include_rtems_HEADERS += include/rtems/timecounter.h
include_rtems_HEADERS += include/rtems/timespec.h
+9 -2
View File
@@ -260,7 +260,7 @@ extern const rtems_configuration_table Configuration;
/**
* This points to the multiprocessing configuration table.
*/
SAPI_EXTERN rtems_multiprocessing_table *_Configuration_MP_table;
extern rtems_multiprocessing_table *_Configuration_MP_table;
#endif
#if defined(RTEMS_MULTIPROCESSING)
@@ -270,7 +270,14 @@ extern const rtems_configuration_table Configuration;
* This is the RTEMS Multiprocessing Configuration Table expected to
* be generated by confdefs.h.
*/
extern rtems_multiprocessing_table Multiprocessing_configuration;
extern rtems_multiprocessing_table Multiprocessing_configuration;
/*
* This is the default Multiprocessing Configuration Table.
* It is used in single processor configurations.
*/
extern const rtems_multiprocessing_table
_Initialization_Default_multiprocessing_table;
#endif
-9
View File
@@ -36,15 +36,6 @@ 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.
*/
extern const rtems_multiprocessing_table
_Initialization_Default_multiprocessing_table;
#endif
/**
* @brief Initializes the system and starts multitasking.
*
-70
View File
@@ -1,70 +0,0 @@
/**
* @file
*
* @brief Pre-Initialized Tables Used when in a Single Processor Configuration
*
* This include file contains the executive's pre-initialized tables
* used when in a single processor configuration.
*/
/*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.org/license/LICENSE.
*/
#ifndef _RTEMS_SPTABLES_H
#define _RTEMS_SPTABLES_H
#ifdef __cplusplus
extern "C" {
#endif
#include <rtems/config.h>
#include <rtems/fatal.h>
#include <rtems/init.h>
#include <rtems/io.h>
#include <rtems/rtems/intr.h>
#include <rtems/rtems/clock.h>
#include <rtems/rtems/tasks.h>
#include <rtems/rtems/dpmem.h>
#include <rtems/rtems/event.h>
#if defined(RTEMS_MULTIPROCESSING)
#include <rtems/rtems/mp.h>
#endif
#include <rtems/rtems/part.h>
#include <rtems/rtems/ratemon.h>
#include <rtems/rtems/region.h>
#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 */
STACK_MINIMUM_SIZE, /* MPCI receive server stack size */
NULL, /* pointer to MPCI address table */
};
#else
extern const rtems_multiprocessing_table
_Initialization_Default_multiprocessing_table;
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif
-4
View File
@@ -82,10 +82,6 @@ $(PROJECT_INCLUDE)/rtems/scheduler.h: include/rtems/scheduler.h $(PROJECT_INCLUD
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/scheduler.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/scheduler.h
$(PROJECT_INCLUDE)/rtems/sptables.h: include/rtems/sptables.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/sptables.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/sptables.h
$(PROJECT_INCLUDE)/rtems/timecounter.h: include/rtems/timecounter.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/timecounter.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/timecounter.h
+2 -52
View File
@@ -20,11 +20,10 @@
#endif
/*
* SCORE_INIT and SAPI_INIT are defined so all of the super core and
* super API data will be included in this object file.
* SCORE_INIT is defined so all of the super core
* data will be included in this object file.
*/
#define SAPI_INIT
#define SCORE_INIT
#include <rtems/system.h>
@@ -49,8 +48,6 @@
#include <rtems/score/watchdogimpl.h>
#include <rtems/score/wkspace.h>
#include <rtems/sptables.h>
static Objects_Information *
_Internal_Objects[ OBJECTS_INTERNAL_CLASSES_LAST + 1 ];
@@ -76,31 +73,11 @@ static void rtems_initialize_data_structures(void)
* are disabled by boot_card().
*/
#if defined(RTEMS_MULTIPROCESSING)
/*
* Initialize the system state based on whether this is an MP system.
* In an MP configuration, internally we view single processor
* systems as a very restricted multiprocessor system.
*/
_Configuration_MP_table = rtems_configuration_get_user_multiprocessing_table();
if ( _Configuration_MP_table == NULL ) {
_Configuration_MP_table =
(void *)&_Initialization_Default_multiprocessing_table;
} else {
_System_state_Is_multiprocessing = true;
}
#endif
/*
* Initialize any target architecture specific support as early as possible
*/
_CPU_Initialize();
#if defined(RTEMS_MULTIPROCESSING)
_Objects_MP_Handler_early_initialization();
#endif
_Thread_Dispatch_initialization();
_ISR_Handler_initialization();
@@ -115,21 +92,9 @@ static void rtems_initialize_data_structures(void)
_Scheduler_Handler_initialization();
#if defined(RTEMS_MULTIPROCESSING)
_Objects_MP_Handler_initialization();
_MPCI_Handler_initialization( RTEMS_TIMEOUT );
#endif
_SMP_Handler_initialize();
}
static void rtems_initialize_before_drivers(void)
{
#if defined(RTEMS_MULTIPROCESSING)
_MPCI_Create_server();
#endif
}
static void rtems_initialize_device_drivers(void)
{
/*
@@ -146,15 +111,6 @@ static void rtems_initialize_device_drivers(void)
*/
_IO_Initialize_all_drivers();
#if defined(RTEMS_MULTIPROCESSING)
if ( _System_state_Is_multiprocessing ) {
_MPCI_Initialization();
_MPCI_Internal_packets_Send_process_packet(
MPCI_PACKETS_SYSTEM_VERIFY
);
}
#endif
/*
* Run the APIs and BSPs postdriver hooks.
*
@@ -186,12 +142,6 @@ RTEMS_SYSINIT_ITEM(
RTEMS_SYSINIT_ORDER_MIDDLE
);
RTEMS_SYSINIT_ITEM(
rtems_initialize_before_drivers,
RTEMS_SYSINIT_BEFORE_DRIVERS,
RTEMS_SYSINIT_ORDER_MIDDLE
);
RTEMS_SYSINIT_ITEM(
rtems_initialize_device_drivers,
RTEMS_SYSINIT_DEVICE_DRIVERS,
@@ -81,20 +81,6 @@
#define SCORE_EXTERN extern
#endif
/**
* The following ensures that all data is declared in the space
* of the initialization routine for either the Initialization Manager
* or the initialization file for the appropriate API. It is
* referenced as "external" in every other file.
*/
#ifdef SAPI_INIT
#undef SAPI_EXTERN
#define SAPI_EXTERN
#else
#undef SAPI_EXTERN
#define SAPI_EXTERN extern
#endif
/**
* The following (in conjunction with compiler arguments) are used
* to choose between the use of static inline functions and macro
@@ -99,33 +99,6 @@ SCORE_EXTERN Thread_Control *_MPCI_Receive_server_tcb;
SCORE_EXTERN MPCI_Packet_processor
_MPCI_Packet_processors[MP_PACKET_CLASSES_LAST+1];
/**
* @brief Initialize the MPCI handler.
*
* This routine performs the initialization necessary for this handler.
*
* @param[in] timeout_status is the value which should be returned to
* blocking threads when they timeout on a remote operation.
*/
void _MPCI_Handler_initialization(
uint32_t timeout_status
);
/**
* @brief Create the MPCI server thread.
*
* This routine creates the packet receive server used in MP systems.
*/
void _MPCI_Create_server( void );
/**
* @brief Initialize the MPCI driver.
*
* This routine initializes the MPCI driver by
* invoking the user provided MPCI initialization callout.
*/
void _MPCI_Initialization ( void );
/**
* This routine registers the MPCI packet processor for the
* designated object class.
+5 -2
View File
@@ -29,8 +29,10 @@ extern "C" {
#define RTEMS_SYSINIT_BSP_WORK_AREAS 000100
#define RTEMS_SYSINIT_BSP_START 000200
#define RTEMS_SYSINIT_INITIAL_EXTENSIONS 000300
#define RTEMS_SYSINIT_DATA_STRUCTURES 000301
#define RTEMS_SYSINIT_MP_EARLY 000301
#define RTEMS_SYSINIT_DATA_STRUCTURES 000302
#define RTEMS_SYSINIT_CPU_SET 00030d
#define RTEMS_SYSINIT_MP 00030e
#define RTEMS_SYSINIT_USER_EXTENSIONS 000320
#define RTEMS_SYSINIT_CLASSIC_TASKS 000340
#define RTEMS_SYSINIT_CLASSIC_TIMER 000341
@@ -59,13 +61,14 @@ extern "C" {
#define RTEMS_SYSINIT_LIBIO 000400
#define RTEMS_SYSINIT_ROOT_FILESYSTEM 000401
#define RTEMS_SYSINIT_DRVMGR 000500
#define RTEMS_SYSINIT_BEFORE_DRIVERS 000501
#define RTEMS_SYSINIT_MP_SERVER 000501
#define RTEMS_SYSINIT_BSP_PRE_DRIVERS 000600
#define RTEMS_SYSINIT_DRVMGR_LEVEL_1 000700
#define RTEMS_SYSINIT_DEVICE_DRIVERS 000701
#define RTEMS_SYSINIT_DRVMGR_LEVEL_2 000702
#define RTEMS_SYSINIT_DRVMGR_LEVEL_3 000703
#define RTEMS_SYSINIT_DRVMGR_LEVEL_4 000704
#define RTEMS_SYSINIT_MP_FINALIZE 000705
#define RTEMS_SYSINIT_STD_FILE_DESCRIPTORS 000800
/*
+72 -5
View File
@@ -21,30 +21,65 @@
#include <rtems/score/mpciimpl.h>
#include <rtems/score/coresemimpl.h>
#include <rtems/score/interr.h>
#include <rtems/score/objectmp.h>
#include <rtems/score/stackimpl.h>
#include <rtems/score/sysstate.h>
#include <rtems/score/schedulerimpl.h>
#include <rtems/score/threadimpl.h>
#include <rtems/score/threadqimpl.h>
#include <rtems/config.h>
#include <rtems/sysinit.h>
RTEMS_STATIC_ASSERT(
sizeof(MPCI_Internal_packet) <= MP_PACKET_MINIMUM_PACKET_SIZE,
MPCI_Internal_packet
);
rtems_multiprocessing_table *_Configuration_MP_table;
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 */
STACK_MINIMUM_SIZE, /* MPCI receive server stack size */
NULL /* pointer to MPCI address table */
};
/**
* This is the core semaphore which the MPCI Receive Server blocks on.
*/
CORE_semaphore_Control _MPCI_Semaphore;
void _MPCI_Handler_initialization(
uint32_t timeout_status
)
static void _MPCI_Handler_early_initialization( void )
{
/*
* Initialize the system state based on whether this is an MP system.
* In an MP configuration, internally we view single processor
* systems as a very restricted multiprocessor system.
*/
_Configuration_MP_table = rtems_configuration_get_user_multiprocessing_table();
if ( _Configuration_MP_table == NULL ) {
_Configuration_MP_table = RTEMS_DECONST(
rtems_multiprocessing_table *,
&_Initialization_Default_multiprocessing_table
);
} else {
_System_state_Is_multiprocessing = true;
}
_Objects_MP_Handler_early_initialization();
}
static void _MPCI_Handler_initialization( void )
{
CORE_semaphore_Attributes attributes;
MPCI_Control *users_mpci_table;
_Objects_MP_Handler_initialization();
users_mpci_table = _Configuration_MP_table->User_mpci_table;
if ( _System_state_Is_multiprocessing && !users_mpci_table )
@@ -86,7 +121,7 @@ void _MPCI_Handler_initialization(
);
}
void _MPCI_Create_server( void )
static void _MPCI_Create_server( void )
{
Thread_Entry_information entry = {
.adaptor = _Thread_Entry_adaptor_numeric,
@@ -129,7 +164,7 @@ void _MPCI_Create_server( void )
_Thread_Start( _MPCI_Receive_server_tcb, &entry );
}
void _MPCI_Initialization ( void )
static void _MPCI_Initialization( void )
{
(*_MPCI_table->initialization)();
}
@@ -429,4 +464,36 @@ MPCI_Internal_packet *_MPCI_Internal_packets_Get_packet ( void )
return ( (MPCI_Internal_packet *) _MPCI_Get_packet() );
}
static void _MPCI_Finalize( void )
{
if ( _System_state_Is_multiprocessing ) {
_MPCI_Initialization();
_MPCI_Internal_packets_Send_process_packet( MPCI_PACKETS_SYSTEM_VERIFY );
}
}
RTEMS_SYSINIT_ITEM(
_MPCI_Handler_early_initialization,
RTEMS_SYSINIT_MP_EARLY,
RTEMS_SYSINIT_ORDER_MIDDLE
);
RTEMS_SYSINIT_ITEM(
_MPCI_Handler_initialization,
RTEMS_SYSINIT_MP,
RTEMS_SYSINIT_ORDER_MIDDLE
);
RTEMS_SYSINIT_ITEM(
_MPCI_Create_server,
RTEMS_SYSINIT_MP_SERVER,
RTEMS_SYSINIT_ORDER_MIDDLE
);
RTEMS_SYSINIT_ITEM(
_MPCI_Finalize,
RTEMS_SYSINIT_MP_FINALIZE,
RTEMS_SYSINIT_ORDER_MIDDLE
);
/* end of file */
+1 -2
View File
@@ -73,7 +73,6 @@ void print_formula(void);
*
* #include <rtems/copyrt.h>
* #include <rtems/tables.h>
* #include <rtems/sptables.h>
*/
#define HEAP_OVHD 16 /* wasted heap space per task stack */
#define NAME_PTR_SIZE 8 /* size of name and pointer table entries */
@@ -453,7 +452,7 @@ initialized +=
/*copyrt.h*/ (strlen(_Copyright_Notice)+1) +
#if defined(RTEMS_MULTIPROCESSING)
/*sptables.h*/ (sizeof _Initialization_Default_multiprocessing_table) +
(sizeof _Initialization_Default_multiprocessing_table) +
#endif
(strlen(_RTEMS_version)+1);
-13
View File
@@ -128,8 +128,6 @@ typedef enum {
LIBIO_POST,
ROOT_FILESYSTEM_PRE,
ROOT_FILESYSTEM_POST,
BEFORE_DRIVERS_PRE,
BEFORE_DRIVERS_POST,
BSP_PRE_DRIVERS_PRE,
BSP_PRE_DRIVERS_POST,
DEVICE_DRIVERS_PRE,
@@ -580,17 +578,6 @@ LAST(RTEMS_SYSINIT_ROOT_FILESYSTEM)
next_step(ROOT_FILESYSTEM_POST);
}
FIRST(RTEMS_SYSINIT_BEFORE_DRIVERS)
{
/* Omit test of build configuration specific pre and post conditions */
next_step(BEFORE_DRIVERS_PRE);
}
LAST(RTEMS_SYSINIT_BEFORE_DRIVERS)
{
next_step(BEFORE_DRIVERS_POST);
}
FIRST(RTEMS_SYSINIT_BSP_PRE_DRIVERS)
{
/*