bsps/leon3: Check that the IPI vector is valid

leon3_check_ipi_vector() took the status of
bsp_interrupt_get_attributes() as the validity of the IPI vector.  The
function returns RTEMS_SUCCESSFUL for every vector.  An IPI bus line
which the interrupt map connected to no controller line passed the
check.
Both failures of the check reported LEON3_FATAL_IPI_INITIALIZATION, so
the fatal code did not tell them apart.

Check the vector with bsp_interrupt_is_valid_vector() before the
attributes are read.  Replace the fatal code with
LEON3_FATAL_INVALID_IPI_VECTOR for an invalid vector and with
LEON3_FATAL_CANNOT_RAISE_IPI for a vector which cannot be raised on a
processor.

Assisted-by: Claude:claude-opus-5-5 claude-code
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
This commit is contained in:
Sebastian Huber
2026-09-30 09:53:11 -05:00
committed by Kinsey Moore
parent 7f15ce2f0a
commit b65353df6e
2 changed files with 10 additions and 5 deletions
+2 -1
View File
@@ -91,7 +91,8 @@ typedef enum {
LEON3_FATAL_CLOCK_INITIALIZATION,
LEON3_FATAL_INVALID_CACHE_CONFIG_BOOT_PROCESSOR,
LEON3_FATAL_INVALID_CACHE_CONFIG_SECONDARY_PROCESSOR,
LEON3_FATAL_IPI_INITIALIZATION,
LEON3_FATAL_INVALID_IPI_VECTOR,
LEON3_FATAL_CANNOT_RAISE_IPI,
/* LPC24XX fatal codes */
LPC24XX_FATAL_PL111_SET_UP = BSP_FATAL_CODE_BLOCK(3),
+8 -4
View File
@@ -150,11 +150,15 @@ Processor_mask leon3_interrupt_affinities[ BSP_INTERRUPT_VECTOR_MAX_STD + 1 ];
static void leon3_check_ipi_vector( void )
{
rtems_interrupt_attributes ipi_attributes;
rtems_status_code status;
status = bsp_interrupt_get_attributes( LEON3_mp_irq, &ipi_attributes );
if ( ( status != RTEMS_SUCCESSFUL ) || !ipi_attributes.can_raise_on ) {
bsp_fatal( LEON3_FATAL_IPI_INITIALIZATION );
if ( !bsp_interrupt_is_valid_vector( LEON3_mp_irq ) ) {
bsp_fatal( LEON3_FATAL_INVALID_IPI_VECTOR );
}
(void) bsp_interrupt_get_attributes( LEON3_mp_irq, &ipi_attributes );
if ( !ipi_attributes.can_raise_on ) {
bsp_fatal( LEON3_FATAL_CANNOT_RAISE_IPI );
}
}
#endif