diff options
author | Daniel Hellstrom <daniel@gaisler.com> | 2014-05-21 09:37:16 +0200 |
---|---|---|
committer | Daniel Hellstrom <daniel@gaisler.com> | 2014-10-06 14:44:44 +0200 |
commit | 5e92a40a38dc65958e56313f3a638cfe20c4b82b (patch) | |
tree | b5a55d61117b8ecde07fd5b7dc78f1af1ac8e28e /c/src/lib/libbsp/sparc/leon3/startup/bspreset.c | |
parent | SPARC: Fatal_halt use source and exit codes (diff) | |
download | rtems-5e92a40a38dc65958e56313f3a638cfe20c4b82b.tar.bz2 |
LEON3: use CPU_Fatal_halt for halt
By removing the bsp_reset() mechanism and instead relying on the
CPU_Fatal_halt() routine SMP and single-core can halt by updating
the _Internal_errors_What_happened structure and set the state to
SYSTEM_STATE_TERMINATED (the generic way). This will be better
for test scripts and debugger that can generically look into why
the OS stopped.
For SMP systems, only the fatal-reporting CPU waits until all other
CPUs are powered down (with a time out of one clock tick). The
reason why a fatal stop happend may be because CPU0 was soft-locked
up so we can never trust that CPU0 should do the halt for us.
Diffstat (limited to '')
-rw-r--r-- | c/src/lib/libbsp/sparc/leon3/startup/bspreset.c | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/c/src/lib/libbsp/sparc/leon3/startup/bspreset.c b/c/src/lib/libbsp/sparc/leon3/startup/bspreset.c deleted file mode 100644 index c642a75623..0000000000 --- a/c/src/lib/libbsp/sparc/leon3/startup/bspreset.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2014 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * <rtems@embedded-brains.de> - * - * 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. - */ - -#include <bsp.h> -#include <bsp/bootcard.h> -#include <leon.h> - -#ifdef RTEMS_SMP - -void bsp_reset(void) -{ - uint32_t self_cpu = rtems_get_current_processor(); - - if (self_cpu == 0) { - volatile struct irqmp_regs *irqmp = LEON3_IrqCtrl_Regs; - - if (irqmp != NULL) { - /* - * Value was choosen to get something in the magnitude of 1ms on a 200MHz - * processor. - */ - uint32_t max_wait = 1234567; - - uint32_t cpu_count = rtems_get_processor_count(); - uint32_t halt_mask = 0; - uint32_t i; - - for (i = 0; i < cpu_count; ++i) { - if (i != self_cpu) { - halt_mask |= UINT32_C(1) << i; - } - } - - /* Wait some time for secondary processors to halt */ - i = 0; - while ((irqmp->mpstat & halt_mask) != halt_mask && i < max_wait) { - ++i; - } - } - - __asm__ volatile ( - "mov 1, %g1\n" - "ta 0\n" - "nop" - ); - } - - leon3_power_down_loop(); -} - -#endif /* RTEMS_SMP */ |