summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-01-26 10:11:48 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-02-03 10:00:57 +0100
commit8ca372e9b47319a034a32250e037247e5b3c4c9e (patch)
tree3acf412bf7821e7917a7e2b3ef92838e94a4c8ea /cpukit/score
parentUse linker set for driver manager initialization (diff)
downloadrtems-8ca372e9b47319a034a32250e037247e5b3c4c9e.tar.bz2
Use linker set for MPCI initialization
Update #2408.
Diffstat (limited to 'cpukit/score')
-rw-r--r--cpukit/score/include/rtems/score/basedefs.h14
-rw-r--r--cpukit/score/include/rtems/score/mpciimpl.h27
-rw-r--r--cpukit/score/include/rtems/sysinit.h7
-rw-r--r--cpukit/score/src/mpci.c77
4 files changed, 77 insertions, 48 deletions
diff --git a/cpukit/score/include/rtems/score/basedefs.h b/cpukit/score/include/rtems/score/basedefs.h
index ea7d8c7c91..ef36e293a4 100644
--- a/cpukit/score/include/rtems/score/basedefs.h
+++ b/cpukit/score/include/rtems/score/basedefs.h
@@ -82,20 +82,6 @@
#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
* functions. The static inline implementation allows better
diff --git a/cpukit/score/include/rtems/score/mpciimpl.h b/cpukit/score/include/rtems/score/mpciimpl.h
index 600500ceee..33cb656972 100644
--- a/cpukit/score/include/rtems/score/mpciimpl.h
+++ b/cpukit/score/include/rtems/score/mpciimpl.h
@@ -100,33 +100,6 @@ 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.
*
diff --git a/cpukit/score/include/rtems/sysinit.h b/cpukit/score/include/rtems/sysinit.h
index 925593da1a..37f001ae20 100644
--- a/cpukit/score/include/rtems/sysinit.h
+++ b/cpukit/score/include/rtems/sysinit.h
@@ -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
/*
diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c
index 5944da3a97..051366d4a8 100644
--- a/cpukit/score/src/mpci.c
+++ b/cpukit/score/src/mpci.c
@@ -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 */