[PATCH] score: Add maximum_processors field to config
Sebastian Huber
sebastian.huber at embedded-brains.de
Mon May 13 11:43:59 UTC 2013
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().
---
c/src/lib/libbsp/i386/shared/smp/smp-imps.c | 8 ++++----
c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c | 6 +++---
cpukit/rtems/include/rtems/rtems/smp.h | 4 +---
cpukit/sapi/include/confdefs.h | 13 +++----------
cpukit/sapi/include/rtems/config.h | 11 +++++++++++
cpukit/sapi/src/exinit.c | 2 +-
cpukit/score/src/percpu.c | 2 +-
cpukit/score/src/thread.c | 2 +-
8 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/c/src/lib/libbsp/i386/shared/smp/smp-imps.c b/c/src/lib/libbsp/i386/shared/smp/smp-imps.c
index f1be625..60bb0e6 100644
--- a/c/src/lib/libbsp/i386/shared/smp/smp-imps.c
+++ b/c/src/lib/libbsp/i386/shared/smp/smp-imps.c
@@ -401,7 +401,7 @@ imps_read_config_table(unsigned start, int count)
while (count-- > 0) {
switch (*((unsigned char *)start)) {
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);
} else
imps_num_cpus++;
@@ -428,13 +428,13 @@ imps_read_config_table(unsigned start, int count)
}
start += 8;
}
- if ( imps_num_cpus > rtems_configuration_smp_maximum_processors ) {
+ if ( imps_num_cpus > rtems_configuration_get_maximum_processors() ) {
printk(
"WARNING!! Found more CPUs (%d) than configured for (%d)!!\n",
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;
}
}
diff --git a/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c b/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c
index 1f371bf..a9f4a0e 100644
--- a/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c
+++ b/c/src/lib/libbsp/sparc/leon3/smp/smp_leon3.c
@@ -71,13 +71,13 @@ int bsp_smp_initialize(
printk( "Found %d CPUs\n", found_cpus );
#endif
- if ( found_cpus > rtems_configuration_smp_maximum_processors ) {
+ if ( found_cpus > rtems_configuration_get_maximum_processors() ) {
printk(
"%d CPUs IS MORE THAN CONFIGURED -- ONLY USING %d\n",
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 )
diff --git a/cpukit/rtems/include/rtems/rtems/smp.h b/cpukit/rtems/include/rtems/rtems/smp.h
index e62084c..560381a 100644
--- a/cpukit/rtems/include/rtems/rtems/smp.h
+++ b/cpukit/rtems/include/rtems/rtems/smp.h
@@ -36,8 +36,6 @@ extern "C" {
*/
/**@{*/
-extern uint32_t rtems_configuration_smp_maximum_processors;
-
/**
* @brief Obtain Number of Cores in System
*
@@ -60,7 +58,7 @@ extern uint32_t rtems_configuration_smp_maximum_processors;
* @retval This method returns the number of cores configured.
*/
#define rtems_configuration_get_smp_maximum_processors() \
- (rtems_configuration_smp_maximum_processors)
+ (rtems_configuration_get_maximum_processors())
/**
* @brief Obtain Current Core Number
diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h
index f4b9232..569b7a7 100644
--- a/cpukit/sapi/include/confdefs.h
+++ b/cpukit/sapi/include/confdefs.h
@@ -2372,22 +2372,15 @@ const rtems_libio_helper rtems_fs_init_helper =
#if defined(RTEMS_MULTIPROCESSING)
CONFIGURE_MULTIPROCESSING_TABLE, /* pointer to MP config table */
#endif
+ #ifdef RTEMS_SMP
+ CONFIGURE_SMP_MAXIMUM_PROCESSORS
+ #endif
};
#endif
#endif /* CONFIGURE_HAS_OWN_CONFIGURATION_TABLE */
#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.
*/
diff --git a/cpukit/sapi/include/rtems/config.h b/cpukit/sapi/include/rtems/config.h
index 58d2d92..a426a8e 100644
--- a/cpukit/sapi/include/rtems/config.h
+++ b/cpukit/sapi/include/rtems/config.h
@@ -230,6 +230,9 @@ typedef struct {
#if defined(RTEMS_MULTIPROCESSING)
rtems_multiprocessing_table *User_multiprocessing_table;
#endif
+ #ifdef RTEMS_SMP
+ uint32_t maximum_processors;
+ #endif
} rtems_configuration_table;
/**
@@ -335,6 +338,14 @@ extern const rtems_configuration_table Configuration;
NULL
#endif
+#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() \
(&Configuration_RTEMS_API)
diff --git a/cpukit/sapi/src/exinit.c b/cpukit/sapi/src/exinit.c
index 34e8075..a0abe11 100644
--- a/cpukit/sapi/src/exinit.c
+++ b/cpukit/sapi/src/exinit.c
@@ -164,7 +164,7 @@ void rtems_initialize_data_structures(void)
*/
#if defined(RTEMS_SMP)
_SMP_Processor_count =
- bsp_smp_initialize( rtems_configuration_smp_maximum_processors );
+ bsp_smp_initialize( rtems_configuration_get_maximum_processors() );
#endif
_System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING );
diff --git a/cpukit/score/src/percpu.c b/cpukit/score/src/percpu.c
index 4a93fd8..7027093 100644
--- a/cpukit/score/src/percpu.c
+++ b/cpukit/score/src/percpu.c
@@ -46,7 +46,7 @@
*/
size = rtems_configuration_get_interrupt_stack_size();
_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];
diff --git a/cpukit/score/src/thread.c b/cpukit/score/src/thread.c
index b266d6e..391ea52 100644
--- a/cpukit/score/src/thread.c
+++ b/cpukit/score/src/thread.c
@@ -84,7 +84,7 @@ void _Thread_Handler_initialization(void)
* coupled multiprocessing system, account for the MPCI Server Thread.
*/
#if defined(RTEMS_SMP)
- maximum_internal_threads = rtems_configuration_smp_maximum_processors;
+ maximum_internal_threads = rtems_configuration_get_maximum_processors();
#else
maximum_internal_threads = 1;
#endif
--
1.7.7
More information about the devel
mailing list