smp: Add maximum_processors field to config

Delete rtems_configuration_get_smp_maximum_processors().  Delete
rtems_configuration_smp_maximum_processors variable.  Add
maximum_processors field to rtems_configuration_table if RTEMS_SMP is
defined.  Add rtems_configuration_get_maximum_processors().
This commit is contained in:
Sebastian Huber
2013-05-13 13:37:06 +02:00
parent 12c99a6476
commit 6c2eedc7dd
9 changed files with 32 additions and 42 deletions

View File

@@ -401,7 +401,7 @@ imps_read_config_table(unsigned start, int count)
while (count-- > 0) { while (count-- > 0) {
switch (*((unsigned char *)start)) { switch (*((unsigned char *)start)) {
case IMPS_BCT_PROCESSOR: case IMPS_BCT_PROCESSOR:
if ( imps_num_cpus < rtems_configuration_smp_maximum_processors ) { if ( imps_num_cpus < rtems_configuration_get_maximum_processors() ) {
add_processor((imps_processor *)start); add_processor((imps_processor *)start);
} else } else
imps_num_cpus++; imps_num_cpus++;
@@ -428,13 +428,13 @@ imps_read_config_table(unsigned start, int count)
} }
start += 8; start += 8;
} }
if ( imps_num_cpus > rtems_configuration_smp_maximum_processors ) { if ( imps_num_cpus > rtems_configuration_get_maximum_processors() ) {
printk( printk(
"WARNING!! Found more CPUs (%d) than configured for (%d)!!\n", "WARNING!! Found more CPUs (%d) than configured for (%d)!!\n",
imps_num_cpus - 1, imps_num_cpus - 1,
rtems_configuration_smp_maximum_processors rtems_configuration_get_maximum_processors()
); );
imps_num_cpus = rtems_configuration_smp_maximum_processors; imps_num_cpus = rtems_configuration_get_maximum_processors();
return; return;
} }
} }

View File

@@ -71,13 +71,13 @@ int bsp_smp_initialize(
printk( "Found %d CPUs\n", found_cpus ); printk( "Found %d CPUs\n", found_cpus );
#endif #endif
if ( found_cpus > rtems_configuration_smp_maximum_processors ) { if ( found_cpus > rtems_configuration_get_maximum_processors() ) {
printk( printk(
"%d CPUs IS MORE THAN CONFIGURED -- ONLY USING %d\n", "%d CPUs IS MORE THAN CONFIGURED -- ONLY USING %d\n",
found_cpus, found_cpus,
rtems_configuration_smp_maximum_processors rtems_configuration_get_maximum_processors()
); );
found_cpus = rtems_configuration_smp_maximum_processors; found_cpus = rtems_configuration_get_maximum_processors();
} }
if ( found_cpus == 1 ) if ( found_cpus == 1 )

View File

@@ -36,8 +36,6 @@ extern "C" {
*/ */
/**@{*/ /**@{*/
extern uint32_t rtems_configuration_smp_maximum_processors;
/** /**
* @brief Obtain Number of Cores in System * @brief Obtain Number of Cores in System
* *
@@ -50,18 +48,6 @@ extern uint32_t rtems_configuration_smp_maximum_processors;
#define rtems_smp_get_number_of_processors() \ #define rtems_smp_get_number_of_processors() \
(_SMP_Processor_count) (_SMP_Processor_count)
/**
* @brief Obtain Maximum Cores Configured
*
* This method returns the number of CPU cores that were configured
* in the system. The actual number of cores will always be less than
* or equal to the number of maximum number of cores which were configured.
*
* @retval This method returns the number of cores configured.
*/
#define rtems_configuration_get_smp_maximum_processors() \
(rtems_configuration_smp_maximum_processors)
/** /**
* @brief Obtain Current Core Number * @brief Obtain Current Core Number
* *

View File

@@ -2360,22 +2360,15 @@ const rtems_libio_helper rtems_fs_init_helper =
#if defined(RTEMS_MULTIPROCESSING) #if defined(RTEMS_MULTIPROCESSING)
CONFIGURE_MULTIPROCESSING_TABLE, /* pointer to MP config table */ CONFIGURE_MULTIPROCESSING_TABLE, /* pointer to MP config table */
#endif #endif
#ifdef RTEMS_SMP
CONFIGURE_SMP_MAXIMUM_PROCESSORS
#endif
}; };
#endif #endif
#endif /* CONFIGURE_HAS_OWN_CONFIGURATION_TABLE */ #endif /* CONFIGURE_HAS_OWN_CONFIGURATION_TABLE */
#if defined(RTEMS_SMP) #if defined(RTEMS_SMP)
/**
* Instantiate the variable which specifies the number of CPUs
* in an SMP configuration.
*/
#if defined(CONFIGURE_INIT)
uint32_t rtems_configuration_smp_maximum_processors = \
CONFIGURE_SMP_MAXIMUM_PROCESSORS;
#else
extern uint32_t rtems_configuration_smp_maximum_processors;
#endif
/* /*
* Instantiate the Per CPU information based upon the user configuration. * Instantiate the Per CPU information based upon the user configuration.
*/ */

View File

@@ -230,6 +230,9 @@ typedef struct {
#if defined(RTEMS_MULTIPROCESSING) #if defined(RTEMS_MULTIPROCESSING)
rtems_multiprocessing_table *User_multiprocessing_table; rtems_multiprocessing_table *User_multiprocessing_table;
#endif #endif
#ifdef RTEMS_SMP
uint32_t maximum_processors;
#endif
} rtems_configuration_table; } rtems_configuration_table;
/** /**
@@ -335,6 +338,22 @@ extern const rtems_configuration_table Configuration;
NULL NULL
#endif #endif
/**
* @brief Returns the configured maximum count of processors.
*
* The actual number of processors available for the application will be less
* than or equal to the configured maximum count of processors.
*
* @return The configured maximum count of processors.
*/
#ifdef RTEMS_SMP
#define rtems_configuration_get_maximum_processors() \
(Configuration.maximum_processors)
#else
#define rtems_configuration_get_maximum_processors() \
1
#endif
#define rtems_configuration_get_rtems_api_configuration() \ #define rtems_configuration_get_rtems_api_configuration() \
(&Configuration_RTEMS_API) (&Configuration_RTEMS_API)

View File

@@ -164,7 +164,7 @@ void rtems_initialize_data_structures(void)
*/ */
#if defined(RTEMS_SMP) #if defined(RTEMS_SMP)
_SMP_Processor_count = _SMP_Processor_count =
bsp_smp_initialize( rtems_configuration_smp_maximum_processors ); bsp_smp_initialize( rtems_configuration_get_maximum_processors() );
#endif #endif
_System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING ); _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );

View File

@@ -48,14 +48,6 @@ extern "C" {
#ifndef ASM #ifndef ASM
/**
* @brief Maximum number of CPUs in SMP system.
*
* This variable is set during the SMP initialization sequence to
* indicate the Maximum number of CPUs in this system.
*/
extern uint32_t rtems_configuration_smp_maximum_processors;
/** /**
* @brief Initialize secondary CPUs. * @brief Initialize secondary CPUs.
* *

View File

@@ -46,7 +46,7 @@
*/ */
size = rtems_configuration_get_interrupt_stack_size(); size = rtems_configuration_get_interrupt_stack_size();
_Per_CPU_Information_p[0] = &_Per_CPU_Information[0]; _Per_CPU_Information_p[0] = &_Per_CPU_Information[0];
for (cpu=1 ; cpu < rtems_configuration_smp_maximum_processors; cpu++ ) { for (cpu=1 ; cpu < rtems_configuration_get_maximum_processors(); cpu++ ) {
Per_CPU_Control *p = &_Per_CPU_Information[cpu]; Per_CPU_Control *p = &_Per_CPU_Information[cpu];

View File

@@ -84,7 +84,7 @@ void _Thread_Handler_initialization(void)
* coupled multiprocessing system, account for the MPCI Server Thread. * coupled multiprocessing system, account for the MPCI Server Thread.
*/ */
#if defined(RTEMS_SMP) #if defined(RTEMS_SMP)
maximum_internal_threads = rtems_configuration_smp_maximum_processors; maximum_internal_threads = rtems_configuration_get_maximum_processors();
#else #else
maximum_internal_threads = 1; maximum_internal_threads = 1;
#endif #endif