bsps/powerpc: Exception initialization error is fatal

This commit is contained in:
Sebastian Huber
2012-11-14 09:57:55 +01:00
parent dd8df59413
commit b1e8a580bc
22 changed files with 48 additions and 107 deletions

View File

@@ -275,7 +275,6 @@ void Read_ep1a_config_registers( ppc_cpu_id_t myCpu ) {
void bsp_start( void )
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
uintptr_t intrStackStart;
uintptr_t intrStackSize;
ppc_cpu_id_t myCpu;
@@ -320,14 +319,11 @@ ShowBATS();
/*
* Initialize default raw exception hanlders.
*/
sc = ppc_exc_initialize(
ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
intrStackStart,
intrStackSize
);
if (sc != RTEMS_SUCCESSFUL) {
BSP_panic("cannot initialize exceptions");
}
/*
* Init MMU block address translation to enable hardware

View File

@@ -125,7 +125,6 @@ void _BSP_Fatal_error(unsigned int v)
void bsp_start(void)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
ppc_cpu_id_t myCpu;
ppc_cpu_revision_t myCpuRevision;
@@ -173,14 +172,11 @@ void bsp_start(void)
/* Initialize exception handler */
ppc_exc_cache_wb_check = 0;
sc = ppc_exc_initialize(
ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
(uintptr_t) bsp_interrupt_stack_start,
(uintptr_t) bsp_interrupt_stack_size
);
if (sc != RTEMS_SUCCESSFUL) {
BSP_panic("cannot initialize exceptions");
}
ppc_exc_set_handler(ASM_ALIGN_VECTOR, ppc_exc_alignment_handler);
/* Initalize interrupt support */

View File

@@ -134,14 +134,11 @@ void bsp_start( void)
#ifndef BSP_DATA_CACHE_ENABLED
ppc_exc_cache_wb_check = 0;
#endif
sc = ppc_exc_initialize(
ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
interrupt_stack_start,
interrupt_stack_size
);
if (sc != RTEMS_SUCCESSFUL) {
BSP_panic("cannot initialize exceptions");
}
/* Install default handler for the decrementer exception */
sc = ppc_exc_set_handler( ASM_DEC_VECTOR, mpc83xx_decrementer_exception_handler);

View File

@@ -170,7 +170,6 @@ BSP_polling_getchar_function_type BSP_poll_char = NULL;
*/
void bsp_start( void )
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
ppc_cpu_id_t myCpu;
ppc_cpu_revision_t myCpuRevision;
@@ -203,14 +202,11 @@ void bsp_start( void )
/*
* Initialize default raw exception handlers.
*/
sc = ppc_exc_initialize(
ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
(uintptr_t) intrStack_start,
(uintptr_t) intrStack_size
);
if (sc != RTEMS_SUCCESSFUL) {
BSP_panic("cannot initialize exceptions");
}
/*
* Install our own set of exception vectors

View File

@@ -82,7 +82,6 @@ void _BSP_Fatal_error(unsigned int v)
*/
void bsp_start(void)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
ppc_cpu_id_t myCpu;
ppc_cpu_revision_t myCpuRevision;
@@ -113,14 +112,11 @@ void bsp_start(void)
#endif
/* Initialize exception handler */
sc = ppc_exc_initialize(
ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
(uintptr_t) IntrStack_start,
(uintptr_t) intrStack - (uintptr_t) IntrStack_start
);
if ( sc != RTEMS_SUCCESSFUL ) {
BSP_panic( "cannot initialize exceptions" );
}
/* Initalize interrupt support */
bsp_interrupt_initialize();

View File

@@ -90,7 +90,6 @@ static void null_pointer_protection(void)
void bsp_start(void)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
ppc_cpu_id_t myCpu;
ppc_cpu_revision_t myCpuRevision;
@@ -119,14 +118,11 @@ void bsp_start(void)
/* Initialize exceptions */
ppc_exc_vector_base = (uint32_t) mpc55xx_exc_vector_base;
sc = ppc_exc_initialize(
ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
(uintptr_t) bsp_section_work_begin,
rtems_configuration_get_interrupt_stack_size()
);
if (sc != RTEMS_SUCCESSFUL) {
BSP_panic( "Cannot initialize exceptions");
}
ppc_exc_set_handler(ASM_ALIGN_VECTOR, ppc_exc_alignment_handler);
/* Initialize interrupts */

View File

@@ -148,7 +148,6 @@ void _BSP_Uart2_disable(void)
void bsp_start(void)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
ppc_cpu_id_t myCpu;
ppc_cpu_revision_t myCpuRevision;
@@ -173,14 +172,11 @@ void bsp_start(void)
/* Initialize exception handler */
/* FIXME: Interrupt stack begin and size */
sc = ppc_exc_initialize(
ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
(uintptr_t) IntrStack_start,
(uintptr_t) intrStack - (uintptr_t) IntrStack_start
);
if (sc != RTEMS_SUCCESSFUL) {
BSP_panic("cannot intitialize exceptions");
}
/* Initalize interrupt support */
bsp_interrupt_initialize();

View File

@@ -217,7 +217,6 @@ SPR_RW(HID1)
void bsp_start( void )
{
rtems_status_code sc;
unsigned char *stack;
uintptr_t intrStackStart;
uintptr_t intrStackSize;
@@ -270,14 +269,11 @@ VpdBufRec vpdData [] = {
/*
* Initialize default raw exception handlers.
*/
sc = ppc_exc_initialize(
ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
intrStackStart,
intrStackSize
);
if (sc != RTEMS_SUCCESSFUL) {
BSP_panic("cannot initialize exceptions");
}
printk("CPU 0x%x - rev 0x%x\n", myCpu, myCpuRevision);

View File

@@ -187,7 +187,6 @@ save_boot_params(
void bsp_start( void )
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
#ifdef CONF_VPD
int i;
#endif
@@ -245,14 +244,11 @@ void bsp_start( void )
/*
* Initialize default raw exception handlers.
*/
sc = ppc_exc_initialize(
ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
intrStackStart,
intrStackSize
);
if (sc != RTEMS_SUCCESSFUL) {
BSP_panic("cannot initialize exceptions");
}
/*
* Init MMU block address translation to enable hardware

View File

@@ -77,7 +77,6 @@ void _BSP_Fatal_error(unsigned int v)
*/
void bsp_start( void )
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
uintptr_t intrStackStart;
uintptr_t intrStackSize;
@@ -110,14 +109,11 @@ void bsp_start( void )
/*
* Initialize default raw exception handlers.
*/
sc = ppc_exc_initialize(
ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
intrStackStart,
intrStackSize
);
if (sc != RTEMS_SUCCESSFUL) {
BSP_panic("cannot initialize exceptions");
}
/*
* Initalize RTEMS IRQ system

View File

@@ -91,14 +91,11 @@ void bsp_start( void )
/*
* Initialize default raw exception handlers.
*/
sc = ppc_exc_initialize(
ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
intrStackStart,
intrStackSize
);
if (sc != RTEMS_SUCCESSFUL) {
BSP_panic("cannot initialize exceptions");
}
/* Install default handler for the decrementer exception */
sc = ppc_exc_set_handler( ASM_DEC_VECTOR, default_decrementer_exception_handler);

View File

@@ -72,7 +72,6 @@ void _BSP_Fatal_error(unsigned n)
void bsp_start(void)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
unsigned long i = 0;
ppc_cpu_id_t myCpu;
@@ -109,14 +108,11 @@ void bsp_start(void)
/* Initialize exception handler */
ppc_exc_vector_base = (uint32_t) bsp_exc_vector_base;
sc = ppc_exc_initialize(
ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
(uintptr_t) bsp_section_work_begin,
rtems_configuration_get_interrupt_stack_size()
);
if (sc != RTEMS_SUCCESSFUL) {
BSP_panic("cannot initialize exceptions");
}
/* Now it is possible to make the code execute only */
qoriq_mmu_change_perm(

View File

@@ -150,7 +150,6 @@ void initialize_PMC(void) {
void bsp_start( void )
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
unsigned int msr_value = 0x0000;
uintptr_t intrStackStart;
uintptr_t intrStackSize;
@@ -194,14 +193,11 @@ void bsp_start( void )
/*
* Initialize default raw exception handlers.
*/
sc = ppc_exc_initialize(
ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
intrStackStart,
intrStackSize
);
if (sc != RTEMS_SUCCESSFUL) {
BSP_panic("cannot initialize exceptions");
}
msr_value = 0x2030;
_CPU_MSR_SET( msr_value );

View File

@@ -135,7 +135,6 @@ unsigned int get_eumbbar(void) {
void bsp_start( void )
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
#if !defined(mvme2100)
unsigned l2cr;
#endif
@@ -232,14 +231,11 @@ void bsp_start( void )
/*
* Initialize default raw exception handlers.
*/
sc = ppc_exc_initialize(
ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
intrStackStart,
intrStackSize
);
if (sc != RTEMS_SUCCESSFUL) {
BSP_panic("cannot initialize exceptions");
}
boardManufacturer = checkPrepBoardType(&residualCopy);
if (boardManufacturer != PREP_Motorola) {

View File

@@ -60,21 +60,16 @@ void _BSP_Fatal_error(unsigned n)
void bsp_start(void)
{
rtems_status_code sc;
get_ppc_cpu_type();
get_ppc_cpu_revision();
/* Initialize exception handler */
ppc_exc_vector_base = (uint32_t) bsp_exc_vector_base;
sc = ppc_exc_initialize(
ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
(uintptr_t) bsp_section_work_begin,
rtems_configuration_get_interrupt_stack_size()
);
if (sc != RTEMS_SUCCESSFUL) {
BSP_panic("cannot initialize exceptions");
}
/* Initalize interrupt support */
bsp_interrupt_initialize();

View File

@@ -129,7 +129,6 @@ rtems_status_code bsp_tqm_get_cib_uint32( const char *cib_id,
void bsp_start( void)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
ppc_cpu_id_t myCpu;
ppc_cpu_revision_t myCpuRevision;
@@ -182,14 +181,11 @@ void bsp_start( void)
bsp_timer_average_overhead = 3;
/* Initialize exception handler */
sc = ppc_exc_initialize(
ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
interrupt_stack_start,
interrupt_stack_size
);
if (sc != RTEMS_SUCCESSFUL) {
BSP_panic("cannot initialize exceptions");
}
/* Initalize interrupt support */
bsp_interrupt_initialize();

View File

@@ -104,7 +104,6 @@ void bsp_XAssertHandler(const char* file, int line) {
*/
void bsp_start( void )
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
ppc_cpu_id_t myCpu;
ppc_cpu_revision_t myCpuRevision;
@@ -134,14 +133,11 @@ void bsp_start( void )
/*
* Initialize default raw exception handlers.
*/
sc = ppc_exc_initialize(
ppc_exc_initialize(
PPC_INTERRUPT_DISABLE_MASK_DEFAULT,
(uint32_t)IntrStack_start,
IntrStack_end - IntrStack_start
);
if (sc != RTEMS_SUCCESSFUL) {
BSP_panic("cannot initialize exceptions");
}
/*
* Install our own set of exception vectors

View File

@@ -104,7 +104,6 @@ LINKER_SYMBOL(__phy_ram_end);
static void _noopfun(void) {}
static void _bsp_start(void)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
uintptr_t intrStackStart = CPU_UP_ALIGN((uint32_t)__bsp_ram_start);
uintptr_t intrStackSize = rtems_configuration_get_interrupt_stack_size();
@@ -115,10 +114,9 @@ static void _bsp_start(void)
* FPGA, so the external interrupt should not be enabled in order to avoid
* spurious interrupts.
*/
sc = ppc_exc_initialize(PPC_INTERRUPT_DISABLE_MASK_DEFAULT & ~MSR_EE,
intrStackStart,
intrStackSize);
if (sc != RTEMS_SUCCESSFUL) BSP_panic("Cannot initialize exceptions");
ppc_exc_initialize(PPC_INTERRUPT_DISABLE_MASK_DEFAULT & ~MSR_EE,
intrStackStart,
intrStackSize);
/* Install our own set of exception vectors */
BSP_rtems_irq_mngt_init(0);

View File

@@ -104,7 +104,6 @@ LINKER_SYMBOL(__phy_ram_end);
static void _noopfun(void) {}
static void _bsp_start(void)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
uintptr_t intrStackStart = CPU_UP_ALIGN((uint32_t)__bsp_ram_start);
uintptr_t intrStackSize = rtems_configuration_get_interrupt_stack_size();
@@ -115,10 +114,9 @@ static void _bsp_start(void)
* FPGA, so the external interrupt should not be enabled in order to avoid
* spurious interrupts.
*/
sc = ppc_exc_initialize(PPC_INTERRUPT_DISABLE_MASK_DEFAULT & ~MSR_EE,
intrStackStart,
intrStackSize);
if (sc != RTEMS_SUCCESSFUL) BSP_panic("Cannot initialize exceptions");
ppc_exc_initialize(PPC_INTERRUPT_DISABLE_MASK_DEFAULT & ~MSR_EE,
intrStackStart,
intrStackSize);
/* Install our own set of exception vectors */
BSP_rtems_irq_mngt_init(0);

View File

@@ -54,6 +54,7 @@ extern "C" {
* @brief Generic BSP fatal error codes.
*/
typedef enum {
BSP_GENERIC_FATAL_EXCEPTION_INITIALIZATION,
BSP_GENERIC_FATAL_INTERRUPT_INITIALIZATION
} bsp_generic_fatal_code;

View File

@@ -12,7 +12,7 @@
*
* Copyright (C) 2007 Till Straumann <strauman@slac.stanford.edu>
*
* Copyright (C) 2009 embedded brains GmbH.
* Copyright (C) 2009-2012 embedded brains GmbH.
*
* Derived from file "libcpu/powerpc/new-exceptions/bspsupport/vectors_init.c".
* Derived from file "libcpu/powerpc/new-exceptions/e500_raw_exc_init.c".
@@ -25,6 +25,7 @@
#include <rtems.h>
#include <bsp/vectors.h>
#include <bsp/bootcard.h>
uint32_t ppc_exc_cache_wb_check = 1;
@@ -71,7 +72,15 @@ static void ppc_exc_initialize_booke(void)
}
}
rtems_status_code ppc_exc_initialize(
static void ppc_exc_fatal_error(void)
{
rtems_fatal(
RTEMS_FATAL_SOURCE_BSP_GENERIC,
BSP_GENERIC_FATAL_EXCEPTION_INITIALIZATION
);
}
void ppc_exc_initialize(
uint32_t interrupt_disable_mask,
uintptr_t interrupt_stack_begin,
uintptr_t interrupt_stack_size
@@ -86,7 +95,7 @@ rtems_status_code ppc_exc_initialize(
uint32_t r13 = 0;
if (categories == NULL) {
return RTEMS_NOT_IMPLEMENTED;
ppc_exc_fatal_error();
}
/* Assembly code needs SDA_BASE in r13 (SVR4 or EABI). Make sure
@@ -100,7 +109,7 @@ rtems_status_code ppc_exc_initialize(
);
if (sda_base != r13) {
return RTEMS_NOT_CONFIGURED;
ppc_exc_fatal_error();
}
/* Ensure proper interrupt stack alignment */
@@ -137,7 +146,7 @@ rtems_status_code ppc_exc_initialize(
sc = ppc_exc_make_prologue(vector, category, prologue, &prologue_size);
if (sc != RTEMS_SUCCESSFUL) {
return RTEMS_INTERNAL_ERROR;
ppc_exc_fatal_error();
}
ppc_code_copy(vector_address, prologue, prologue_size);
@@ -175,6 +184,4 @@ rtems_status_code ppc_exc_initialize(
__asm__ volatile ("dcbz 0, %0"::"b" (p));
/* If we make it thru here then things seem to be OK */
}
return RTEMS_SUCCESSFUL;
}

View File

@@ -428,13 +428,17 @@ rtems_status_code ppc_exc_make_prologue(
/**
* @brief Initializes the exception handling.
*
* @retval RTEMS_SUCCESSFUL Successful initialization.
* @retval RTEMS_NOT_IMPLEMENTED No category set available for the current CPU.
* @retval RTEMS_NOT_CONFIGURED Register r13 does not point to the small data
* area anchor required by SVR4/EABI.
* @retval RTEMS_INTERNAL_ERROR Minimal prologue creation failed.
* If the initialization fails, then this is a fatal error. The fatal error
* source is RTEMS_FATAL_SOURCE_BSP_GENERIC and the fatal error code is
* BSP_GENERIC_FATAL_EXCEPTION_INITIALIZATION.
*
* Possible error reasons are
* - no category set available for the current CPU,
* - the register r13 does not point to the small data area anchor required by
* SVR4/EABI, or
* - the minimal prologue creation failed.
*/
rtems_status_code ppc_exc_initialize(
void ppc_exc_initialize(
uint32_t interrupt_disable_mask,
uintptr_t interrupt_stack_begin,
uintptr_t interrupt_stack_size