summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2022-09-23 11:05:59 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2023-07-14 12:21:33 +0200
commit1425735738e9476d0fbbe55a4f5efd795d0a0b4d (patch)
treecb538df737febedb7a4273cc74b9ae0b64ad68f0
parente6de385a97c2811d4e249665bb63162b73e74af1 (diff)
bsp/leon3: Simplify shutdown
Do not wait for other processors to halt.
-rw-r--r--bsps/sparc/leon3/start/bspclean.c63
-rw-r--r--spec/build/testsuites/validation/bsps/fatal-sparc-leon3-shutdown.yml3
2 files changed, 4 insertions, 62 deletions
diff --git a/bsps/sparc/leon3/start/bspclean.c b/bsps/sparc/leon3/start/bspclean.c
index d52eb65ecf..0324c45326 100644
--- a/bsps/sparc/leon3/start/bspclean.c
+++ b/bsps/sparc/leon3/start/bspclean.c
@@ -38,48 +38,6 @@
#include <rtems/score/cpuimpl.h>
#include <rtems/score/smpimpl.h>
-#if defined(RTEMS_SMP)
-static void leon3_wait_for_power_down(irqamp *regs)
-{
- uint32_t max_wait;
- uint32_t cpu_self;
- uint32_t cpu_count;
- uint32_t halt_mask;
- uint32_t i;
-
- cpu_count = leon3_get_cpu_count(regs);
-
- if (cpu_count > rtems_configuration_get_maximum_processors()) {
- cpu_count = rtems_configuration_get_maximum_processors();
- }
-
- cpu_self = rtems_scheduler_get_processor();
- halt_mask = 0;
-
- for (i = 0; i < cpu_count; ++i) {
- if (i != cpu_self && _SMP_Should_start_processor(i)) {
- halt_mask |= UINT32_C(1) << i;
- }
- }
-
- /*
- * Wait some time for secondary processors to halt.
- *
- * The value was chosen to get something in the magnitude of 1ms on a 200MHz
- * processor.
- */
-
- max_wait = 1234567;
- i = 0;
-
- while (
- (grlib_load_32(&regs->mpstat) & halt_mask) != halt_mask && i < max_wait
- ) {
- ++i;
- }
-}
-#endif
-
void bsp_fatal_extension(
rtems_fatal_source source,
bool always_set_to_false,
@@ -92,29 +50,12 @@ void bsp_fatal_extension(
(void) level;
#if defined(RTEMS_SMP)
- /*
- * On SMP we must wait for all other CPUs not requesting a fatal halt, they
- * are responding to another CPU's fatal request. These CPUs goes into
- * power-down. The CPU requesting fatal halt waits for the others and then
- * handles the system shutdown via the normal procedure.
- */
if ((source == RTEMS_FATAL_SOURCE_SMP) &&
(code == SMP_FATAL_SHUTDOWN_RESPONSE)) {
leon3_power_down_loop(); /* CPU didn't start shutdown sequence .. */
- } else {
- irqamp *regs;
-
- _SMP_Request_shutdown();
-
- regs = LEON3_IrqCtrl_Regs;
-#if defined(LEON3_IRQAMP_BASE)
- leon3_wait_for_power_down(regs);
-#else
- if (regs != NULL) {
- leon3_wait_for_power_down(regs);
- }
-#endif
}
+
+ _SMP_Request_shutdown();
#endif
#if BSP_PRINT_EXCEPTION_CONTEXT
diff --git a/spec/build/testsuites/validation/bsps/fatal-sparc-leon3-shutdown.yml b/spec/build/testsuites/validation/bsps/fatal-sparc-leon3-shutdown.yml
index c12f447e84..e1a0f32900 100644
--- a/spec/build/testsuites/validation/bsps/fatal-sparc-leon3-shutdown.yml
+++ b/spec/build/testsuites/validation/bsps/fatal-sparc-leon3-shutdown.yml
@@ -11,7 +11,8 @@ enabled-by:
- bsps/sparc/leon3
features: c cprogram
includes: []
-ldflags: []
+ldflags:
+- -Wl,--wrap=_CPU_Fatal_halt
links: []
source:
- testsuites/validation/bsps/tc-fatal-sparc-leon3-shutdown.c