From 1425735738e9476d0fbbe55a4f5efd795d0a0b4d Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 23 Sep 2022 11:05:59 +0200 Subject: bsp/leon3: Simplify shutdown Do not wait for other processors to halt. --- bsps/sparc/leon3/start/bspclean.c | 63 +--------------------- .../validation/bsps/fatal-sparc-leon3-shutdown.yml | 3 +- 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 #include -#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(®s->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 -- cgit v1.2.3