[PATCH v2 12/44] config: Add _SMP_Processor_configure_maximum

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Feb 21 10:52:24 UTC 2020


Move the processor maximum configuration constant out of the
configuration table.

Update #3875.
---
 cpukit/include/rtems/confdefs.h  | 12 +++++++-----
 cpukit/include/rtems/config.h    | 14 +++-----------
 cpukit/include/rtems/score/smp.h | 13 +++++++++++++
 3 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 33b1aa67d4..f8a4eb23cf 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -2639,16 +2639,18 @@ struct _reent *__getreent(void)
   const rtems_configuration_table Configuration = {
     #ifdef RTEMS_SMP
       #ifdef _CONFIGURE_SMP_APPLICATION
-        true,
+        true
       #else
-        false,
+        false
       #endif
     #endif
-    #ifdef RTEMS_SMP
-      _CONFIGURE_MAXIMUM_PROCESSORS,
-    #endif
   };
 
+  #ifdef RTEMS_SMP
+    const uint32_t _SMP_Processor_configured_maximum =
+      _CONFIGURE_MAXIMUM_PROCESSORS;
+  #endif
+
   const uintptr_t _Workspace_Size = CONFIGURE_EXECUTIVE_RAM_SIZE;
 
   #ifdef CONFIGURE_UNIFIED_WORK_AREAS
diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
index 6489e4e4e8..5550397623 100644
--- a/cpukit/include/rtems/config.h
+++ b/cpukit/include/rtems/config.h
@@ -30,6 +30,7 @@
 #include <rtems/score/object.h>
 #include <rtems/score/isr.h>
 #include <rtems/score/memory.h>
+#include <rtems/score/smp.h>
 #include <rtems/score/stack.h>
 #include <rtems/score/userextdata.h>
 #include <rtems/score/threadidledata.h>
@@ -86,10 +87,6 @@ typedef struct {
   #ifdef RTEMS_SMP
     bool                         smp_enabled;
   #endif
-
-  #ifdef RTEMS_SMP
-    uint32_t                     maximum_processors;
-  #endif
 } rtems_configuration_table;
 
 /**
@@ -204,13 +201,8 @@ uint32_t rtems_configuration_get_maximum_extensions( void );
  *
  * @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_maximum_processors() \
+        (_SMP_Processor_configured_maximum)
 
 #ifdef __cplusplus
 }
diff --git a/cpukit/include/rtems/score/smp.h b/cpukit/include/rtems/score/smp.h
index 4d6b24ae48..2722fbdcee 100644
--- a/cpukit/include/rtems/score/smp.h
+++ b/cpukit/include/rtems/score/smp.h
@@ -36,6 +36,19 @@ extern "C" {
  * @{
  */
 
+/**
+ * @brief The configured processor maximum.
+ *
+ * In SMP configurations, this constant is defined by the application
+ * configuration via <rtems/confdefs.h>, otherwise it is a compile-time
+ * constant with the value one.
+ */
+#if defined(RTEMS_SMP)
+  extern const uint32_t _SMP_Processor_configured_maximum;
+#else
+  #define _SMP_Processor_configured_maximum 1
+#endif
+
 #if defined( RTEMS_SMP )
   extern uint32_t _SMP_Processor_maximum;
 
-- 
2.16.4



More information about the devel mailing list