mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 00:50:08 +08:00
bsp/leon3: Replace the define LEON3_MP_IRQ with a weakly linked variable
The LEON3_MP_IRQ define is used to pick the IRQ to be used by the shared memory driver and for inter-processor interrupts. On some LEON3 systems, for example the GR712RC, the default value of 14 is not suitable. To make this value configurable from the application, it is replaced with a weakly linked variable that can be overridden from the application.
This commit is contained in:
committed by
Sebastian Huber
parent
456eab7dc8
commit
93b000e645
@@ -215,6 +215,13 @@ extern void BSP_shared_interrupt_unmask(int irq);
|
||||
*/
|
||||
extern void BSP_shared_interrupt_mask(int irq);
|
||||
|
||||
/* Irq used by the shared memory driver and for inter-processor interrupts.
|
||||
* The variable is weakly linked. Redefine the variable in your application
|
||||
* to override the BSP default.
|
||||
* See startup/bspsmp.c for the default value.
|
||||
*/
|
||||
extern unsigned char LEON3_mp_irq;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -119,8 +119,6 @@ static __inline__ int bsp_irq_fixup(int irq)
|
||||
|
||||
/* Macros used for manipulating bits in LEON3 GP Timer Control Register */
|
||||
|
||||
#define LEON3_MP_IRQ 14 /* Irq used by shared memory driver */
|
||||
|
||||
#define LEON3_IRQMPSTATUS_CPUNR 28
|
||||
#define LEON3_IRQMPSTATUS_BROADCAST 27
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ shm_config_table BSP_shm_cfgtbl __attribute__((weak)) =
|
||||
Shm_Cause_interrupt,
|
||||
{
|
||||
NULL,
|
||||
1 << LEON3_MP_IRQ, /* USER OVERRIDABLE */
|
||||
0, /* USER OVERRIDABLE - Uses default MP-IRQ if 0 */
|
||||
4,
|
||||
},
|
||||
};
|
||||
@@ -93,7 +93,7 @@ void Shm_Get_configuration(
|
||||
BSP_shm_cfgtbl.Intr.address =
|
||||
(vol_u32 *) &(LEON3_IrqCtrl_Regs->force[LEON3_Cpu_Index]);
|
||||
if (BSP_shm_cfgtbl.Intr.value == 0)
|
||||
BSP_shm_cfgtbl.Intr.value = 1 << LEON3_MP_IRQ; /* Use default MP-IRQ */
|
||||
BSP_shm_cfgtbl.Intr.value = 1 << LEON3_mp_irq; /* Use default MP-IRQ */
|
||||
BSP_shm_cfgtbl.Intr.length = 4;
|
||||
|
||||
if (LEON3_Cpu_Index == 0) {
|
||||
|
||||
@@ -45,6 +45,6 @@ void Shm_setvec( void )
|
||||
* Interrupt driven mode is not currently supported.
|
||||
* This is thought to be the interrupt to use.
|
||||
*/
|
||||
LEON_Unmask_interrupt(LEON3_MP_IRQ);
|
||||
set_vector((rtems_isr_entry) Shm_isr, LEON_TRAP_TYPE(LEON3_MP_IRQ), 1);
|
||||
LEON_Unmask_interrupt(LEON3_mp_irq);
|
||||
set_vector((rtems_isr_entry) Shm_isr, LEON_TRAP_TYPE(LEON3_mp_irq), 1);
|
||||
}
|
||||
|
||||
@@ -21,6 +21,11 @@
|
||||
#include <rtems/score/smpimpl.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* Irq used by shared memory driver and for inter-processor interrupts.
|
||||
* Can be overridden by being defined in the application.
|
||||
*/
|
||||
unsigned char LEON3_mp_irq __attribute__((weak)) = 14;
|
||||
|
||||
#if !defined(__leon__) || defined(RTEMS_PARAVIRT)
|
||||
uint32_t _CPU_SMP_Get_current_processor( void )
|
||||
{
|
||||
@@ -41,7 +46,7 @@ void bsp_start_on_secondary_processor()
|
||||
|
||||
leon3_set_cache_control_register(0x80000F);
|
||||
/* Unmask IPI interrupts at Interrupt controller for this CPU */
|
||||
LEON3_IrqCtrl_Regs->mask[cpu_index_self] |= 1U << LEON3_MP_IRQ;
|
||||
LEON3_IrqCtrl_Regs->mask[cpu_index_self] |= 1U << LEON3_mp_irq;
|
||||
|
||||
_SMP_Start_multitasking_on_secondary_processor();
|
||||
}
|
||||
@@ -51,8 +56,8 @@ uint32_t _CPU_SMP_Initialize( void )
|
||||
leon3_set_cache_control_register(0x80000F);
|
||||
|
||||
if ( rtems_configuration_get_maximum_processors() > 1 ) {
|
||||
LEON_Unmask_interrupt(LEON3_MP_IRQ);
|
||||
set_vector(bsp_inter_processor_interrupt, LEON_TRAP_TYPE(LEON3_MP_IRQ), 1);
|
||||
LEON_Unmask_interrupt(LEON3_mp_irq);
|
||||
set_vector(bsp_inter_processor_interrupt, LEON_TRAP_TYPE(LEON3_mp_irq), 1);
|
||||
}
|
||||
|
||||
return leon3_get_cpu_count(LEON3_IrqCtrl_Regs);
|
||||
@@ -79,7 +84,7 @@ void _CPU_SMP_Finalize_initialization( uint32_t cpu_count )
|
||||
void _CPU_SMP_Send_interrupt(uint32_t target_processor_index)
|
||||
{
|
||||
/* send interrupt to destination CPU */
|
||||
LEON3_IrqCtrl_Regs->force[target_processor_index] = 1 << LEON3_MP_IRQ;
|
||||
LEON3_IrqCtrl_Regs->force[target_processor_index] = 1 << LEON3_mp_irq;
|
||||
}
|
||||
|
||||
void _LEON3_Start_multitasking(
|
||||
|
||||
@@ -32,10 +32,10 @@ void BSP_shared_interrupt_init(void)
|
||||
int i;
|
||||
|
||||
for (i=0; i <= BSP_INTERRUPT_VECTOR_MAX_STD; i++) {
|
||||
#if defined(LEON3_MP_IRQ) && \
|
||||
#if defined(LEON3) && \
|
||||
(defined(RTEMS_SMP) || defined(RTEMS_MULTIPROCESSING))
|
||||
/* Don't install IRQ handler on IPI interrupt */
|
||||
if (i == LEON3_MP_IRQ)
|
||||
if (i == LEON3_mp_irq)
|
||||
continue;
|
||||
#endif
|
||||
vector = SPARC_ASYNCHRONOUS_TRAP(i) + 0x10;
|
||||
|
||||
Reference in New Issue
Block a user