powerpc: Remove _BSP_Fatal_error()

BSPs can use the bsp_fatal_extension() to provide BSP-specific fatal
error handling.  There is no need for a _BSP_Fatal_error().

Close #3246.
This commit is contained in:
Sebastian Huber
2017-11-21 12:00:49 +01:00
parent 1c193a26d2
commit 07d96453a9
23 changed files with 13 additions and 274 deletions

View File

@@ -58,7 +58,6 @@ libbsp_a_SOURCES =
libbsp_a_SOURCES += startup/bspstart.c \ libbsp_a_SOURCES += startup/bspstart.c \
../shared/motorola/vpd.c startup/bspreset.c startup/i2c_init.c \ ../shared/motorola/vpd.c startup/bspreset.c startup/i2c_init.c \
../../powerpc/shared/startup/panic.c \
../../powerpc/shared/startup/bspgetworkarea.c \ ../../powerpc/shared/startup/bspgetworkarea.c \
../../powerpc/shared/startup/probeMemEnd.c \ ../../powerpc/shared/startup/probeMemEnd.c \
../../powerpc/shared/startup/bsppredriverhook.c \ ../../powerpc/shared/startup/bsppredriverhook.c \

View File

@@ -112,12 +112,6 @@ uint32_t bsp_time_base_frequency;
/* Legacy */ /* Legacy */
uint32_t bsp_clicks_per_usec; uint32_t bsp_clicks_per_usec;
void _BSP_Fatal_error(unsigned int v)
{
printk("%s PANIC ERROR %x\n",_RTEMS_version, v);
__asm__ __volatile ("sc");
}
void bsp_start(void) void bsp_start(void)
{ {
/* /*

View File

@@ -51,20 +51,6 @@ static int mpc83xx_decrementer_exception_handler( BSP_Exception_frame *frame, un
return 0; return 0;
} }
void _BSP_Fatal_error(unsigned n)
{
rtems_interrupt_level level;
rtems_interrupt_disable( level);
(void) level;
printk( "%s PANIC ERROR %u\n", rtems_get_version_string(), n);
while (1) {
/* Do nothing */
}
}
void bsp_start( void) void bsp_start( void)
{ {
rtems_status_code sc = RTEMS_SUCCESSFUL; rtems_status_code sc = RTEMS_SUCCESSFUL;

View File

@@ -200,16 +200,3 @@ void bsp_start( void )
*/ */
BSP_rtems_irq_mng_init(0); BSP_rtems_irq_mng_init(0);
} }
static void BSP_ask_for_reset(void)
{
printk("system stopped, press RESET");
while(1) {};
}
void _BSP_Fatal_error(unsigned int v)
{
printk("%s FATAL ERROR %x\n",_RTEMS_version, v);
BSP_ask_for_reset();
}

View File

@@ -49,18 +49,6 @@ unsigned int bsp_clock_speed = 0;
uint32_t bsp_clicks_per_usec = 0; uint32_t bsp_clicks_per_usec = 0;
void _BSP_Fatal_error(unsigned n)
{
rtems_interrupt_level level;
(void) level;
rtems_interrupt_disable( level);
while (true) {
mpc55xx_wait_for_interrupt();
}
}
static void null_pointer_protection(void) static void null_pointer_protection(void)
{ {
#ifdef MPC55XX_NULL_POINTER_PROTECTION #ifdef MPC55XX_NULL_POINTER_PROTECTION

View File

@@ -103,14 +103,6 @@ static void _BSP_GPLED1_off(void)
csr->bcsr0 |= GP1_LED; /* Turn off GP1 LED */ csr->bcsr0 |= GP1_LED; /* Turn off GP1 LED */
} }
void _BSP_Fatal_error(unsigned int v)
{
_BSP_GPLED0_on();
_BSP_GPLED1_on();
printk("%s PANIC ERROR %x\n",_RTEMS_version, v);
__asm__ __volatile ("sc");
}
static void _BSP_Uart1_enable(void) static void _BSP_Uart1_enable(void)
{ {
BCSR *csr; BCSR *csr;

View File

@@ -105,12 +105,6 @@ int i;
BSP_output_char_function_type BSP_output_char = BSP_output_char_via_serial; BSP_output_char_function_type BSP_output_char = BSP_output_char_via_serial;
BSP_polling_getchar_function_type BSP_poll_char = NULL; BSP_polling_getchar_function_type BSP_poll_char = NULL;
void _BSP_Fatal_error(unsigned int v)
{
printk("\n%s PANIC ERROR %x\n",_RTEMS_version, v);
__asm__ __volatile ("sc");
}
char *rtems_progname; char *rtems_progname;
/* /*

View File

@@ -111,12 +111,6 @@ static unsigned char ConfVPD_buff[200];
static char cmdline_buf[CMDLINE_BUF_SIZE]; static char cmdline_buf[CMDLINE_BUF_SIZE];
char *BSP_commandline_string = cmdline_buf; char *BSP_commandline_string = cmdline_buf;
void _BSP_Fatal_error(unsigned int v)
{
printk("%s PANIC ERROR %x\n",_RTEMS_version, v);
__asm__ __volatile ("sc");
}
/* NOTE: we cannot simply malloc the commandline string; /* NOTE: we cannot simply malloc the commandline string;
* save_boot_params() is called during a very early stage when * save_boot_params() is called during a very early stage when
* libc/malloc etc. are not yet initialized! * libc/malloc etc. are not yet initialized!

View File

@@ -60,12 +60,6 @@ unsigned int BSP_time_base_divisor;
extern unsigned long __rtems_end[]; extern unsigned long __rtems_end[];
void _BSP_Fatal_error(unsigned int v)
{
printk("%s PANIC ERROR %x\n",_RTEMS_version, v);
__asm__ __volatile ("sc");
}
/* /*
* bsp_start * bsp_start
* *

View File

@@ -34,7 +34,7 @@ startup_SOURCES = ../../shared/bspclean.c \
../../shared/bootcard.c ../../shared/sbrk.c \ ../../shared/bootcard.c ../../shared/sbrk.c \
../../shared/getentropy-cpucounter.c \ ../../shared/getentropy-cpucounter.c \
../../shared/gnatinstallhandler.c \ ../../shared/gnatinstallhandler.c \
startup/cmain.c startup/bspstart.c startup/bsppanic.c startup/cmain.c startup/bspstart.c
# pclock # pclock
# clock_SOURCES = ../../shared/clock_driver_simidle.c # clock_SOURCES = ../../shared/clock_driver_simidle.c
clock_SOURCES = ../shared/clock/clock.c clock_SOURCES = ../shared/clock/clock.c

View File

@@ -1,14 +0,0 @@
#include <rtems.h>
#include <rtems/bspIo.h>
static void
__outb(int port, unsigned char v)
{
*((volatile unsigned char *)(0x80000000 + port)) = v;
}
void _BSP_Fatal_error(unsigned int v)
{
printk("%s PANIC ERROR %x\n",_RTEMS_version, v);
__outb (0x92, 0x01);
}

View File

@@ -52,20 +52,6 @@ uint32_t bsp_time_base_frequency;
uint32_t qoriq_clock_frequency; uint32_t qoriq_clock_frequency;
void _BSP_Fatal_error(unsigned n)
{
rtems_interrupt_level level;
rtems_interrupt_local_disable(level);
(void) level;
printk("%s PANIC ERROR %u\n", rtems_get_version_string(), n);
while (1) {
/* Do nothing */
}
}
static void initialize_frequency_parameters(void) static void initialize_frequency_parameters(void)
{ {
const void *fdt = bsp_fdt_get(); const void *fdt = bsp_fdt_get();

View File

@@ -84,15 +84,6 @@ unsigned int BSP_processor_frequency;
*/ */
unsigned int BSP_time_base_divisor; unsigned int BSP_time_base_divisor;
void _BSP_Fatal_error(unsigned int v)
{
printk("%s PANIC ERROR %x\n",_RTEMS_version, v);
while (true) {
/* Do nothing */
}
}
/* /*
* Use the shared implementations of the following routines * Use the shared implementations of the following routines
*/ */

View File

@@ -1,79 +0,0 @@
#include <rtems.h>
#include <bsp.h>
#include <bsp/bootcard.h>
#include <bsp/uart.h>
#include <rtems/bspIo.h>
#include <rtems/error.h>
#include <libcpu/stackTrace.h>
#include <rtems/score/percpu.h>
#include <rtems/score/threaddispatch.h>
#include <inttypes.h>
static void
rebootQuestion(void)
{
printk("Press a key to reboot\n");
BSP_poll_char_via_serial();
bsp_reset();
}
#define THESRC _Internal_errors_What_happened.the_source
#define THEERR _Internal_errors_What_happened.the_error
void _BSP_Fatal_error(unsigned int v)
{
unsigned long flags;
const char *err = 0;
rtems_interrupt_disable(flags);
(void) flags; /* avoid set but not used warning */
printk("%s\n",_RTEMS_version);
printk("FATAL ERROR:\n");
printk("Environment:");
switch (THESRC) {
case INTERNAL_ERROR_CORE:
printk(" RTEMS Core\n");
err = rtems_internal_error_text(THEERR);
break;
case INTERNAL_ERROR_RTEMS_API:
printk(" RTEMS API\n");
err = rtems_status_text(THEERR);
break;
case INTERNAL_ERROR_POSIX_API:
printk(" POSIX API (errno)\n");
/* could use strerror but I'd rather avoid using this here */
break;
default:
printk(" UNKNOWN (0x%x)\n",THESRC);
break;
}
if ( _Thread_Dispatch_is_enabled() )
printk("enabled\n");
else
printk(
" Error occurred in a Thread Dispatching DISABLED"
" context (level %" PRIu32 ")\n",
_Thread_Dispatch_get_disable_level());
if ( _ISR_Nest_level ) {
printk(
" Error occurred from ISR context (ISR nest level %" PRIu32 ")\n",
_ISR_Nest_level
);
}
printk("Error %d",THEERR);
if (err) {
printk(": %s",err);
}
printk("\n");
printk("Stack Trace:\n");
CPU_print_stack();
rebootQuestion();
}

View File

@@ -42,12 +42,6 @@ uint32_t bsp_clock_speed; /* Serial clocks per second */
uint32_t bsp_timer_least_valid; uint32_t bsp_timer_least_valid;
uint32_t bsp_timer_average_overhead; uint32_t bsp_timer_average_overhead;
void _BSP_Fatal_error(unsigned int v)
{
printk("%s PANIC ERROR %x\n",_RTEMS_version, v);
__asm__ __volatile ("sc");
}
/* /*
* bsp_start() * bsp_start()
* *

View File

@@ -33,20 +33,6 @@ LINKER_SYMBOL(bsp_exc_vector_base);
*/ */
uint32_t bsp_time_base_frequency = 10000000; uint32_t bsp_time_base_frequency = 10000000;
void _BSP_Fatal_error(unsigned n)
{
rtems_interrupt_level level;
rtems_interrupt_local_disable(level);
(void) level;
printk("%s PANIC ERROR %u\n", rtems_get_version_string(), n);
while (1) {
/* Do nothing */
}
}
#define MTIVPR(base) \ #define MTIVPR(base) \
__asm__ volatile ("mtivpr %0" : : "r" (base)) __asm__ volatile ("mtivpr %0" : : "r" (base))

View File

@@ -51,20 +51,6 @@ uint32_t bsp_timer_average_overhead; /* Average overhead of timer in ticks */
uint32_t bsp_timer_least_valid; /* Least valid number from timer */ uint32_t bsp_timer_least_valid; /* Least valid number from timer */
bool bsp_timer_internal_clock; /* TRUE, when timer runs with CPU clk */ bool bsp_timer_internal_clock; /* TRUE, when timer runs with CPU clk */
void _BSP_Fatal_error( unsigned n)
{
rtems_interrupt_level level;
rtems_interrupt_disable( level);
(void) level;
printk( "%s PANIC ERROR %u\n", _RTEMS_version, n);
while (1) {
/* Do nothing */
}
}
static const char *bsp_tqm_get_cib_string( const char *cib_id) static const char *bsp_tqm_get_cib_string( const char *cib_id)
{ {
char srch_pattern[10] = ""; char srch_pattern[10] = "";

View File

@@ -103,15 +103,3 @@ void bsp_start( void )
bsp_interrupt_initialize(); bsp_interrupt_initialize();
} }
void _BSP_Fatal_error(unsigned int v)
{
rtems_interrupt_level level;
rtems_interrupt_disable(level);
(void) level;
while (true) {
/* Do nothing */
}
}

View File

@@ -70,7 +70,6 @@ extern rtems_configuration_table BSP_Configuration; /* owned by BSP */
#endif /* ASM */ #endif /* ASM */
void BSP_ask_for_reset(void); void BSP_ask_for_reset(void);
void _BSP_Fatal_error(unsigned int v);
/* /*
* Prototypes for BSP methods shared across file boundaries * Prototypes for BSP methods shared across file boundaries

View File

@@ -133,18 +133,6 @@ void BSP_ask_for_reset(void)
} }
void _BSP_Fatal_error(unsigned int v)
{
RTEMS_UNUSED rtems_interrupt_level level;
rtems_interrupt_disable(level);
printk("\n%s FATAL ERROR %x\n", rtems_get_version_string(), v);
BSP_ask_for_reset();
}
/*===================================================================*/ /*===================================================================*/
/* /*

View File

@@ -99,7 +99,6 @@ void zero_bss(void);
#endif /* ASM */ #endif /* ASM */
void BSP_ask_for_reset(void); void BSP_ask_for_reset(void);
void _BSP_Fatal_error(unsigned int v);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -147,18 +147,6 @@ void BSP_ask_for_reset(void)
} }
void _BSP_Fatal_error(unsigned int v)
{
RTEMS_UNUSED rtems_interrupt_level level;
rtems_interrupt_disable(level);
printk("\n%s FATAL ERROR %x\n", rtems_get_version_string(), v);
BSP_ask_for_reset();
}
/*===================================================================*/ /*===================================================================*/
/* /*

View File

@@ -675,22 +675,21 @@ static inline void _CPU_ISR_Set_level( uint32_t level )
_CPU_MSR_SET(msr); _CPU_MSR_SET(msr);
} }
/* Fatal Error manager macros */
/*
* This routine copies _error into a known place -- typically a stack
* location or a register, optionally disables interrupts, and
* halts/stops the CPU.
*/
void _BSP_Fatal_error(unsigned int);
#endif /* ASM */ #endif /* ASM */
#define _CPU_Fatal_halt( _source, _error ) \ #define _CPU_Fatal_halt( _source, _error ) \
_BSP_Fatal_error(_error) do { \
ppc_interrupt_disable(); \
/* end of Fatal Error manager macros */ __asm__ volatile ( \
"mr 3, %0\n" \
"mr 4, %1\n" \
"1:\n" \
"b 1b\n" \
: \
: "r" (_source), "r" (_error) \
: "memory" \
); \
} while ( 0 )
/* /*
* Should be large enough to run all RTEMS tests. This ensures * Should be large enough to run all RTEMS tests. This ensures