config: Add _MPCI_Configuration

Replace the user MPCI configuration table with a system provided
_MPCI_Configuration.

Update #3735.
This commit is contained in:
Sebastian Huber
2019-12-13 08:35:17 +01:00
parent a00dff42cf
commit 24f8915a07
14 changed files with 99 additions and 118 deletions
+1 -1
View File
@@ -433,7 +433,7 @@ struct shm_config_info {
typedef struct shm_config_info shm_config_table;
#define SHM_MAXIMUM_NODES Multiprocessing_configuration.maximum_nodes
#define SHM_MAXIMUM_NODES _MPCI_Configuration.maximum_nodes
/* global variables */
+1
View File
@@ -1064,6 +1064,7 @@ librtemscpu_a_SOURCES += rtems/src/semmp.c
librtemscpu_a_SOURCES += rtems/src/signalmp.c
librtemscpu_a_SOURCES += rtems/src/taskmp.c
librtemscpu_a_SOURCES += score/src/mpci.c
librtemscpu_a_SOURCES += score/src/mpcidefault.c
librtemscpu_a_SOURCES += score/src/objectmp.c
librtemscpu_a_SOURCES += score/src/threadmp.c
+9 -7
View File
@@ -1842,7 +1842,15 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
#endif
#ifdef CONFIGURE_INIT
rtems_multiprocessing_table Multiprocessing_configuration = {
#if CONFIGURE_MP_NODE_NUMBER < 1
#error "CONFIGURE_MP_NODE_NUMBER must be greater than or equal to one"
#endif
#if CONFIGURE_MP_NODE_NUMBER > CONFIGURE_MP_MAXIMUM_NODES
#error "CONFIGURE_MP_NODE_NUMBER must be less than or equal to CONFIGURE_MP_MAXIMUM_NODES"
#endif
const MPCI_Configuration _MPCI_Configuration = {
CONFIGURE_MP_NODE_NUMBER, /* local node number */
CONFIGURE_MP_MAXIMUM_NODES, /* maximum # nodes */
CONFIGURE_MP_MAXIMUM_GLOBAL_OBJECTS, /* maximum # global objects */
@@ -1852,11 +1860,8 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
};
#endif
#define CONFIGURE_MULTIPROCESSING_TABLE &Multiprocessing_configuration
#define _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT 1
#else
#define CONFIGURE_MULTIPROCESSING_TABLE NULL
#define _CONFIGURE_MPCI_RECEIVE_SERVER_COUNT 0
#endif /* CONFIGURE_MP_APPLICATION */
#else
@@ -2878,9 +2883,6 @@ struct _reent *__getreent(void)
false,
#endif
#endif
#if defined(RTEMS_MULTIPROCESSING)
CONFIGURE_MULTIPROCESSING_TABLE, /* pointer to MP config table */
#endif
#ifdef RTEMS_SMP
_CONFIGURE_MAXIMUM_PROCESSORS,
#endif
+3 -60
View File
@@ -35,7 +35,7 @@
#include <rtems/posix/config.h>
#include <rtems/extension.h>
#if defined(RTEMS_MULTIPROCESSING)
#include <rtems/score/mpci.h>
#include <rtems/rtems/types.h>
#endif
#ifdef __cplusplus
@@ -53,35 +53,6 @@ extern "C" {
#define rtems_resource_maximum_per_allocation(resource) \
_Objects_Maximum_per_allocation(resource)
#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 {
/** This is the local node number. */
uint32_t node;
/** This is the maximum number of nodes in system. */
uint32_t maximum_nodes;
/** This is the maximum number of global objects. */
uint32_t maximum_global_objects;
/** This is the maximum number of proxies. */
uint32_t 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;
/** This is a pointer to User/BSP provided MPCI Table. */
rtems_mpci_table *User_mpci_table;
} rtems_multiprocessing_table;
#endif
/**
* @brief Task stack allocator initialization hook.
*
@@ -206,9 +177,6 @@ typedef struct {
bool smp_enabled;
#endif
#if defined(RTEMS_MULTIPROCESSING)
rtems_multiprocessing_table *User_multiprocessing_table;
#endif
#ifdef RTEMS_SMP
uint32_t maximum_processors;
#endif
@@ -219,31 +187,6 @@ typedef struct {
*/
extern const rtems_configuration_table Configuration;
#if defined(RTEMS_MULTIPROCESSING)
/**
* This points to the multiprocessing configuration table.
*/
extern rtems_multiprocessing_table *_Configuration_MP_table;
#endif
#if defined(RTEMS_MULTIPROCESSING)
/**
* @brief RTEMS multiprocessing configuration table.
*
* This is the RTEMS Multiprocessing Configuration Table expected to
* be generated by confdefs.h.
*/
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
/*
* Some handy macros to avoid dependencies on either the BSP
* or the exact format of the configuration table.
@@ -308,10 +251,10 @@ uint32_t rtems_configuration_get_maximum_extensions( void );
#if defined(RTEMS_MULTIPROCESSING)
#define rtems_configuration_get_user_multiprocessing_table() \
(Configuration.User_multiprocessing_table)
(&_MPCI_Configuration)
#else
#define rtems_configuration_get_user_multiprocessing_table() \
NULL
NULL
#endif
/**
+5
View File
@@ -221,6 +221,11 @@ typedef MPCI_Entry rtems_mpci_entry;
*/
typedef MPCI_Control rtems_mpci_table;
/**
* @brief Structure which is used to configure an MPCI handler.
*/
typedef MPCI_Configuration rtems_multiprocessing_table;
#endif
/** @} */
+34
View File
@@ -128,6 +128,40 @@ typedef struct {
MPCI_receive_entry receive_packet;
} MPCI_Control;
/*
* 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 {
/** This is the local node number. */
uint32_t node;
/** This is the maximum number of nodes in system. */
uint32_t maximum_nodes;
/** This is the maximum number of global objects. */
uint32_t maximum_global_objects;
/** This is the maximum number of proxies. */
uint32_t 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;
/** This is a pointer to User/BSP provided MPCI Table. */
MPCI_Control *User_mpci_table;
} MPCI_Configuration;
/**
* @brief The MPCI configuration.
*
* Provided by the application via <rtems/confdefs.h>.
*/
extern const MPCI_Configuration _MPCI_Configuration;
/** @} */
#ifdef __cplusplus
+1 -2
View File
@@ -360,8 +360,7 @@ void rtems_monitor_node_cmd(
}
if ((new_node >= 1) &&
_Configuration_MP_table &&
(new_node <= _Configuration_MP_table->maximum_nodes))
(new_node <= _MPCI_Configuration.maximum_nodes))
rtems_monitor_default_node = new_node;
}
#endif
+4 -11
View File
@@ -28,13 +28,10 @@ rtems_monitor_mpci_canonical(
const void *config_void
)
{
const rtems_configuration_table *c = &Configuration;
rtems_multiprocessing_table *m;
rtems_mpci_table *mt;
const rtems_multiprocessing_table *m;
const rtems_mpci_table *mt;
m = c->User_multiprocessing_table;
if (m == 0)
return;
m = rtems_configuration_get_user_multiprocessing_table();
mt = m->User_mpci_table;
canonical_mpci->node = m->node;
@@ -70,19 +67,15 @@ rtems_monitor_mpci_next(
rtems_id *next_id
)
{
const rtems_configuration_table *c = &Configuration;
int n = rtems_object_id_get_index(*next_id);
if (n >= 1)
goto failed;
if ( ! c->User_multiprocessing_table)
goto failed;
_Objects_Allocator_lock();
*next_id += 1;
return (void *) c;
return &Configuration;
failed:
*next_id = RTEMS_OBJECT_ID_FINAL;
+2 -2
View File
@@ -221,9 +221,9 @@ rtems_monitor_server_init(
rtems_status_code status;
if (_System_state_Is_multiprocessing &&
(_Configuration_MP_table->maximum_nodes > 1))
(_MPCI_Configuration.maximum_nodes > 1))
{
uint32_t maximum_nodes = _Configuration_MP_table->maximum_nodes;
uint32_t maximum_nodes = _MPCI_Configuration.maximum_nodes;
/*
* create the msg que our server will listen
+3 -23
View File
@@ -27,7 +27,6 @@
#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(
@@ -39,18 +38,6 @@ RTEMS_STATIC_ASSERT(
bool _System_state_Is_multiprocessing;
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.
*/
@@ -72,14 +59,7 @@ static void _MPCI_Handler_early_initialization( void )
* 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 {
if ( _MPCI_Configuration.maximum_nodes > 1 ) {
_System_state_Is_multiprocessing = true;
}
@@ -92,7 +72,7 @@ static void _MPCI_Handler_initialization( void )
_Objects_MP_Handler_initialization();
users_mpci_table = _Configuration_MP_table->User_mpci_table;
users_mpci_table = _MPCI_Configuration.User_mpci_table;
if ( _System_state_Is_multiprocessing && !users_mpci_table )
_Internal_error( INTERNAL_ERROR_NO_MPCI );
@@ -152,7 +132,7 @@ static void _MPCI_Create_server( void )
NULL, /* allocate the stack */
_Stack_Minimum() +
CPU_MPCI_RECEIVE_SERVER_EXTRA_STACK +
_Configuration_MP_table->extra_mpci_receive_server_stack,
_MPCI_Configuration.extra_mpci_receive_server_stack,
CPU_ALL_TASKS_ARE_FP,
PRIORITY_PSEUDO_ISR,
false, /* no preempt */
+31
View File
@@ -0,0 +1,31 @@
/**
* @file
*
* @brief Multiprocessing Communications Interface (MPCI) Default Configuration
* @ingroup RTEMSScoreMPCI
*/
/*
* COPYRIGHT (c) 1989-2014.
* 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.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/score/mpci.h>
#include <rtems/score/stack.h>
const MPCI_Configuration _MPCI_Configuration = {
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 */
};
+3 -3
View File
@@ -161,8 +161,8 @@ void _Objects_MP_Handler_early_initialization(void)
uint32_t node;
uint32_t maximum_nodes;
node = _Configuration_MP_table->node;
maximum_nodes = _Configuration_MP_table->maximum_nodes;
node = _MPCI_Configuration.node;
maximum_nodes = _MPCI_Configuration.maximum_nodes;
if ( node < 1 || node > maximum_nodes )
_Internal_error( INTERNAL_ERROR_INVALID_NODE );
@@ -175,7 +175,7 @@ void _Objects_MP_Handler_initialization( void )
{
uint32_t maximum_global_objects;
maximum_global_objects = _Configuration_MP_table->maximum_global_objects;
maximum_global_objects = _MPCI_Configuration.maximum_global_objects;
_Objects_MP_Maximum_global_objects = maximum_global_objects;
+1 -1
View File
@@ -62,7 +62,7 @@ void _Thread_Handler_initialization(void)
rtems_configuration_get_stack_allocate_init_hook();
#if defined(RTEMS_MULTIPROCESSING)
uint32_t maximum_proxies =
_Configuration_MP_table->maximum_proxies;
_MPCI_Configuration.maximum_proxies;
#endif
if ( rtems_configuration_get_stack_allocate_hook() == NULL ||
+1 -8
View File
@@ -250,10 +250,7 @@ uninitialized =
/*clock.h*/ 0 +
/*config.h*/
#if defined(RTEMS_MULTIPROCESSING)
(sizeof _Configuration_MP_table) +
#endif
/*config.h*/ 0 +
/*context.h*/ (sizeof _Thread_Dispatch_necessary) +
@@ -433,10 +430,6 @@ uninitialized += (sizeof _CPU_Interrupt_stack_low) +
initialized +=
/*copyrt.h*/ (strlen(_Copyright_Notice)+1) +
#if defined(RTEMS_MULTIPROCESSING)
(sizeof _Initialization_Default_multiprocessing_table) +
#endif
(strlen(_RTEMS_version)+1);