[PATCH 5/5] score: Remove unused default scheduler ops

2021-09-17 Thread Sebastian Huber
If SMP support is enabled and the system has exactly one processor, then
it may use an uniprocessor scheduler.  The ask for help, reconsider help
request, and withdraw node operations can be NULL in this case, since
they are only used if a thread has at least one helping scheduler node.
At least two schedulers are required to get a helping node and each
scheduler involved must own at least one processor.  This is not
possible on a system with exactly one processor.
---
 cpukit/include/rtems/score/scheduler.h| 59 --
 cpukit/score/src/schedulerdefaultaskforhelp.c | 61 ---
 spec/build/cpukit/objsmp.yml  |  1 -
 3 files changed, 13 insertions(+), 108 deletions(-)
 delete mode 100644 cpukit/score/src/schedulerdefaultaskforhelp.c

diff --git a/cpukit/include/rtems/score/scheduler.h 
b/cpukit/include/rtems/score/scheduler.h
index 36fc1fd39c..df9477fbeb 100644
--- a/cpukit/include/rtems/score/scheduler.h
+++ b/cpukit/include/rtems/score/scheduler.h
@@ -400,49 +400,6 @@ Priority_Control _Scheduler_default_Unmap_priority(
 );
 
 #if defined(RTEMS_SMP)
-  /**
-   * @brief Does nothing.
-   *
-   * @param scheduler This parameter is unused.
-   * @param the_thread This parameter is unused.
-   * @param node This parameter is unused.
-   *
-   * @return Always returns false.
-   */
-  bool _Scheduler_default_Ask_for_help(
-const Scheduler_Control *scheduler,
-Thread_Control  *the_thread,
-Scheduler_Node  *node
-  );
-
-  /**
-   * @brief Does nothing.
-   *
-   * @param scheduler This parameter is unused.
-   * @param the_thread This parameter is unused.
-   * @param node This parameter is unused.
-   */
-  void _Scheduler_default_Reconsider_help_request(
-const Scheduler_Control *scheduler,
-Thread_Control  *the_thread,
-Scheduler_Node  *node
-  );
-
-  /**
-   * @brief Does nothing.
-   *
-   * @param scheduler This parameter is unused.
-   * @param the_thread This parameter is unused..
-   * @param node This parameter is unused.
-   * @param next_state This parameter is unused.
-   */
-  void _Scheduler_default_Withdraw_node(
-const Scheduler_Control *scheduler,
-Thread_Control  *the_thread,
-Scheduler_Node  *node,
-Thread_Scheduler_state   next_state
-  );
-
   /**
* @brief Does nothing.
*
@@ -489,12 +446,22 @@ Priority_Control _Scheduler_default_Unmap_priority(
  * schedulers shall implement the operations properly.
  *
  * If SMP support is disabled, the define evaluates to nothing.
+ *
+ * If SMP support is enabled and the system has exactly one processor, then it
+ * may use an uniprocessor scheduler.  The ask for help, reconsider help
+ * request, and withdraw node operations are NULL, since they are only used if
+ * a thread has at least one helping scheduler node.  At least two schedulers
+ * are required to get a helping node and each scheduler involved must own at
+ * least one processor.  This is not possible on a system with exactly one
+ * processor.  The processor add operation is NULL, since there is no other
+ * processor to add.  The processor remove operation is NULL, since the one and
+ * only processor cannot be removed.
  */
 #if defined(RTEMS_SMP)
   #define SCHEDULER_DEFAULT_SMP_OPERATIONS \
-_Scheduler_default_Ask_for_help, \
-_Scheduler_default_Reconsider_help_request, \
-_Scheduler_default_Withdraw_node, \
+NULL, \
+NULL, \
+NULL, \
 _Scheduler_default_Pin_or_unpin_do_nothing, \
 _Scheduler_default_Pin_or_unpin_do_nothing, \
 NULL, \
diff --git a/cpukit/score/src/schedulerdefaultaskforhelp.c 
b/cpukit/score/src/schedulerdefaultaskforhelp.c
deleted file mode 100644
index 17c222eafb..00
--- a/cpukit/score/src/schedulerdefaultaskforhelp.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * @file
- *
- * @ingroup RTEMSScoreScheduler
- *
- * @brief This source file contains the implementation of
- *   _Scheduler_default_Ask_for_help(),
- *   _Scheduler_default_Reconsider_help_request(), and
- *   _Scheduler_default_Withdraw_node().
- */
-
-/*
- * Copyright (c) 2014, 2016 embedded brains GmbH
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include 
-
-bool _Scheduler_default_Ask_for_help(
-  const Scheduler_Control *scheduler,
-  Thread_Control  *the_thread,
-  Scheduler_Node  *node
-)
-{
-  (void) scheduler;
-  (void) the_thread;
-  (void) node;
-
-  return false;
-}
-
-void _Scheduler_default_Reconsider_help_request(
-  const Scheduler_Control *scheduler,
-  Thread_Control  *the_thread,
-  Scheduler_Node  *node
-)
-{
-  (void) scheduler;
-  (void) the_thread;
-  (void) node;
-}
-
-void _Scheduler_default_Withdraw_node(
-  const Scheduler_Control *scheduler,
-  Thread_Control  *the_thread,
-  Scheduler

[PATCH 0/5] SMP related scheduler clean up

2021-09-17 Thread Sebastian Huber
This patch set adds a bit of Doxygen and removes dead code.

Sebastian Huber (5):
  score: SCHEDULER_OPERATION_DEFAULT_ASK_FOR_HELP
  score: SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY
  score: Provide two thread pin/unpin defaults
  score: Ensure only one CPU if required
  score: Remove unused default scheduler ops

 cpukit/include/rtems/score/scheduler.h| 91 +++
 cpukit/include/rtems/score/schedulercbs.h |  4 +-
 cpukit/include/rtems/score/scheduleredf.h |  4 +-
 .../include/rtems/score/schedulerpriority.h   |  4 +-
 .../score/schedulerpriorityaffinitysmp.h  |  4 +-
 .../rtems/score/schedulerprioritysmp.h|  6 +-
 cpukit/include/rtems/score/schedulersimple.h  |  4 +-
 .../include/rtems/score/schedulersimplesmp.h  |  6 +-
 .../include/rtems/score/schedulerstrongapa.h  |  4 +-
 cpukit/include/rtems/score/smpimpl.h  |  3 +-
 cpukit/include/rtems/sysinit.h|  1 +
 cpukit/score/src/schedulerdefaultaskforhelp.c | 61 -
 cpukit/score/src/schedulerdefaultpinunpin.c   | 31 +--
 .../src/schedulerdefaultpinunpindonothing.c   | 73 +++
 spec/build/cpukit/objsmp.yml  |  2 +-
 15 files changed, 171 insertions(+), 127 deletions(-)
 delete mode 100644 cpukit/score/src/schedulerdefaultaskforhelp.c
 create mode 100644 cpukit/score/src/schedulerdefaultpinunpindonothing.c

-- 
2.31.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 1/5] score: SCHEDULER_OPERATION_DEFAULT_ASK_FOR_HELP

2021-09-17 Thread Sebastian Huber
Rename SCHEDULER_OPERATION_DEFAULT_ASK_FOR_HELP in
SCHEDULER_DEFAULT_SMP_OPERATIONS.  Add a Doxygen comment.
---
 cpukit/include/rtems/score/scheduler.h | 15 +--
 cpukit/include/rtems/score/schedulercbs.h  |  2 +-
 cpukit/include/rtems/score/scheduleredf.h  |  2 +-
 cpukit/include/rtems/score/schedulerpriority.h |  2 +-
 cpukit/include/rtems/score/schedulersimple.h   |  2 +-
 5 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/cpukit/include/rtems/score/scheduler.h 
b/cpukit/include/rtems/score/scheduler.h
index da1e030ab8..25b6723efd 100644
--- a/cpukit/include/rtems/score/scheduler.h
+++ b/cpukit/include/rtems/score/scheduler.h
@@ -458,8 +458,19 @@ Priority_Control _Scheduler_default_Unmap_priority(
 Scheduler_Node  *node,
 struct Per_CPU_Control  *cpu
   );
+#endif
 
-  #define SCHEDULER_OPERATION_DEFAULT_ASK_FOR_HELP \
+/**
+ * @brief This define provides a set of default implementations for
+ *   SMP-specific scheduler operations.
+ *
+ * The default implementations are intended for uniprocessor schedulers.  SMP
+ * schedulers shall implement the operations properly.
+ *
+ * If SMP support is disabled, the define evaluates to nothing.
+ */
+#if defined(RTEMS_SMP)
+  #define SCHEDULER_DEFAULT_SMP_OPERATIONS \
 _Scheduler_default_Ask_for_help, \
 _Scheduler_default_Reconsider_help_request, \
 _Scheduler_default_Withdraw_node, \
@@ -468,7 +479,7 @@ Priority_Control _Scheduler_default_Unmap_priority(
 NULL, \
 NULL,
 #else
-  #define SCHEDULER_OPERATION_DEFAULT_ASK_FOR_HELP
+  #define SCHEDULER_DEFAULT_SMP_OPERATIONS
 #endif
 
 /**
diff --git a/cpukit/include/rtems/score/schedulercbs.h 
b/cpukit/include/rtems/score/schedulercbs.h
index e321923c11..396dfc17be 100644
--- a/cpukit/include/rtems/score/schedulercbs.h
+++ b/cpukit/include/rtems/score/schedulercbs.h
@@ -62,7 +62,7 @@ extern "C" {
 _Scheduler_EDF_Update_priority,  /* update priority entry point */ \
 _Scheduler_EDF_Map_priority, /* map priority entry point */ \
 _Scheduler_EDF_Unmap_priority,   /* unmap priority entry point */ \
-SCHEDULER_OPERATION_DEFAULT_ASK_FOR_HELP \
+SCHEDULER_DEFAULT_SMP_OPERATIONS \
 _Scheduler_CBS_Node_initialize,  /* node initialize entry point */ \
 _Scheduler_default_Node_destroy, /* node destroy entry point */ \
 _Scheduler_CBS_Release_job,  /* new period of task */ \
diff --git a/cpukit/include/rtems/score/scheduleredf.h 
b/cpukit/include/rtems/score/scheduleredf.h
index 065b511a14..54b1cd71bc 100644
--- a/cpukit/include/rtems/score/scheduleredf.h
+++ b/cpukit/include/rtems/score/scheduleredf.h
@@ -61,7 +61,7 @@ extern "C" {
 _Scheduler_EDF_Update_priority,  /* update priority entry point */ \
 _Scheduler_EDF_Map_priority, /* map priority entry point */ \
 _Scheduler_EDF_Unmap_priority,   /* unmap priority entry point */ \
-SCHEDULER_OPERATION_DEFAULT_ASK_FOR_HELP \
+SCHEDULER_DEFAULT_SMP_OPERATIONS \
 _Scheduler_EDF_Node_initialize,  /* node initialize entry point */ \
 _Scheduler_default_Node_destroy, /* node destroy entry point */ \
 _Scheduler_EDF_Release_job,  /* new period of task */ \
diff --git a/cpukit/include/rtems/score/schedulerpriority.h 
b/cpukit/include/rtems/score/schedulerpriority.h
index 66b976ef8f..45a312ffaf 100644
--- a/cpukit/include/rtems/score/schedulerpriority.h
+++ b/cpukit/include/rtems/score/schedulerpriority.h
@@ -52,7 +52,7 @@ extern "C" {
 _Scheduler_priority_Update_priority,  /* update priority entry point */ \
 _Scheduler_default_Map_priority,  /* map priority entry point */ \
 _Scheduler_default_Unmap_priority,/* unmap priority entry point */ \
-SCHEDULER_OPERATION_DEFAULT_ASK_FOR_HELP \
+SCHEDULER_DEFAULT_SMP_OPERATIONS \
 _Scheduler_priority_Node_initialize,  /* node initialize entry point */ \
 _Scheduler_default_Node_destroy,  /* node destroy entry point */ \
 _Scheduler_default_Release_job,   /* new period of task */ \
diff --git a/cpukit/include/rtems/score/schedulersimple.h 
b/cpukit/include/rtems/score/schedulersimple.h
index e201890f21..155027f3d3 100644
--- a/cpukit/include/rtems/score/schedulersimple.h
+++ b/cpukit/include/rtems/score/schedulersimple.h
@@ -51,7 +51,7 @@ extern "C" {
 _Scheduler_simple_Update_priority,/* update priority entry point */ \
 _Scheduler_default_Map_priority,  /* map priority entry point */ \
 _Scheduler_default_Unmap_priority,/* unmap priority entry point */ \
-SCHEDULER_OPERATION_DEFAULT_ASK_FOR_HELP \
+SCHEDULER_DEFAULT_SMP_OPERATIONS \
 _Scheduler_default_Node_initialize,   /* node initialize entry point */ \
 _Scheduler_default_Node_destroy,  /* node destroy entry point */ \
 _Scheduler_default_Release_job,   /* new period of task */ \
-- 
2.31.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 4/5] score: Ensure only one CPU if required

2021-09-17 Thread Sebastian Huber
Issue the new fatal SMP error
SMP_FATAL_SCHEDULER_REQUIRES_EXACTLY_ONE_PROCESSOR if the system starts
with not exactly one processor and an uniprocessor scheduler is
configured.
---
 cpukit/include/rtems/score/smpimpl.h  |  3 ++-
 cpukit/include/rtems/sysinit.h|  1 +
 .../src/schedulerdefaultpinunpindonothing.c   | 19 +++
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/cpukit/include/rtems/score/smpimpl.h 
b/cpukit/include/rtems/score/smpimpl.h
index 7c3e777299..e259105084 100644
--- a/cpukit/include/rtems/score/smpimpl.h
+++ b/cpukit/include/rtems/score/smpimpl.h
@@ -72,7 +72,8 @@ typedef enum {
   SMP_FATAL_SHUTDOWN_RESPONSE,
   SMP_FATAL_START_OF_MANDATORY_PROCESSOR_FAILED,
   SMP_FATAL_SCHEDULER_PIN_OR_UNPIN_NOT_SUPPORTED,
-  SMP_FATAL_WRONG_CPU_STATE_TO_PERFORM_JOBS
+  SMP_FATAL_WRONG_CPU_STATE_TO_PERFORM_JOBS,
+  SMP_FATAL_SCHEDULER_REQUIRES_EXACTLY_ONE_PROCESSOR
 } SMP_Fatal_code;
 
 /**
diff --git a/cpukit/include/rtems/sysinit.h b/cpukit/include/rtems/sysinit.h
index 3e85aa9a2b..e3d70230c7 100644
--- a/cpukit/include/rtems/sysinit.h
+++ b/cpukit/include/rtems/sysinit.h
@@ -43,6 +43,7 @@ extern "C" {
 #define RTEMS_SYSINIT_INITIAL_EXTENSIONS 000500
 #define RTEMS_SYSINIT_MP_EARLY   000600
 #define RTEMS_SYSINIT_DATA_STRUCTURES000700
+#define RTEMS_SYSINIT_SCHEDULER  000780
 #define RTEMS_SYSINIT_MP 000800
 #define RTEMS_SYSINIT_USER_EXTENSIONS000900
 #define RTEMS_SYSINIT_CLASSIC_TASKS  000a00
diff --git a/cpukit/score/src/schedulerdefaultpinunpindonothing.c 
b/cpukit/score/src/schedulerdefaultpinunpindonothing.c
index f7bab4f661..f3ecb0b718 100644
--- a/cpukit/score/src/schedulerdefaultpinunpindonothing.c
+++ b/cpukit/score/src/schedulerdefaultpinunpindonothing.c
@@ -39,6 +39,9 @@
 #endif
 
 #include 
+#include 
+#include 
+#include 
 
 void _Scheduler_default_Pin_or_unpin_do_nothing(
   const Scheduler_Control *scheduler,
@@ -52,3 +55,19 @@ void _Scheduler_default_Pin_or_unpin_do_nothing(
   (void) node;
   (void) cpu;
 }
+
+static void _Scheduler_Ensure_exactly_one_processor( void )
+{
+  if ( _SMP_Get_processor_maximum() != 1 ) {
+_Terminate(
+  RTEMS_FATAL_SOURCE_SMP,
+  SMP_FATAL_SCHEDULER_REQUIRES_EXACTLY_ONE_PROCESSOR
+);
+  }
+}
+
+RTEMS_SYSINIT_ITEM(
+  _Scheduler_Ensure_exactly_one_processor,
+  RTEMS_SYSINIT_SCHEDULER,
+  RTEMS_SYSINIT_ORDER_MIDDLE
+);
-- 
2.31.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 2/5] score: SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY

2021-09-17 Thread Sebastian Huber
Rename SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY in
SCHEDULER_DEFAULT_SET_AFFINITY_OPERATION.  Add Doxygen comment.
---
 cpukit/include/rtems/score/scheduler.h   | 16 ++--
 cpukit/include/rtems/score/schedulercbs.h|  2 +-
 cpukit/include/rtems/score/scheduleredf.h|  2 +-
 cpukit/include/rtems/score/schedulerpriority.h   |  2 +-
 .../include/rtems/score/schedulerprioritysmp.h   |  2 +-
 cpukit/include/rtems/score/schedulersimple.h |  2 +-
 cpukit/include/rtems/score/schedulersimplesmp.h  |  2 +-
 7 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/cpukit/include/rtems/score/scheduler.h 
b/cpukit/include/rtems/score/scheduler.h
index 25b6723efd..6cb07c4ff1 100644
--- a/cpukit/include/rtems/score/scheduler.h
+++ b/cpukit/include/rtems/score/scheduler.h
@@ -605,11 +605,23 @@ void _Scheduler_default_Start_idle(
 Scheduler_Node  *node,
 const Processor_mask*affinity
   );
+#endif
 
-  #define SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY \
+/**
+ * @brief This define provides the default implementation for the
+ *   SMP-specific set affinity operation.
+ *
+ * The default implementation _Scheduler_default_Set_affinity() is intended for
+ * uniprocessor schedulers and SMP schedulers which only support an affinity to
+ * all online processors.
+ *
+ * If SMP support is disabled, the define evaluates to nothing.
+ */
+#if defined(RTEMS_SMP)
+  #define SCHEDULER_DEFAULT_SET_AFFINITY_OPERATION \
 , _Scheduler_default_Set_affinity
 #else
-  #define SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY
+  #define SCHEDULER_DEFAULT_SET_AFFINITY_OPERATION
 #endif
 
 /**
diff --git a/cpukit/include/rtems/score/schedulercbs.h 
b/cpukit/include/rtems/score/schedulercbs.h
index 396dfc17be..4b7efc8340 100644
--- a/cpukit/include/rtems/score/schedulercbs.h
+++ b/cpukit/include/rtems/score/schedulercbs.h
@@ -69,7 +69,7 @@ extern "C" {
 _Scheduler_CBS_Cancel_job,   /* cancel period of task */ \
 _Scheduler_default_Tick, /* tick entry point */ \
 _Scheduler_default_Start_idle/* start idle entry point */ \
-SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY \
+SCHEDULER_DEFAULT_SET_AFFINITY_OPERATION \
   }
 
 /* Return values for CBS server. */
diff --git a/cpukit/include/rtems/score/scheduleredf.h 
b/cpukit/include/rtems/score/scheduleredf.h
index 54b1cd71bc..9e643b93eb 100644
--- a/cpukit/include/rtems/score/scheduleredf.h
+++ b/cpukit/include/rtems/score/scheduleredf.h
@@ -68,7 +68,7 @@ extern "C" {
 _Scheduler_EDF_Cancel_job,   /* cancel period of task */ \
 _Scheduler_default_Tick, /* tick entry point */ \
 _Scheduler_default_Start_idle/* start idle entry point */ \
-SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY \
+SCHEDULER_DEFAULT_SET_AFFINITY_OPERATION \
   }
 
 typedef struct {
diff --git a/cpukit/include/rtems/score/schedulerpriority.h 
b/cpukit/include/rtems/score/schedulerpriority.h
index 45a312ffaf..e0991f5e31 100644
--- a/cpukit/include/rtems/score/schedulerpriority.h
+++ b/cpukit/include/rtems/score/schedulerpriority.h
@@ -59,7 +59,7 @@ extern "C" {
 _Scheduler_default_Cancel_job,/* cancel period of task */ \
 _Scheduler_default_Tick,  /* tick entry point */ \
 _Scheduler_default_Start_idle /* start idle entry point */ \
-SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY \
+SCHEDULER_DEFAULT_SET_AFFINITY_OPERATION \
   }
 
 typedef struct {
diff --git a/cpukit/include/rtems/score/schedulerprioritysmp.h 
b/cpukit/include/rtems/score/schedulerprioritysmp.h
index d6ab6f6fdd..80979a36ba 100644
--- a/cpukit/include/rtems/score/schedulerprioritysmp.h
+++ b/cpukit/include/rtems/score/schedulerprioritysmp.h
@@ -103,7 +103,7 @@ typedef struct {
 _Scheduler_default_Cancel_job, \
 _Scheduler_default_Tick, \
 _Scheduler_SMP_Start_idle \
-SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY \
+SCHEDULER_DEFAULT_SET_AFFINITY_OPERATION \
   }
 
 /**
diff --git a/cpukit/include/rtems/score/schedulersimple.h 
b/cpukit/include/rtems/score/schedulersimple.h
index 155027f3d3..63310e9796 100644
--- a/cpukit/include/rtems/score/schedulersimple.h
+++ b/cpukit/include/rtems/score/schedulersimple.h
@@ -58,7 +58,7 @@ extern "C" {
 _Scheduler_default_Cancel_job,/* cancel period of task */ \
 _Scheduler_default_Tick,  /* tick entry point */ \
 _Scheduler_default_Start_idle /* start idle entry point */ \
-SCHEDULER_OPERATION_DEFAULT_GET_SET_AFFINITY \
+SCHEDULER_DEFAULT_SET_AFFINITY_OPERATION \
   }
 
 /**
diff --git a/cpukit/include/rtems/score/schedulersimplesmp.h 
b/cpukit/include/rtems/score/schedulersimplesmp.h
index 6b7e111208..158bea74db 100644
--- a/cpukit/include/rtems/score/schedulersimplesmp.h
+++ b/cpukit/include/rtems/score/schedulersimplesmp.h
@@ -85,7 +85,7 @@ typedef struct {
 _Scheduler_default_Cancel_job, \
 _Scheduler_default_Tick, \
 _Scheduler_SMP_Start_idle \
-SCHEDULER_OPE

[PATCH 3/5] score: Provide two thread pin/unpin defaults

2021-09-17 Thread Sebastian Huber
The uniprocessor schedulers do not support systems with more than more
processors.  So they rivially support thread pinning and thus the
SMP_FATAL_SCHEDULER_PIN_OR_UNPIN_NOT_SUPPORTED cannot happen.

Add a second default implementation for SMP schedulers which do not
support thread pinning.

Change license to BSD-2-Clause according to file history and re-licensing
agreement.

Update #3053.
---
 cpukit/include/rtems/score/scheduler.h| 27 --
 .../score/schedulerpriorityaffinitysmp.h  |  4 +-
 .../rtems/score/schedulerprioritysmp.h|  4 +-
 .../include/rtems/score/schedulersimplesmp.h  |  4 +-
 .../include/rtems/score/schedulerstrongapa.h  |  4 +-
 cpukit/score/src/schedulerdefaultpinunpin.c   | 31 ---
 .../src/schedulerdefaultpinunpindonothing.c   | 54 +++
 spec/build/cpukit/objsmp.yml  |  1 +
 8 files changed, 112 insertions(+), 17 deletions(-)
 create mode 100644 cpukit/score/src/schedulerdefaultpinunpindonothing.c

diff --git a/cpukit/include/rtems/score/scheduler.h 
b/cpukit/include/rtems/score/scheduler.h
index 6cb07c4ff1..36fc1fd39c 100644
--- a/cpukit/include/rtems/score/scheduler.h
+++ b/cpukit/include/rtems/score/scheduler.h
@@ -443,16 +443,37 @@ Priority_Control _Scheduler_default_Unmap_priority(
 Thread_Scheduler_state   next_state
   );
 
+  /**
+   * @brief Does nothing.
+   *
+   * This default implementation for the thread pin or unpin operations should
+   * be used by uniprocessor schedulers if SMP support is enabled.
+   *
+   * @param scheduler This parameter is unused.
+   * @param the_thread This parameter is unused.
+   * @param node This parameter is unused.
+   * @param cpu This parameter is unused.
+   */
+  void _Scheduler_default_Pin_or_unpin_do_nothing(
+const Scheduler_Control *scheduler,
+Thread_Control  *the_thread,
+Scheduler_Node  *node,
+struct Per_CPU_Control  *cpu
+  );
+
   /**
* @brief Does nothing in a single processor system, otherwise a fatal error
* is issued.
*
+   * This default implementation for the thread pin or unpin operations should
+   * be used by SMP schedulers which do not support thread pinning.
+   *
* @param scheduler This parameter is unused.
* @param the_thread This parameter is unused.
* @param node This parameter is unused.
* @param cpu This parameter is unused.
*/
-  void _Scheduler_default_Pin_or_unpin(
+  void _Scheduler_default_Pin_or_unpin_not_supported(
 const Scheduler_Control *scheduler,
 Thread_Control  *the_thread,
 Scheduler_Node  *node,
@@ -474,8 +495,8 @@ Priority_Control _Scheduler_default_Unmap_priority(
 _Scheduler_default_Ask_for_help, \
 _Scheduler_default_Reconsider_help_request, \
 _Scheduler_default_Withdraw_node, \
-_Scheduler_default_Pin_or_unpin, \
-_Scheduler_default_Pin_or_unpin, \
+_Scheduler_default_Pin_or_unpin_do_nothing, \
+_Scheduler_default_Pin_or_unpin_do_nothing, \
 NULL, \
 NULL,
 #else
diff --git a/cpukit/include/rtems/score/schedulerpriorityaffinitysmp.h 
b/cpukit/include/rtems/score/schedulerpriorityaffinitysmp.h
index 772a83f541..01f96c8996 100644
--- a/cpukit/include/rtems/score/schedulerpriorityaffinitysmp.h
+++ b/cpukit/include/rtems/score/schedulerpriorityaffinitysmp.h
@@ -65,8 +65,8 @@ extern "C" {
 _Scheduler_priority_affinity_SMP_Ask_for_help, \
 _Scheduler_priority_affinity_SMP_Reconsider_help_request, \
 _Scheduler_priority_affinity_SMP_Withdraw_node, \
-_Scheduler_default_Pin_or_unpin, \
-_Scheduler_default_Pin_or_unpin, \
+_Scheduler_default_Pin_or_unpin_no_supported, \
+_Scheduler_default_Pin_or_unpin_no_supported, \
 _Scheduler_priority_affinity_SMP_Add_processor, \
 _Scheduler_priority_affinity_SMP_Remove_processor, \
 _Scheduler_priority_affinity_SMP_Node_initialize, \
diff --git a/cpukit/include/rtems/score/schedulerprioritysmp.h 
b/cpukit/include/rtems/score/schedulerprioritysmp.h
index 80979a36ba..591d3f8ca7 100644
--- a/cpukit/include/rtems/score/schedulerprioritysmp.h
+++ b/cpukit/include/rtems/score/schedulerprioritysmp.h
@@ -93,8 +93,8 @@ typedef struct {
 _Scheduler_priority_SMP_Ask_for_help, \
 _Scheduler_priority_SMP_Reconsider_help_request, \
 _Scheduler_priority_SMP_Withdraw_node, \
-_Scheduler_default_Pin_or_unpin, \
-_Scheduler_default_Pin_or_unpin, \
+_Scheduler_default_Pin_or_unpin_no_supported, \
+_Scheduler_default_Pin_or_unpin_no_supported, \
 _Scheduler_priority_SMP_Add_processor, \
 _Scheduler_priority_SMP_Remove_processor, \
 _Scheduler_priority_SMP_Node_initialize, \
diff --git a/cpukit/include/rtems/score/schedulersimplesmp.h 
b/cpukit/include/rtems/score/schedulersimplesmp.h
index 158bea74db..ea4c55af0d 100644
--- a/cpukit/include/rtems/score/schedulersimplesmp.h
+++ b/cpukit/include/rtems/score/schedulersimplesmp.h
@@ -75,8 +75,8 @@ typedef struct {
 _Scheduler_simple_SMP_Ask_for_help, \
   

[PATCH] libtest: Improve T_now_tick()

2021-09-17 Thread Sebastian Huber
The T_now_tick() is a fall back time measurement using the CPU counter
in case no Clock Driver is configured.  Some CPU counter may overflow
during the test execution.  Accumulate the elapsed time to reduce the
chance of CPU counter overflows.
---
 cpukit/libtest/t-test-time.c | 45 
 1 file changed, 45 insertions(+)

diff --git a/cpukit/libtest/t-test-time.c b/cpukit/libtest/t-test-time.c
index 156ceaad1f..c6a43acfc5 100644
--- a/cpukit/libtest/t-test-time.c
+++ b/cpukit/libtest/t-test-time.c
@@ -35,6 +35,7 @@
 #include 
 
 #ifdef __rtems__
+#include 
 #include 
 #include 
 #endif
@@ -231,8 +232,52 @@ T_now_dummy(void)
memory_order_relaxed);
 }
 
+#ifndef __rtems__
 T_time
 T_now_tick(void)
 {
return T_ticks_to_time(T_tick());
 }
+#else /* __rtems__ */
+#if defined(RTEMS_SMP)
+static rtems_interrupt_lock T_time_lock =
+  RTEMS_INTERRUPT_LOCK_INITIALIZER("Test Time Lock");
+#endif
+
+static T_ticks T_tick_last;
+
+static T_time T_tick_time;
+
+static bool T_tick_initialized;
+
+T_time
+T_now_tick(void)
+{
+   rtems_interrupt_lock_context lock_context;
+   T_ticks ticks;
+   T_time now;
+
+   ticks = T_tick();
+
+   rtems_interrupt_lock_acquire(&T_time_lock, &lock_context);
+
+   if (T_tick_initialized) {
+   T_ticks last;
+
+   last = T_tick_last;
+   T_tick_last = ticks;
+
+   now = T_tick_time;
+   now += T_ticks_to_time(ticks - last);
+   T_tick_time = now;
+   } else {
+   T_tick_initialized = true;
+   T_tick_last = ticks;
+   now = 0;
+   }
+
+   rtems_interrupt_lock_release(&T_time_lock, &lock_context);
+
+   return now;
+}
+#endif /* __rtems__ */
-- 
2.31.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH] cpukit/smp: Prevent premature thread dispatch

2021-09-17 Thread Kinsey Moore

On 9/17/2021 00:39, Sebastian Huber wrote:

On 16/09/2021 22:50, Kinsey Moore wrote:

There is currently a narrow window between the CPU state being set to UP
and the dispatch disable flag being set. It is possible to perform a
cross-processor thread dispatch in this window which catches the CPU in
a state which is not actually fully ready for that type of thread
dispatch.

This moves the CPU state change to just before the CPU's first thread
dispatch and later than the dispatch disable flag change which closes
the window for the race condition.
---
  cpukit/score/src/threadstartmultitasking.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpukit/score/src/threadstartmultitasking.c 
b/cpukit/score/src/threadstartmultitasking.c

index 094a535394..0c0951a243 100644
--- a/cpukit/score/src/threadstartmultitasking.c
+++ b/cpukit/score/src/threadstartmultitasking.c
@@ -29,8 +29,6 @@ void _Thread_Start_multitasking( void )
    Thread_Control  *heir;
    #if defined(RTEMS_SMP)
-  _Per_CPU_State_change( cpu_self, PER_CPU_STATE_UP );
-
    /*
 * Threads begin execution in the _Thread_Handler() function.   This
 * function will set the thread dispatch disable level to zero.
@@ -44,6 +42,8 @@ void _Thread_Start_multitasking( void )
    #if defined(RTEMS_SMP)
    _CPU_SMP_Prepare_start_multitasking();
+
+  _Per_CPU_State_change( cpu_self, PER_CPU_STATE_UP );
  #endif
    #if defined(_CPU_Start_multitasking)



For which branch is this patch? The code on the master is different.

I mistakenly sent this patch from the wrong branch.


Which scenario caused a problem here? I guess there is a second bug 
involved, since maskable interrupt should be disabled for this code 
path. How could there be a race condition?


You asked the right questions and you are correct. This was caused by 
interrupts not being disabled when they should be. I thought I had read 
in the ARMv8 spec that interrupts are disabled on startup, but that is 
obviously not the case and I was misremembering information about 
interrupt status on exception. Fixing the interrupt startup status also 
resolved some other test failures I was seeing.


Thanks,

Kinsey

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH RSB v3] Remove automake/autoconf from rtems 6 tools

2021-09-17 Thread Gedare Bloom
this looks right, just test it before pushing :)

On Thu, Sep 16, 2021 at 1:26 PM Joel Sherrill  wrote:
>
> These are unneeded with the waf build system.
>
> Closes #4081.
> ---
>  rtems/config/6/rtems-autotools-base.bset |  9 -
>  rtems/config/6/rtems-autotools-internal.bset | 11 ---
>  rtems/config/6/rtems-autotools.bset  | 25 -
>  rtems/config/6/rtems-default.bset|  2 --
>  rtems/config/6/rtems-microblaze.bset |  2 --
>  5 files changed, 49 deletions(-)
>  delete mode 100644 rtems/config/6/rtems-autotools-base.bset
>  delete mode 100644 rtems/config/6/rtems-autotools-internal.bset
>  delete mode 100644 rtems/config/6/rtems-autotools.bset
>
> diff --git a/rtems/config/6/rtems-autotools-base.bset 
> b/rtems/config/6/rtems-autotools-base.bset
> deleted file mode 100644
> index c6819c1..000
> --- a/rtems/config/6/rtems-autotools-base.bset
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -%define release 1
> -%define rtems_arch none
> -
> -%include 6/rtems-base.bset
> -
> -package: rtems-%{rtems_version}-autotools-%{_host}-%{release}
> -
> -tools/rtems-autoconf-2.69-1
> -tools/rtems-automake-1.12.6-1
> diff --git a/rtems/config/6/rtems-autotools-internal.bset 
> b/rtems/config/6/rtems-autotools-internal.bset
> deleted file mode 100644
> index 19d2f19..000
> --- a/rtems/config/6/rtems-autotools-internal.bset
> +++ /dev/null
> @@ -1,11 +0,0 @@
> -#
> -# Do not use via the command line.
> -#
> -
> -%define _internal_autotools yes
> -%define _disable_collecting yes
> -%define _disable_packaging  yes
> -%define _disable_reporting  yes
> -%define _disable_installing yes
> -
> -%include 6/rtems-autotools-base.bset
> diff --git a/rtems/config/6/rtems-autotools.bset 
> b/rtems/config/6/rtems-autotools.bset
> deleted file mode 100644
> index e57d25d..000
> --- a/rtems/config/6/rtems-autotools.bset
> +++ /dev/null
> @@ -1,25 +0,0 @@
> -#
> -# Autoconf and automake are not relocatable and cannot be cross-compiled.
> -# RTEMS uses autoconf and automake and building RTEMS in the RSB requires
> -# bootstrapping and this requires a current autoconf and automake. The RSB
> -# provides to support by:
> -#
> -#  1. Building and installing autoconf and automake with a prefix to a
> -# temporary internal path.
> -#  2. Using the temporary internal build, build and install another copy
> -# using the final prefix location.
> -#
> -
> -#
> -# A magic internal path that would break if changes in the defaults.mc
> -# macro file are made.
> -#
> -%define _internal_autotools_path %{_tmppath}/sb-%{_uid}/${SB_PREFIX_CLEAN}
> -
> -#
> -# Disable emailing reports of this building for RTEMS.
> -#
> -%define mail_disable
> -
> -6/rtems-autotools-internal
> -6/rtems-autotools-base
> diff --git a/rtems/config/6/rtems-default.bset 
> b/rtems/config/6/rtems-default.bset
> index 1b60066..0c07b08 100644
> --- a/rtems/config/6/rtems-default.bset
> +++ b/rtems/config/6/rtems-default.bset
> @@ -3,8 +3,6 @@
>  #
>  %include 6/rtems-base.bset
>
> -6/rtems-autotools
> -
>  #
>  # Build gdb first to raise the Python install error as early as possible.
>  # GDB needs expat so it needs to be built before.
> diff --git a/rtems/config/6/rtems-microblaze.bset 
> b/rtems/config/6/rtems-microblaze.bset
> index 4b12899..3eb7a89 100644
> --- a/rtems/config/6/rtems-microblaze.bset
> +++ b/rtems/config/6/rtems-microblaze.bset
> @@ -6,8 +6,6 @@
>  #
>  %include 6/rtems-base.bset
>
> -6/rtems-autotools
> -
>  devel/dtc-1.6.0-1
>
>  #
> --
> 1.8.3.1
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH v4] improve the format of error reporting on i386

2021-09-17 Thread Gedare Bloom
Hi Zack,

I think you have also missed Joel's request to add an 8-character
width specifier.

On Thu, Sep 16, 2021 at 6:19 PM zack leung  wrote:
>
> Thread id is now a Hex value. formatting improved for hex values
> Updates #4203
> ---
>  cpukit/score/cpu/i386/cpu.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/cpukit/score/cpu/i386/cpu.c b/cpukit/score/cpu/i386/cpu.c
> index 77b7a7161c..0f17cf0148 100644
> --- a/cpukit/score/cpu/i386/cpu.c
> +++ b/cpukit/score/cpu/i386/cpu.c
> @@ -215,16 +215,16 @@ void _CPU_Exception_frame_print (const
> CPU_Exception_frame *ctx)
>  {
>unsigned int faultAddr = 0;
>printk("--\n");
> -  printk("Exception %" PRIu32 " caught at PC %" PRIx32 " by thread %"
> PRId32 "\n",
> +  printk("Exception %" PRIu32 " caught at PC 0x%" PRIx32 " by thread 0x%"
> PRIx32 "\n",
>   ctx->idtIndex,
>   ctx->eip,
>   _Thread_Executing->Object.id);
>printk("--\n");
>printk("Processor execution context at time of the fault was  :\n");
>printk("--\n");
> -  printk(" EAX = %" PRIx32 "EBX = %" PRIx32 "ECX = %" PRIx32 "
> EDX = %" PRIx32 "\n",
> +  printk(" EAX = 0x%" PRIx32 "EBX = 0x%" PRIx32 "ECX = 0x%" PRIx32
> "EDX = 0x%" PRIx32 "\n",
>   ctx->eax, ctx->ebx, ctx->ecx, ctx->edx);
> -  printk(" ESI = %" PRIx32 "EDI = %" PRIx32 "EBP = %" PRIx32 "
> ESP = %" PRIx32 "\n",
> +  printk(" ESI = 0x%" PRIx32 "EDI = 0x%" PRIx32 "EBP = 0x%" PRIx32
> "ESP = 0x%" PRIx32 "\n",
>   ctx->esi, ctx->edi, ctx->ebp, ctx->esp0);
>printk("--\n");
>printk("Error code pushed by processor itself (if not 0) = %" PRIx32
> "\n",
> --
> 2.33.0
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH RSB v3] Remove automake/autoconf from rtems 6 tools

2021-09-17 Thread Joel Sherrill
Thanks. I will.

Lots of family distractions the past few days. Sorry for screwing it up so
much.

On Fri, Sep 17, 2021, 5:38 PM Gedare Bloom  wrote:

> this looks right, just test it before pushing :)
>
> On Thu, Sep 16, 2021 at 1:26 PM Joel Sherrill  wrote:
> >
> > These are unneeded with the waf build system.
> >
> > Closes #4081.
> > ---
> >  rtems/config/6/rtems-autotools-base.bset |  9 -
> >  rtems/config/6/rtems-autotools-internal.bset | 11 ---
> >  rtems/config/6/rtems-autotools.bset  | 25
> -
> >  rtems/config/6/rtems-default.bset|  2 --
> >  rtems/config/6/rtems-microblaze.bset |  2 --
> >  5 files changed, 49 deletions(-)
> >  delete mode 100644 rtems/config/6/rtems-autotools-base.bset
> >  delete mode 100644 rtems/config/6/rtems-autotools-internal.bset
> >  delete mode 100644 rtems/config/6/rtems-autotools.bset
> >
> > diff --git a/rtems/config/6/rtems-autotools-base.bset
> b/rtems/config/6/rtems-autotools-base.bset
> > deleted file mode 100644
> > index c6819c1..000
> > --- a/rtems/config/6/rtems-autotools-base.bset
> > +++ /dev/null
> > @@ -1,9 +0,0 @@
> > -%define release 1
> > -%define rtems_arch none
> > -
> > -%include 6/rtems-base.bset
> > -
> > -package: rtems-%{rtems_version}-autotools-%{_host}-%{release}
> > -
> > -tools/rtems-autoconf-2.69-1
> > -tools/rtems-automake-1.12.6-1
> > diff --git a/rtems/config/6/rtems-autotools-internal.bset
> b/rtems/config/6/rtems-autotools-internal.bset
> > deleted file mode 100644
> > index 19d2f19..000
> > --- a/rtems/config/6/rtems-autotools-internal.bset
> > +++ /dev/null
> > @@ -1,11 +0,0 @@
> > -#
> > -# Do not use via the command line.
> > -#
> > -
> > -%define _internal_autotools yes
> > -%define _disable_collecting yes
> > -%define _disable_packaging  yes
> > -%define _disable_reporting  yes
> > -%define _disable_installing yes
> > -
> > -%include 6/rtems-autotools-base.bset
> > diff --git a/rtems/config/6/rtems-autotools.bset
> b/rtems/config/6/rtems-autotools.bset
> > deleted file mode 100644
> > index e57d25d..000
> > --- a/rtems/config/6/rtems-autotools.bset
> > +++ /dev/null
> > @@ -1,25 +0,0 @@
> > -#
> > -# Autoconf and automake are not relocatable and cannot be
> cross-compiled.
> > -# RTEMS uses autoconf and automake and building RTEMS in the RSB
> requires
> > -# bootstrapping and this requires a current autoconf and automake. The
> RSB
> > -# provides to support by:
> > -#
> > -#  1. Building and installing autoconf and automake with a prefix to a
> > -# temporary internal path.
> > -#  2. Using the temporary internal build, build and install another copy
> > -# using the final prefix location.
> > -#
> > -
> > -#
> > -# A magic internal path that would break if changes in the defaults.mc
> > -# macro file are made.
> > -#
> > -%define _internal_autotools_path
> %{_tmppath}/sb-%{_uid}/${SB_PREFIX_CLEAN}
> > -
> > -#
> > -# Disable emailing reports of this building for RTEMS.
> > -#
> > -%define mail_disable
> > -
> > -6/rtems-autotools-internal
> > -6/rtems-autotools-base
> > diff --git a/rtems/config/6/rtems-default.bset
> b/rtems/config/6/rtems-default.bset
> > index 1b60066..0c07b08 100644
> > --- a/rtems/config/6/rtems-default.bset
> > +++ b/rtems/config/6/rtems-default.bset
> > @@ -3,8 +3,6 @@
> >  #
> >  %include 6/rtems-base.bset
> >
> > -6/rtems-autotools
> > -
> >  #
> >  # Build gdb first to raise the Python install error as early as
> possible.
> >  # GDB needs expat so it needs to be built before.
> > diff --git a/rtems/config/6/rtems-microblaze.bset
> b/rtems/config/6/rtems-microblaze.bset
> > index 4b12899..3eb7a89 100644
> > --- a/rtems/config/6/rtems-microblaze.bset
> > +++ b/rtems/config/6/rtems-microblaze.bset
> > @@ -6,8 +6,6 @@
> >  #
> >  %include 6/rtems-base.bset
> >
> > -6/rtems-autotools
> > -
> >  devel/dtc-1.6.0-1
> >
> >  #
> > --
> > 1.8.3.1
> >
> > ___
> > devel mailing list
> > devel@rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH v4] improve the format of error reporting on i386

2021-09-17 Thread zack leung
Where am i missing it?

Zack

On Fri, 17 Sept 2021 at 23:15, Gedare Bloom  wrote:

> Hi Zack,
>
> I think you have also missed Joel's request to add an 8-character
> width specifier.
>
> On Thu, Sep 16, 2021 at 6:19 PM zack leung 
> wrote:
> >
> > Thread id is now a Hex value. formatting improved for hex values
> > Updates #4203
> > ---
> >  cpukit/score/cpu/i386/cpu.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/cpukit/score/cpu/i386/cpu.c b/cpukit/score/cpu/i386/cpu.c
> > index 77b7a7161c..0f17cf0148 100644
> > --- a/cpukit/score/cpu/i386/cpu.c
> > +++ b/cpukit/score/cpu/i386/cpu.c
> > @@ -215,16 +215,16 @@ void _CPU_Exception_frame_print (const
> > CPU_Exception_frame *ctx)
> >  {
> >unsigned int faultAddr = 0;
> >
> printk("--\n");
> > -  printk("Exception %" PRIu32 " caught at PC %" PRIx32 " by thread %"
> > PRId32 "\n",
> > +  printk("Exception %" PRIu32 " caught at PC 0x%" PRIx32 " by thread
> 0x%"
> > PRIx32 "\n",
> >   ctx->idtIndex,
> >   ctx->eip,
> >   _Thread_Executing->Object.id);
> >
> printk("--\n");
> >printk("Processor execution context at time of the fault was  :\n");
> >
> printk("--\n");
> > -  printk(" EAX = %" PRIx32 "EBX = %" PRIx32 "ECX = %" PRIx32 "
> > EDX = %" PRIx32 "\n",
> > +  printk(" EAX = 0x%" PRIx32 "EBX = 0x%" PRIx32 "ECX = 0x%"
> PRIx32
> > "EDX = 0x%" PRIx32 "\n",
> >   ctx->eax, ctx->ebx, ctx->ecx, ctx->edx);
> > -  printk(" ESI = %" PRIx32 "EDI = %" PRIx32 "EBP = %" PRIx32 "
> > ESP = %" PRIx32 "\n",
> > +  printk(" ESI = 0x%" PRIx32 "EDI = 0x%" PRIx32 "EBP = 0x%"
> PRIx32
> > "ESP = 0x%" PRIx32 "\n",
> >   ctx->esi, ctx->edi, ctx->ebp, ctx->esp0);
> >
> printk("--\n");
> >printk("Error code pushed by processor itself (if not 0) = %" PRIx32
> > "\n",
> > --
> > 2.33.0
> > ___
> > devel mailing list
> > devel@rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] powerpc/motorola_powerpc: Map LibBSD bus space to the PCI base address

2021-09-17 Thread chrisj
From: Chris Johns 

---
 bsps/powerpc/motorola_powerpc/include/bsp.h | 32 +++--
 1 file changed, 29 insertions(+), 3 deletions(-)

diff --git a/bsps/powerpc/motorola_powerpc/include/bsp.h 
b/bsps/powerpc/motorola_powerpc/include/bsp.h
index af0e71471e..7d362bf406 100644
--- a/bsps/powerpc/motorola_powerpc/include/bsp.h
+++ b/bsps/powerpc/motorola_powerpc/include/bsp.h
@@ -31,11 +31,11 @@
 #include 
 #include 
 #include 
-  
+
 #ifdef qemu
 #include 
 #endif
-  
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -118,7 +118,33 @@ extern "C" {
 /*
  * The BSP has PCI devices. Enable support in LibBSD.
  */
-#define BSP_HAS_PCI
+#define BSP_HAS_PC_PCI
+
+/*
+ * Remap the PCI address space for LibBSD
+ */
+#define RTEMS_BSP_PCI_IO_REGION_BASE  0
+#define RTEMS_BSP_PCI_MEM_REGION_BASE PCI_DRAM_OFFSET
+
+/*
+ * Remap the PCI address space for LibBSD
+ */
+#define RTEMS_BSP_ADDR_PTR(_type) uint ## _type ## _t __volatile*
+#define RTEMS_BSP_ADDR_CPTR(_type) const RTEMS_BSP_ADDR_PTR(_type)
+#define RTEMS_BSP_ADDRESS_READ(_addr, _type) \
+   *((RTEMS_BSP_ADDR_CPTR(_type)) (((RTEMS_BSP_ADDR_CPTR(8)) _addr) + 
PCI_DRAM_OFFSET))
+#define RTEMS_BSP_ADDRESS_WRITE(_addr, _val, _type) \
+   *((RTEMS_BSP_ADDR_PTR(_type)) (((RTEMS_BSP_ADDR_PTR(8)) _addr) + 
PCI_DRAM_OFFSET)) = (_val)
+
+#define RTEMS_BSP_READ_1(_addr) RTEMS_BSP_ADDRESS_READ(_addr, 8)
+#define RTEMS_BSP_READ_2(_addr) RTEMS_BSP_ADDRESS_READ(_addr, 16)
+#define RTEMS_BSP_READ_4(_addr) RTEMS_BSP_ADDRESS_READ(_addr, 32)
+#define RTEMS_BSP_READ_8(_addr) RTEMS_BSP_ADDRESS_READ(_addr, 64)
+
+#define RTEMS_BSP_WRITE_1(_addr, _val) RTEMS_BSP_ADDRESS_WRITE(_addr, _val, 8)
+#define RTEMS_BSP_WRITE_2(_addr, _val) RTEMS_BSP_ADDRESS_WRITE(_addr, _val, 16)
+#define RTEMS_BSP_WRITE_4(_addr, _val) RTEMS_BSP_ADDRESS_WRITE(_addr, _val, 32)
+#define RTEMS_BSP_WRITE_8(_addr, _val) RTEMS_BSP_ADDRESS_WRITE(_addr, _val, 64)
 
 /*
  *  Base address definitions for several devices
-- 
2.24.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] libcsupport/mount: Return the error correctly

2021-09-17 Thread chrisj
From: Chris Johns 

Closes #4507
---
 cpukit/libcsupport/src/mount.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cpukit/libcsupport/src/mount.c b/cpukit/libcsupport/src/mount.c
index a4f6423c03..2caa8099c1 100644
--- a/cpukit/libcsupport/src/mount.c
+++ b/cpukit/libcsupport/src/mount.c
@@ -219,6 +219,8 @@ int mount(
 
 if ( rv != 0 ) {
   free( mt_entry );
+  errno = rv;
+  rv = -1;
 }
   } else {
 errno = ENOMEM;
-- 
2.24.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel