[PATCH] bsps: Improve interrupt vector enable/disable API

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Jun 19 13:19:31 UTC 2017


Change bsp_interrupt_vector_enable() and bsp_interrupt_vector_disable()
to not return a status code.  Add bsp_interrupt_assert() and use it to
validate the vector number in the vector enable/disable implementations.
---
 c/src/lib/libbsp/arm/beagle/irq.c                  | 12 +++---
 c/src/lib/libbsp/arm/edb7312/irq/irq.c             | 12 +++---
 c/src/lib/libbsp/arm/gdbarmsim/irq/irq.c           |  8 ++--
 c/src/lib/libbsp/arm/lpc24xx/irq/irq.c             | 10 ++---
 c/src/lib/libbsp/arm/lpc32xx/irq/irq.c             | 49 +++++++++-------------
 c/src/lib/libbsp/arm/raspberrypi/irq/irq.c         | 16 ++-----
 c/src/lib/libbsp/arm/shared/arm-gic-irq.c          | 28 ++++---------
 .../lib/libbsp/arm/shared/armv7m/irq/armv7m-irq.c  | 18 +++-----
 c/src/lib/libbsp/arm/tms570/irq/irq.c              | 40 +++---------------
 c/src/lib/libbsp/epiphany/epiphany_sim/irq/irq.c   |  8 ++--
 c/src/lib/libbsp/i386/pc386/timer/timer.c          |  7 +---
 c/src/lib/libbsp/i386/shared/comm/i386-stub-glue.c |  6 ---
 c/src/lib/libbsp/i386/shared/irq/irq.c             | 14 +++----
 c/src/lib/libbsp/lm32/shared/irq/irq.c             |  8 ++--
 c/src/lib/libbsp/m68k/genmcf548x/irq/irq.c         | 44 +++++++------------
 c/src/lib/libbsp/mips/shared/irq/irq.c             |  8 ++--
 c/src/lib/libbsp/or1k/generic_or1k/irq/irq.c       |  8 ++--
 c/src/lib/libbsp/powerpc/gen5200/irq/irq.c         | 32 +++++++-------
 c/src/lib/libbsp/powerpc/gen83xx/irq/irq.c         | 16 +++----
 c/src/lib/libbsp/powerpc/mpc8260ads/irq/irq.c      | 12 +++---
 c/src/lib/libbsp/powerpc/psim/irq/irq_init.c       |  8 ++--
 c/src/lib/libbsp/powerpc/qemuppc/irq/irq_init.c    |  8 ++--
 c/src/lib/libbsp/powerpc/qoriq/irq/irq.c           | 24 +++++------
 c/src/lib/libbsp/powerpc/t32mppc/irq/irq.c         |  8 ++--
 c/src/lib/libbsp/powerpc/tqm8xx/irq/irq.c          | 32 +++++++-------
 c/src/lib/libbsp/powerpc/virtex/irq/irq_init.c     | 32 +++++---------
 c/src/lib/libbsp/shared/include/irq-generic.h      | 30 +++++++------
 c/src/lib/libbsp/shared/src/irq-generic.c          | 16 +------
 c/src/lib/libbsp/shared/src/irq-server.c           |  8 +++-
 c/src/lib/libbsp/sparc/shared/irq/irq-shared.c     | 10 ++---
 c/src/lib/libcpu/arm/at91rm9200/irq/irq.c          | 10 ++---
 c/src/lib/libcpu/arm/lpc22xx/irq/irq.c             | 10 ++---
 c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c           | 20 ++++-----
 c/src/lib/libcpu/arm/pxa255/irq/irq.c              | 10 ++---
 c/src/lib/libcpu/arm/s3c24xx/irq/irq.c             |  8 ++--
 c/src/lib/libcpu/powerpc/mpc55xx/irq/irq.c         | 18 +++-----
 36 files changed, 238 insertions(+), 370 deletions(-)

diff --git a/c/src/lib/libbsp/arm/beagle/irq.c b/c/src/lib/libbsp/arm/beagle/irq.c
index d080a5e851..2fa1a5b0f0 100644
--- a/c/src/lib/libbsp/arm/beagle/irq.c
+++ b/c/src/lib/libbsp/arm/beagle/irq.c
@@ -95,28 +95,28 @@ static uint32_t omap_get_mir_reg(rtems_vector_number vector, uint32_t *const mas
   return mir_reg;
 }
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
   uint32_t mask, cur;
   uint32_t mir_reg = omap_get_mir_reg(vector, &mask);
 
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+
   cur = mmio_read(omap_intr.base + mir_reg);
   mmio_write(omap_intr.base + mir_reg, cur & ~mask);
   flush_data_cache();
-
-  return RTEMS_SUCCESSFUL;
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
   uint32_t mask, cur;
   uint32_t mir_reg = omap_get_mir_reg(vector, &mask);
 
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+
   cur = mmio_read(omap_intr.base + mir_reg);
   mmio_write(omap_intr.base + mir_reg, cur | mask);
   flush_data_cache();
-
-  return RTEMS_SUCCESSFUL;
 }
 
 rtems_status_code bsp_interrupt_facility_initialize(void)
diff --git a/c/src/lib/libbsp/arm/edb7312/irq/irq.c b/c/src/lib/libbsp/arm/edb7312/irq/irq.c
index 8c18ea7abd..1d9151a1bd 100644
--- a/c/src/lib/libbsp/arm/edb7312/irq/irq.c
+++ b/c/src/lib/libbsp/arm/edb7312/irq/irq.c
@@ -27,8 +27,10 @@ void edb7312_interrupt_dispatch(rtems_vector_number vector)
   bsp_interrupt_handler_dispatch(vector);
 }
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
+    bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+
     if(vector >= BSP_EXTFIQ && vector <= BSP_SSEOTI)
     {
         /* interrupt managed by INTMR1 and INTSR1 */
@@ -49,12 +51,12 @@ rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
         /* interrupt managed by INTMR3 and INTSR3 */
         *EP7312_INTMR3 |= (1 << (vector - 21));
     }
-
-  return RTEMS_SUCCESSFUL;
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
+    bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+
     if(vector >= BSP_EXTFIQ && vector <= BSP_SSEOTI)
     {
         /* interrupt managed by INTMR1 and INTSR1 */
@@ -75,8 +77,6 @@ rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
         /* interrupt managed by INTMR3 and INTSR3 */
         *EP7312_INTMR3 &= ~(1 << (vector - 21));
     }
-
-  return RTEMS_SUCCESSFUL;
 }
 
 rtems_status_code bsp_interrupt_facility_initialize(void)
diff --git a/c/src/lib/libbsp/arm/gdbarmsim/irq/irq.c b/c/src/lib/libbsp/arm/gdbarmsim/irq/irq.c
index 79665b46fd..886f928d2d 100644
--- a/c/src/lib/libbsp/arm/gdbarmsim/irq/irq.c
+++ b/c/src/lib/libbsp/arm/gdbarmsim/irq/irq.c
@@ -50,14 +50,14 @@ unsigned lpc24xx_irq_get_priority(rtems_vector_number vector)
 
 #ifdef ARM_MULTILIB_ARCH_V4
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-  return RTEMS_SUCCESSFUL;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-  return RTEMS_SUCCESSFUL;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 }
 
 rtems_status_code bsp_interrupt_facility_initialize(void)
diff --git a/c/src/lib/libbsp/arm/lpc24xx/irq/irq.c b/c/src/lib/libbsp/arm/lpc24xx/irq/irq.c
index 408f20db4f..7801c37843 100644
--- a/c/src/lib/libbsp/arm/lpc24xx/irq/irq.c
+++ b/c/src/lib/libbsp/arm/lpc24xx/irq/irq.c
@@ -64,18 +64,16 @@ unsigned lpc24xx_irq_get_priority(rtems_vector_number vector)
 
 #ifdef ARM_MULTILIB_ARCH_V4
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
   VICIntEnable = 1U << vector;
-
-  return RTEMS_SUCCESSFUL;
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
   VICIntEnClear = 1U << vector;
-
-  return RTEMS_SUCCESSFUL;
 }
 
 rtems_status_code bsp_interrupt_facility_initialize(void)
diff --git a/c/src/lib/libbsp/arm/lpc32xx/irq/irq.c b/c/src/lib/libbsp/arm/lpc32xx/irq/irq.c
index 37080f4de2..eac320000b 100755
--- a/c/src/lib/libbsp/arm/lpc32xx/irq/irq.c
+++ b/c/src/lib/libbsp/arm/lpc32xx/irq/irq.c
@@ -50,11 +50,6 @@ static lpc32xx_irq_fields lpc32xx_irq_priority_masks [LPC32XX_IRQ_PRIORITY_COUNT
 
 static lpc32xx_irq_fields lpc32xx_irq_enable;
 
-static inline bool lpc32xx_irq_is_valid(rtems_vector_number vector)
-{
-  return vector <= BSP_INTERRUPT_VECTOR_MAX;
-}
-
 static inline bool lpc32xx_irq_priority_is_valid(unsigned priority)
 {
   return priority <= LPC32XX_IRQ_PRIORITY_LOWEST;
@@ -130,7 +125,7 @@ static inline unsigned lpc32xx_irq_get_index(uint32_t val)
 
 void lpc32xx_irq_set_priority(rtems_vector_number vector, unsigned priority)
 {
-  if (lpc32xx_irq_is_valid(vector)) {
+  if (bsp_interrupt_is_valid_vector(vector)) {
     rtems_interrupt_level level;
     unsigned i = 0;
 
@@ -156,7 +151,7 @@ void lpc32xx_irq_set_priority(rtems_vector_number vector, unsigned priority)
 
 unsigned lpc32xx_irq_get_priority(rtems_vector_number vector)
 {
-  if (lpc32xx_irq_is_valid(vector)) {
+  if (bsp_interrupt_is_valid_vector(vector)) {
     return lpc32xx_irq_priority_table [vector];
   } else {
     return LPC32XX_IRQ_PRIORITY_LOWEST;
@@ -165,7 +160,7 @@ unsigned lpc32xx_irq_get_priority(rtems_vector_number vector)
 
 void lpc32xx_irq_set_activation_polarity(rtems_vector_number vector, lpc32xx_irq_activation_polarity activation_polarity)
 {
-  if (lpc32xx_irq_is_valid(vector)) {
+  if (bsp_interrupt_is_valid_vector(vector)) {
     rtems_interrupt_level level;
 
     rtems_interrupt_disable(level);
@@ -180,7 +175,7 @@ void lpc32xx_irq_set_activation_polarity(rtems_vector_number vector, lpc32xx_irq
 
 lpc32xx_irq_activation_polarity lpc32xx_irq_get_activation_polarity(rtems_vector_number vector)
 {
-  if (lpc32xx_irq_is_valid(vector)) {
+  if (bsp_interrupt_is_valid_vector(vector)) {
     if (lpc32xx_irq_is_bit_set_in_register(vector, LPC32XX_IRQ_OFFSET_APR)) {
       return LPC32XX_IRQ_ACTIVE_HIGH_OR_RISING_EDGE;
     } else {
@@ -193,7 +188,7 @@ lpc32xx_irq_activation_polarity lpc32xx_irq_get_activation_polarity(rtems_vector
 
 void lpc32xx_irq_set_activation_type(rtems_vector_number vector, lpc32xx_irq_activation_type activation_type)
 {
-  if (lpc32xx_irq_is_valid(vector)) {
+  if (bsp_interrupt_is_valid_vector(vector)) {
     rtems_interrupt_level level;
 
     rtems_interrupt_disable(level);
@@ -208,7 +203,7 @@ void lpc32xx_irq_set_activation_type(rtems_vector_number vector, lpc32xx_irq_act
 
 lpc32xx_irq_activation_type lpc32xx_irq_get_activation_type(rtems_vector_number vector)
 {
-  if (lpc32xx_irq_is_valid(vector)) {
+  if (bsp_interrupt_is_valid_vector(vector)) {
     if (lpc32xx_irq_is_bit_set_in_register(vector, LPC32XX_IRQ_OFFSET_ATR)) {
       return LPC32XX_IRQ_EDGE_SENSITIVE;
     } else {
@@ -265,32 +260,28 @@ void bsp_interrupt_dispatch(void)
   lpc32xx.sic_2.er = er_sic_2 & lpc32xx_irq_enable.field.sic_2;
 }
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-  if (lpc32xx_irq_is_valid(vector)) {
-    rtems_interrupt_level level;
+  rtems_interrupt_level level;
 
-    rtems_interrupt_disable(level);
-    lpc32xx_irq_set_bit_in_register(vector, LPC32XX_IRQ_OFFSET_ER);
-    lpc32xx_irq_set_bit_in_field(vector, &lpc32xx_irq_enable);
-    rtems_interrupt_enable(level);
-  }
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 
-  return RTEMS_SUCCESSFUL;
+  rtems_interrupt_disable(level);
+  lpc32xx_irq_set_bit_in_register(vector, LPC32XX_IRQ_OFFSET_ER);
+  lpc32xx_irq_set_bit_in_field(vector, &lpc32xx_irq_enable);
+  rtems_interrupt_enable(level);
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-  if (lpc32xx_irq_is_valid(vector)) {
-    rtems_interrupt_level level;
+  rtems_interrupt_level level;
 
-    rtems_interrupt_disable(level);
-    lpc32xx_irq_clear_bit_in_field(vector, &lpc32xx_irq_enable);
-    lpc32xx_irq_clear_bit_in_register(vector, LPC32XX_IRQ_OFFSET_ER);
-    rtems_interrupt_enable(level);
-  }
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 
-  return RTEMS_SUCCESSFUL;
+  rtems_interrupt_disable(level);
+  lpc32xx_irq_clear_bit_in_field(vector, &lpc32xx_irq_enable);
+  lpc32xx_irq_clear_bit_in_register(vector, LPC32XX_IRQ_OFFSET_ER);
+  rtems_interrupt_enable(level);
 }
 
 void lpc32xx_set_exception_handler(
diff --git a/c/src/lib/libbsp/arm/raspberrypi/irq/irq.c b/c/src/lib/libbsp/arm/raspberrypi/irq/irq.c
index 48f781075b..5b10385bfe 100644
--- a/c/src/lib/libbsp/arm/raspberrypi/irq/irq.c
+++ b/c/src/lib/libbsp/arm/raspberrypi/irq/irq.c
@@ -139,26 +139,18 @@ void bsp_interrupt_dispatch(void)
   }
 }
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-  if ( vector > BSP_INTERRUPT_VECTOR_MAX )
-    return RTEMS_INVALID_ID;
-
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
   BCM2835_REG(bsp_vector_to_reg(vector)->enable_reg_addr) =
               bsp_vector_to_mask(vector);
-
-  return RTEMS_SUCCESSFUL;
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-  if ( vector > BSP_INTERRUPT_VECTOR_MAX )
-    return RTEMS_INVALID_ID;
-
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
   BCM2835_REG(bsp_vector_to_reg(vector)->disable_reg_addr) =
               bsp_vector_to_mask(vector);
-
-  return RTEMS_SUCCESSFUL;
 }
 
 void bsp_interrupt_handler_default(rtems_vector_number vector)
diff --git a/c/src/lib/libbsp/arm/shared/arm-gic-irq.c b/c/src/lib/libbsp/arm/shared/arm-gic-irq.c
index 487ee16f72..5a4a998bfb 100644
--- a/c/src/lib/libbsp/arm/shared/arm-gic-irq.c
+++ b/c/src/lib/libbsp/arm/shared/arm-gic-irq.c
@@ -44,34 +44,22 @@ void bsp_interrupt_dispatch(void)
   }
 }
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-  rtems_status_code sc = RTEMS_SUCCESSFUL;
+  volatile gic_dist *dist = ARM_GIC_DIST;
 
-  if (bsp_interrupt_is_valid_vector(vector)) {
-    volatile gic_dist *dist = ARM_GIC_DIST;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 
-    gic_id_enable(dist, vector);
-  } else {
-    sc = RTEMS_INVALID_ID;
-  }
-
-  return sc;
+  gic_id_enable(dist, vector);
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-  rtems_status_code sc = RTEMS_SUCCESSFUL;
+  volatile gic_dist *dist = ARM_GIC_DIST;
 
-  if (bsp_interrupt_is_valid_vector(vector)) {
-    volatile gic_dist *dist = ARM_GIC_DIST;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 
-    gic_id_disable(dist, vector);
-  } else {
-    sc = RTEMS_INVALID_ID;
-  }
-
-  return sc;
+  gic_id_disable(dist, vector);
 }
 
 static inline uint32_t get_id_count(volatile gic_dist *dist)
diff --git a/c/src/lib/libbsp/arm/shared/armv7m/irq/armv7m-irq.c b/c/src/lib/libbsp/arm/shared/armv7m/irq/armv7m-irq.c
index df17c26cdd..1d930a4591 100644
--- a/c/src/lib/libbsp/arm/shared/armv7m/irq/armv7m-irq.c
+++ b/c/src/lib/libbsp/arm/shared/armv7m/irq/armv7m-irq.c
@@ -22,22 +22,16 @@
 
 #ifdef ARM_MULTILIB_ARCH_V7M
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-  if (bsp_interrupt_is_valid_vector(vector)) {
-    _ARMV7M_NVIC_Set_enable((int) vector);
-  }
-
-  return RTEMS_SUCCESSFUL;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+  _ARMV7M_NVIC_Set_enable((int) vector);
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-  if (bsp_interrupt_is_valid_vector(vector)) {
-    _ARMV7M_NVIC_Clear_enable((int) vector);
-  }
-
-  return RTEMS_SUCCESSFUL;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+  _ARMV7M_NVIC_Clear_enable((int) vector);
 }
 
 rtems_status_code bsp_interrupt_facility_initialize(void)
diff --git a/c/src/lib/libbsp/arm/tms570/irq/irq.c b/c/src/lib/libbsp/arm/tms570/irq/irq.c
index 7a2a55fff5..579c11ed2a 100644
--- a/c/src/lib/libbsp/arm/tms570/irq/irq.c
+++ b/c/src/lib/libbsp/arm/tms570/irq/irq.c
@@ -28,24 +28,6 @@
 #include <bsp/irq.h>
 #include <rtems/score/armv4.h>
 
-/**
- * @brief Check if isr vector is valid
- *
- * Check if isr vector is valid by using BSP_INTERRUPT_VECTOR_MAX and
- * BSP_INTERRUPT_VECTOR_MIN defined in irq.h
- *
- * @param[in] vector interrupt vector to be checked.
- * @retval TRUE vector is valid.
- * @retval FALSE vector is invalid
- */
-static inline bool tms570_irq_is_valid(
-  rtems_vector_number vector
-)
-{
-  return (vector <= BSP_INTERRUPT_VECTOR_MAX) &&
-         (vector > BSP_INTERRUPT_VECTOR_MIN);
-}
-
 unsigned int priorityTable[BSP_INTERRUPT_VECTOR_MAX+1];
 
 /**
@@ -64,7 +46,7 @@ void tms570_irq_set_priority(
   unsigned priority
 )
 {
-  if ( tms570_irq_is_valid(vector) ) {
+  if ( bsp_interrupt_is_valid_vector(vector) ) {
     priorityTable[vector] = priority;
   }
 }
@@ -84,7 +66,7 @@ unsigned tms570_irq_get_priority(
   rtems_vector_number vector
 )
 {
-  if ( tms570_irq_is_valid(vector) ) {
+  if ( bsp_interrupt_is_valid_vector(vector) ) {
    return priorityTable[vector];
  }
  return 0;
@@ -114,17 +96,12 @@ void bsp_interrupt_dispatch(void)
  * @retval RTEMS_INVALID_ID vector is invalid.
  * @retval RTEMS_SUCCESSFUL interrupt source enabled.
  */
-rtems_status_code bsp_interrupt_vector_enable(
+void bsp_interrupt_vector_enable(
   rtems_vector_number vector
 )
 {
-  if( !tms570_irq_is_valid(vector) ) {
-    return RTEMS_INVALID_ID;
-  }
-
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
   TMS570_VIM.REQENASET[vector >> 5] = 1 << (vector & 0x1f);
-
-  return RTEMS_SUCCESSFUL;
 }
 
 /**
@@ -136,17 +113,12 @@ rtems_status_code bsp_interrupt_vector_enable(
  * @retval RTEMS_INVALID_ID vector is invalid.
  * @retval RTEMS_SUCCESSFUL interrupt source disabled.
  */
-rtems_status_code bsp_interrupt_vector_disable(
+void bsp_interrupt_vector_disable(
   rtems_vector_number vector
 )
 {
-  if( !tms570_irq_is_valid(vector) ) {
-    return RTEMS_INVALID_ID;
-  }
-
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
   TMS570_VIM.REQENACLR[vector >> 5] = 1 << (vector & 0x1f);
-
-  return RTEMS_SUCCESSFUL;
 }
 
 /**
diff --git a/c/src/lib/libbsp/epiphany/epiphany_sim/irq/irq.c b/c/src/lib/libbsp/epiphany/epiphany_sim/irq/irq.c
index 057a0f7e81..994e25bf0e 100644
--- a/c/src/lib/libbsp/epiphany/epiphany_sim/irq/irq.c
+++ b/c/src/lib/libbsp/epiphany/epiphany_sim/irq/irq.c
@@ -53,12 +53,12 @@ rtems_status_code bsp_interrupt_facility_initialize()
   return 0;
 }
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-  return 0;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-  return 0;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 }
diff --git a/c/src/lib/libbsp/i386/pc386/timer/timer.c b/c/src/lib/libbsp/i386/pc386/timer/timer.c
index 5bef139d38..16d3d66176 100644
--- a/c/src/lib/libbsp/i386/pc386/timer/timer.c
+++ b/c/src/lib/libbsp/i386/pc386/timer/timer.c
@@ -153,17 +153,12 @@ static void timerOn(const rtems_raw_irq_connect_data* used)
   bsp_interrupt_vector_enable(used->idtIndex - BSP_IRQ_VECTOR_BASE);
 }
 
-static int timerIsOn(const rtems_raw_irq_connect_data *used)
-{
-  return bsp_interrupt_vector_enable(used->idtIndex - BSP_IRQ_VECTOR_BASE);
-}
-
 static rtems_raw_irq_connect_data timer_raw_irq_data = {
   BSP_PERIODIC_TIMER + BSP_IRQ_VECTOR_BASE,
   timerisr,
   timerOn,
   timerOff,
-  timerIsOn
+  NULL
 };
 
 /*
diff --git a/c/src/lib/libbsp/i386/shared/comm/i386-stub-glue.c b/c/src/lib/libbsp/i386/shared/comm/i386-stub-glue.c
index 7802270140..d47d057860 100644
--- a/c/src/lib/libbsp/i386/shared/comm/i386-stub-glue.c
+++ b/c/src/lib/libbsp/i386/shared/comm/i386-stub-glue.c
@@ -173,11 +173,6 @@ static void BSP_uart_off(const rtems_raw_irq_connect_data* used)
   bsp_interrupt_vector_disable(used->idtIndex - BSP_IRQ_VECTOR_BASE);
 }
 
-static int BSP_uart_isOn(const rtems_raw_irq_connect_data* used)
-{
-  return bsp_interrupt_vector_enable(used->idtIndex - BSP_IRQ_VECTOR_BASE);
-}
-
 /*
  * In order to have a possibility to break into
  * running program, one has to call this function
@@ -210,7 +205,6 @@ void i386_stub_glue_init_breakin(void)
 
     uart_raw_irq_data.on  = BSP_uart_on;
     uart_raw_irq_data.off = BSP_uart_off;
-    uart_raw_irq_data.isOn= BSP_uart_isOn;
 
     /* Install ISR  */
     uart_raw_irq_data.idtIndex = port_current->ulIntVector + BSP_IRQ_VECTOR_BASE;
diff --git a/c/src/lib/libbsp/i386/shared/irq/irq.c b/c/src/lib/libbsp/i386/shared/irq/irq.c
index f4ffd8c0e4..ac08f1f7be 100644
--- a/c/src/lib/libbsp/i386/shared/irq/irq.c
+++ b/c/src/lib/libbsp/i386/shared/irq/irq.c
@@ -270,18 +270,16 @@ static inline bool bsp_interrupt_vector_is_valid(rtems_vector_number vector)
   return BSP_i8259a_irq_valid((const rtems_irq_number) vector);
 }
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-  if (bsp_interrupt_vector_is_valid(vector))
-    BSP_irq_enable_at_i8259a(vector);
-  return RTEMS_SUCCESSFUL;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+  BSP_irq_enable_at_i8259a(vector);
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-  if (bsp_interrupt_vector_is_valid(vector))
-    BSP_irq_disable_at_i8259a(vector);
-  return RTEMS_SUCCESSFUL;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+  BSP_irq_disable_at_i8259a(vector);
 }
 
 rtems_status_code bsp_interrupt_facility_initialize(void)
diff --git a/c/src/lib/libbsp/lm32/shared/irq/irq.c b/c/src/lib/libbsp/lm32/shared/irq/irq.c
index 8f9bfaf1ac..79626ee449 100644
--- a/c/src/lib/libbsp/lm32/shared/irq/irq.c
+++ b/c/src/lib/libbsp/lm32/shared/irq/irq.c
@@ -17,14 +17,14 @@ rtems_status_code bsp_interrupt_facility_initialize(void)
   return RTEMS_SUCCESSFUL;
 }
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
   lm32_interrupt_unmask(1 << vector);
-  return RTEMS_SUCCESSFUL;
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
   lm32_interrupt_mask(1 << vector);
-  return RTEMS_SUCCESSFUL;
 }
diff --git a/c/src/lib/libbsp/m68k/genmcf548x/irq/irq.c b/c/src/lib/libbsp/m68k/genmcf548x/irq/irq.c
index 58e904426a..f02231b67c 100644
--- a/c/src/lib/libbsp/m68k/genmcf548x/irq/irq.c
+++ b/c/src/lib/libbsp/m68k/genmcf548x/irq/irq.c
@@ -59,42 +59,30 @@ static rtems_vector_number vector_to_exception_vector(
   return vector + 64U;
 }
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-  rtems_status_code sc = RTEMS_SUCCESSFUL;
+  volatile uint32_t *imr = vector_to_imr(vector);
+  uint32_t bit = vector_to_bit(vector);
+  rtems_interrupt_level level;
 
-  if (bsp_interrupt_is_valid_vector(vector)) {
-    volatile uint32_t *imr = vector_to_imr(vector);
-    uint32_t bit = vector_to_bit(vector);
-    rtems_interrupt_level level;
-
-    rtems_interrupt_disable(level);
-    *imr &= ~bit;
-    rtems_interrupt_enable(level);
-  } else {
-    sc = RTEMS_INVALID_ID;
-  }
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 
-  return sc;
+  rtems_interrupt_disable(level);
+  *imr &= ~bit;
+  rtems_interrupt_enable(level);
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-  rtems_status_code sc = RTEMS_SUCCESSFUL;
+  volatile uint32_t *imr = vector_to_imr(vector);
+  uint32_t bit = vector_to_bit(vector);
+  rtems_interrupt_level level;
 
-  if (bsp_interrupt_is_valid_vector(vector)) {
-    volatile uint32_t *imr = vector_to_imr(vector);
-    uint32_t bit = vector_to_bit(vector);
-    rtems_interrupt_level level;
-
-    rtems_interrupt_disable(level);
-    *imr |= bit;
-    rtems_interrupt_enable(level);
-  } else {
-    sc = RTEMS_INVALID_ID;
-  }
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 
-  return sc;
+  rtems_interrupt_disable(level);
+  *imr |= bit;
+  rtems_interrupt_enable(level);
 }
 
 static void_func get_exception_handler(rtems_vector_number vector)
diff --git a/c/src/lib/libbsp/mips/shared/irq/irq.c b/c/src/lib/libbsp/mips/shared/irq/irq.c
index d4941763bc..1c2d3b8c5b 100644
--- a/c/src/lib/libbsp/mips/shared/irq/irq.c
+++ b/c/src/lib/libbsp/mips/shared/irq/irq.c
@@ -67,14 +67,14 @@ static inline bool bsp_irq_is_valid(rtems_vector_number vector)
   return vector <= BSP_INTERRUPT_VECTOR_MAX;
 }
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-  return RTEMS_SUCCESSFUL;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-  return RTEMS_SUCCESSFUL;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 }
 
 rtems_status_code bsp_interrupt_facility_initialize(void)
diff --git a/c/src/lib/libbsp/or1k/generic_or1k/irq/irq.c b/c/src/lib/libbsp/or1k/generic_or1k/irq/irq.c
index 00d53d7409..f9a7b6426d 100644
--- a/c/src/lib/libbsp/or1k/generic_or1k/irq/irq.c
+++ b/c/src/lib/libbsp/or1k/generic_or1k/irq/irq.c
@@ -32,12 +32,12 @@ rtems_status_code bsp_interrupt_facility_initialize()
   return 0;
 }
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-  return 0;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-  return 0;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 }
diff --git a/c/src/lib/libbsp/powerpc/gen5200/irq/irq.c b/c/src/lib/libbsp/powerpc/gen5200/irq/irq.c
index 029ed3182e..58e2f2a987 100644
--- a/c/src/lib/libbsp/powerpc/gen5200/irq/irq.c
+++ b/c/src/lib/libbsp/powerpc/gen5200/irq/irq.c
@@ -359,24 +359,26 @@ static inline void BSP_disable_crit_irq_at_siu( rtems_vector_number
 /*
  * This function enables a given siu interrupt
  */
-rtems_status_code bsp_interrupt_vector_enable( rtems_vector_number irqLine)
+void bsp_interrupt_vector_enable( rtems_vector_number vector)
 {
-  int base_index = get_siu_irq_base_index( irqLine);
+  int base_index = get_siu_irq_base_index( vector);
 
-  if (is_siu_irq( irqLine)) {
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+
+  if (is_siu_irq( vector)) {
     rtems_interrupt_level level;
 
     rtems_interrupt_disable( level);
 
     switch (base_index) {
       case BSP_PER_IRQ_LOWEST_OFFSET:
-        BSP_enable_per_irq_at_siu( irqLine);
+        BSP_enable_per_irq_at_siu( vector);
         break;
       case BSP_MAIN_IRQ_LOWEST_OFFSET:
-        BSP_enable_main_irq_at_siu( irqLine);
+        BSP_enable_main_irq_at_siu( vector);
         break;
       case BSP_CRIT_IRQ_LOWEST_OFFSET:
-        BSP_enable_crit_irq_at_siu( irqLine);
+        BSP_enable_crit_irq_at_siu( vector);
         break;
       default:
         rtems_interrupt_enable( level);
@@ -386,31 +388,31 @@ rtems_status_code bsp_interrupt_vector_enable( rtems_vector_number irqLine)
 
     rtems_interrupt_enable( level);
   }
-
-  return RTEMS_SUCCESSFUL;
 }
 
 /*
  * This function disables a given siu interrupt
  */
-rtems_status_code bsp_interrupt_vector_disable( rtems_vector_number irqLine)
+void bsp_interrupt_vector_disable( rtems_vector_number vector)
 {
-  int base_index = get_siu_irq_base_index( irqLine);
+  int base_index = get_siu_irq_base_index( vector);
 
-  if (is_siu_irq( irqLine)) {
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+
+  if (is_siu_irq( vector)) {
     rtems_interrupt_level level;
 
     rtems_interrupt_disable( level);
 
     switch (base_index) {
       case BSP_PER_IRQ_LOWEST_OFFSET:
-        BSP_disable_per_irq_at_siu( irqLine);
+        BSP_disable_per_irq_at_siu( vector);
         break;
       case BSP_MAIN_IRQ_LOWEST_OFFSET:
-        BSP_disable_main_irq_at_siu( irqLine);
+        BSP_disable_main_irq_at_siu( vector);
         break;
       case BSP_CRIT_IRQ_LOWEST_OFFSET:
-        BSP_disable_crit_irq_at_siu( irqLine);
+        BSP_disable_crit_irq_at_siu( vector);
         break;
       default:
         rtems_interrupt_enable( level);
@@ -420,8 +422,6 @@ rtems_status_code bsp_interrupt_vector_disable( rtems_vector_number irqLine)
 
     rtems_interrupt_enable( level);
   }
-
-  return RTEMS_SUCCESSFUL;
 }
 
 #if (BENCHMARK_IRQ_PROCESSING == 0)
diff --git a/c/src/lib/libbsp/powerpc/gen83xx/irq/irq.c b/c/src/lib/libbsp/powerpc/gen83xx/irq/irq.c
index 2d89cfa137..7a8ce3cc0b 100644
--- a/c/src/lib/libbsp/powerpc/gen83xx/irq/irq.c
+++ b/c/src/lib/libbsp/powerpc/gen83xx/irq/irq.c
@@ -376,11 +376,13 @@ rtems_status_code mpc83xx_ipic_set_highest_priority_interrupt(
 /*
  * functions to enable/disable a source at the ipic
  */
-rtems_status_code bsp_interrupt_vector_enable( rtems_vector_number irqnum)
+void bsp_interrupt_vector_enable( rtems_vector_number vector)
 {
-  rtems_vector_number vecnum = irqnum - BSP_IPIC_IRQ_LOWEST_OFFSET;
+  rtems_vector_number vecnum = vector - BSP_IPIC_IRQ_LOWEST_OFFSET;
   const BSP_isrc_rsc_t *rsc_ptr;
 
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+
   if (MPC83XX_IPIC_IS_VALID_VECTOR( vecnum)) {
     rsc_ptr = &mpc83xx_ipic_isrc_rsc [vecnum];
     if (rsc_ptr->mask_reg != NULL) {
@@ -392,15 +394,15 @@ rtems_status_code bsp_interrupt_vector_enable( rtems_vector_number irqnum)
       rtems_interrupt_enable(level);
     }
   }
-
-  return RTEMS_SUCCESSFUL;
 }
 
-rtems_status_code bsp_interrupt_vector_disable( rtems_vector_number irqnum)
+void bsp_interrupt_vector_disable( rtems_vector_number vector)
 {
-  rtems_vector_number vecnum = irqnum - BSP_IPIC_IRQ_LOWEST_OFFSET;
+  rtems_vector_number vecnum = vector - BSP_IPIC_IRQ_LOWEST_OFFSET;
   const BSP_isrc_rsc_t *rsc_ptr;
 
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+
   if (MPC83XX_IPIC_IS_VALID_VECTOR( vecnum)) {
     rsc_ptr = &mpc83xx_ipic_isrc_rsc [vecnum];
     if (rsc_ptr->mask_reg != NULL) {
@@ -412,8 +414,6 @@ rtems_status_code bsp_interrupt_vector_disable( rtems_vector_number irqnum)
       rtems_interrupt_enable(level);
     }
   }
-
-  return RTEMS_SUCCESSFUL;
 }
 
 /*
diff --git a/c/src/lib/libbsp/powerpc/mpc8260ads/irq/irq.c b/c/src/lib/libbsp/powerpc/mpc8260ads/irq/irq.c
index 52465ec2a7..c145186a52 100644
--- a/c/src/lib/libbsp/powerpc/mpc8260ads/irq/irq.c
+++ b/c/src/lib/libbsp/powerpc/mpc8260ads/irq/irq.c
@@ -328,28 +328,28 @@ BSP_CPM_irq_init(void)
 
 }
 
-rtems_status_code bsp_interrupt_vector_enable( rtems_vector_number irqnum)
+void bsp_interrupt_vector_enable( rtems_vector_number irqnum)
 {
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+
   if (is_cpm_irq(irqnum)) {
     /*
      * Enable interrupt at PIC level
      */
     BSP_irq_enable_at_cpm (irqnum);
   }
-
-  return RTEMS_SUCCESSFUL;
 }
 
-rtems_status_code bsp_interrupt_vector_disable( rtems_vector_number irqnum)
+void bsp_interrupt_vector_disable( rtems_vector_number irqnum)
 {
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+
   if (is_cpm_irq(irqnum)) {
     /*
      * disable interrupt at PIC level
      */
     BSP_irq_disable_at_cpm (irqnum);
   }
-
-  return RTEMS_SUCCESSFUL;
 }
 
 rtems_status_code bsp_interrupt_facility_initialize()
diff --git a/c/src/lib/libbsp/powerpc/psim/irq/irq_init.c b/c/src/lib/libbsp/powerpc/psim/irq/irq_init.c
index 59f0e1dcea..61600a9d62 100644
--- a/c/src/lib/libbsp/powerpc/psim/irq/irq_init.c
+++ b/c/src/lib/libbsp/powerpc/psim/irq/irq_init.c
@@ -102,16 +102,16 @@ static int psim_exception_handler(
 /*
  * functions to enable/disable a source at the ipic
  */
-rtems_status_code bsp_interrupt_vector_enable( rtems_vector_number irqnum)
+void bsp_interrupt_vector_enable( rtems_vector_number irqnum)
 {
   /* FIXME: do something */
-  return RTEMS_SUCCESSFUL;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 }
 
-rtems_status_code bsp_interrupt_vector_disable( rtems_vector_number irqnum)
+void bsp_interrupt_vector_disable( rtems_vector_number irqnum)
 {
   /* FIXME: do something */
-  return RTEMS_SUCCESSFUL;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 }
 
 rtems_status_code bsp_interrupt_facility_initialize(void)
diff --git a/c/src/lib/libbsp/powerpc/qemuppc/irq/irq_init.c b/c/src/lib/libbsp/powerpc/qemuppc/irq/irq_init.c
index f4592a375f..b5533e0872 100644
--- a/c/src/lib/libbsp/powerpc/qemuppc/irq/irq_init.c
+++ b/c/src/lib/libbsp/powerpc/qemuppc/irq/irq_init.c
@@ -38,16 +38,16 @@ static int qemuppc_exception_handler(
 /*
  * functions to enable/disable a source at the ipic
  */
-rtems_status_code bsp_interrupt_vector_enable( rtems_vector_number irqnum)
+void bsp_interrupt_vector_enable( rtems_vector_number irqnum)
 {
   /* FIXME: do something */
-  return RTEMS_SUCCESSFUL;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 }
 
-rtems_status_code bsp_interrupt_vector_disable( rtems_vector_number irqnum)
+void bsp_interrupt_vector_disable( rtems_vector_number irqnum)
 {
   /* FIXME: do something */
-  return RTEMS_SUCCESSFUL;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 }
 
 rtems_status_code bsp_interrupt_facility_initialize(void)
diff --git a/c/src/lib/libbsp/powerpc/qoriq/irq/irq.c b/c/src/lib/libbsp/powerpc/qoriq/irq/irq.c
index da7def3913..ea086215fc 100644
--- a/c/src/lib/libbsp/powerpc/qoriq/irq/irq.c
+++ b/c/src/lib/libbsp/powerpc/qoriq/irq/irq.c
@@ -175,28 +175,24 @@ rtems_status_code qoriq_pic_set_affinity(
 
 static rtems_status_code pic_vector_enable(rtems_vector_number vector, uint32_t msk)
 {
-	rtems_status_code sc = RTEMS_SUCCESSFUL;
-
-	if (bsp_interrupt_is_valid_vector(vector)) {
-		volatile qoriq_pic_src_cfg *src_cfg = get_src_cfg(vector);
-		rtems_interrupt_lock_context lock_context;
+	volatile qoriq_pic_src_cfg *src_cfg = get_src_cfg(vector);
+	rtems_interrupt_lock_context lock_context;
 
-		rtems_interrupt_lock_acquire(&lock, &lock_context);
-		src_cfg->vpr = (src_cfg->vpr & ~VPR_MSK) | msk;
-		rtems_interrupt_lock_release(&lock, &lock_context);
-	}
+	bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 
-	return sc;
+	rtems_interrupt_lock_acquire(&lock, &lock_context);
+	src_cfg->vpr = (src_cfg->vpr & ~VPR_MSK) | msk;
+	rtems_interrupt_lock_release(&lock, &lock_context);
 }
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-	return pic_vector_enable(vector, 0);
+	pic_vector_enable(vector, 0);
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-	return pic_vector_enable(vector, VPR_MSK);
+	pic_vector_enable(vector, VPR_MSK);
 }
 
 static void qoriq_interrupt_dispatch(void)
diff --git a/c/src/lib/libbsp/powerpc/t32mppc/irq/irq.c b/c/src/lib/libbsp/powerpc/t32mppc/irq/irq.c
index 3cabcdef35..0c98c3a27d 100644
--- a/c/src/lib/libbsp/powerpc/t32mppc/irq/irq.c
+++ b/c/src/lib/libbsp/powerpc/t32mppc/irq/irq.c
@@ -14,14 +14,14 @@
 
 #include <bsp/irq-generic.h>
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-	return RTEMS_INVALID_ID;
+	bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-	return RTEMS_INVALID_ID;
+	bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 }
 
 rtems_status_code bsp_interrupt_facility_initialize(void)
diff --git a/c/src/lib/libbsp/powerpc/tqm8xx/irq/irq.c b/c/src/lib/libbsp/powerpc/tqm8xx/irq/irq.c
index 8066a7f43b..2a94c27d1b 100644
--- a/c/src/lib/libbsp/powerpc/tqm8xx/irq/irq.c
+++ b/c/src/lib/libbsp/powerpc/tqm8xx/irq/irq.c
@@ -63,30 +63,26 @@ static rtems_status_code bsp_irq_enable_at_CPM(rtems_vector_number irqnum)
   return RTEMS_SUCCESSFUL;
 }
 
-rtems_status_code bsp_interrupt_vector_enable( rtems_vector_number irqnum)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-  if (BSP_IS_CPM_IRQ(irqnum)) {
-    bsp_irq_enable_at_CPM(irqnum);
-    return RTEMS_SUCCESSFUL;
-  }
-  else if (BSP_IS_SIU_IRQ(irqnum)) {
-    bsp_irq_enable_at_SIU(irqnum);
-    return RTEMS_SUCCESSFUL;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+
+  if (BSP_IS_CPM_IRQ(vector)) {
+    bsp_irq_enable_at_CPM(vector);
+  } else if (BSP_IS_SIU_IRQ(vector)) {
+    bsp_irq_enable_at_SIU(vector);
   }
-  return RTEMS_INVALID_ID;
 }
 
-rtems_status_code bsp_interrupt_vector_disable( rtems_vector_number irqnum)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-  if (BSP_IS_CPM_IRQ(irqnum)) {
-    bsp_irq_disable_at_CPM(irqnum);
-    return RTEMS_SUCCESSFUL;
-  }
-  else if (BSP_IS_SIU_IRQ(irqnum)) {
-    bsp_irq_disable_at_SIU(irqnum);
-    return RTEMS_SUCCESSFUL;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+
+  if (BSP_IS_CPM_IRQ(vector)) {
+    bsp_irq_disable_at_CPM(vector);
+  } else if (BSP_IS_SIU_IRQ(vector)) {
+    bsp_irq_disable_at_SIU(vector);
   }
-  return RTEMS_INVALID_ID;
 }
 
 /*
diff --git a/c/src/lib/libbsp/powerpc/virtex/irq/irq_init.c b/c/src/lib/libbsp/powerpc/virtex/irq/irq_init.c
index a9fe7066bc..55194cb1e6 100644
--- a/c/src/lib/libbsp/powerpc/virtex/irq/irq_init.c
+++ b/c/src/lib/libbsp/powerpc/virtex/irq/irq_init.c
@@ -132,34 +132,22 @@ static void opb_intc_init(void)
     (OPB_INTC_MER_HIE | OPB_INTC_MER_ME);
 }
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-  rtems_status_code sc = RTEMS_SUCCESSFUL;
-
-  if (bsp_interrupt_is_valid_vector(vector)) {
-    if (BSP_IS_OPBINTC_IRQ(vector)) {
-      BSP_irq_enable_at_opbintc(vector);
-    }
-  } else {
-    sc = RTEMS_INVALID_ID;
-  }
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 
-  return sc;
+  if (BSP_IS_OPBINTC_IRQ(vector)) {
+    BSP_irq_enable_at_opbintc(vector);
+  }
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-  rtems_status_code sc = RTEMS_SUCCESSFUL;
-
-  if (bsp_interrupt_is_valid_vector(vector)) {
-    if (BSP_IS_OPBINTC_IRQ(vector)) {
-      BSP_irq_disable_at_opbintc(vector);
-    }
-  } else {
-    sc = RTEMS_INVALID_ID;
-  }
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 
-  return sc;
+  if (BSP_IS_OPBINTC_IRQ(vector)) {
+    BSP_irq_disable_at_opbintc(vector);
+  }
 }
 
 static int C_dispatch_irq_handler(BSP_Exception_frame *frame, unsigned int excNum)
diff --git a/c/src/lib/libbsp/shared/include/irq-generic.h b/c/src/lib/libbsp/shared/include/irq-generic.h
index 4e89d74ab3..187aea84d1 100644
--- a/c/src/lib/libbsp/shared/include/irq-generic.h
+++ b/c/src/lib/libbsp/shared/include/irq-generic.h
@@ -9,7 +9,7 @@
 /*
  * Based on concepts of Pavel Pisa, Till Straumann and Eric Valette.
  *
- * Copyright (c) 2008-2014 embedded brains GmbH.
+ * Copyright (c) 2008, 2017 embedded brains GmbH.
  *
  *  embedded brains GmbH
  *  Dornierstr. 4
@@ -30,6 +30,7 @@
 #include <stdbool.h>
 
 #include <rtems/irq-extension.h>
+#include <rtems/score/assert.h>
 
 #ifdef RTEMS_SMP
   #include <rtems/score/atomic.h>
@@ -71,6 +72,8 @@ extern "C" {
   #define bsp_interrupt_fence(order) do { } while (0)
 #endif
 
+#define bsp_interrupt_assert(e) _Assert(e)
+
 struct bsp_interrupt_handler_entry {
   rtems_interrupt_handler handler;
   void *arg;
@@ -215,32 +218,33 @@ rtems_status_code bsp_interrupt_facility_initialize(void);
  *
  * This function shall enable the vector at the corresponding facility (in most
  * cases the interrupt controller).  It will be called then the first handler
- * is installed for the vector in bsp_interrupt_handler_install().  It is
- * guaranteed that the vector number is within the BSP_INTERRUPT_VECTOR_MIN and
- * BSP_INTERRUPT_VECTOR_MAX range.
+ * is installed for the vector in bsp_interrupt_handler_install() for example.
+ *
+ * @note The implementation should use
+ * bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector)) to valdiate the
+ * vector number.
  *
  * @note You must not install or remove an interrupt handler in this function.
  * This may result in a deadlock.
- *
- * @return On success RTEMS_SUCCESSFUL shall be returned.
  */
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector);
+void bsp_interrupt_vector_enable(rtems_vector_number vector);
 
 /**
  * @brief Disables the interrupt vector with number @a vector.
  *
  * This function shall disable the vector at the corresponding facility (in
  * most cases the interrupt controller).  It will be called then the last
- * handler is removed for the vector in bsp_interrupt_handler_remove().  It is
- * guaranteed that the vector number is within the BSP_INTERRUPT_VECTOR_MIN and
- * BSP_INTERRUPT_VECTOR_MAX range.
+ * handler is removed for the vector in bsp_interrupt_handler_remove() for
+ * example.
+ *
+ * @note The implementation should use
+ * bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector)) to valdiate the
+ * vector number.
  *
  * @note You must not install or remove an interrupt handler in this function.
  * This may result in a deadlock.
- *
- * @return On success RTEMS_SUCCESSFUL shall be returned.
  */
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector);
+void bsp_interrupt_vector_disable(rtems_vector_number vector);
 
 /**
  * @brief Sequencially calls all interrupt handlers for the vector number @a
diff --git a/c/src/lib/libbsp/shared/src/irq-generic.c b/c/src/lib/libbsp/shared/src/irq-generic.c
index b2a7ced64c..7f943d96cb 100755
--- a/c/src/lib/libbsp/shared/src/irq-generic.c
+++ b/c/src/lib/libbsp/shared/src/irq-generic.c
@@ -207,7 +207,6 @@ static rtems_status_code bsp_interrupt_handler_install(
   void *arg
 )
 {
-  rtems_status_code sc = RTEMS_SUCCESSFUL;
   rtems_interrupt_level level;
   rtems_vector_number index = 0;
   bsp_interrupt_handler_entry *head = NULL;
@@ -346,11 +345,7 @@ static rtems_status_code bsp_interrupt_handler_install(
 
   /* Enable the vector if necessary */
   if (enable_vector) {
-    sc = bsp_interrupt_vector_enable(vector);
-    if (sc != RTEMS_SUCCESSFUL) {
-      bsp_interrupt_unlock();
-      return sc;
-    }
+    bsp_interrupt_vector_enable(vector);
   }
 
   /* Unlock */
@@ -375,7 +370,6 @@ static rtems_status_code bsp_interrupt_handler_remove(
   void *arg
 )
 {
-  rtems_status_code sc = RTEMS_SUCCESSFUL;
   rtems_interrupt_level level;
   rtems_vector_number index = 0;
   bsp_interrupt_handler_entry *head = NULL;
@@ -446,7 +440,7 @@ static rtems_status_code bsp_interrupt_handler_remove(
        */
 
       /* Disable the vector */
-      sc = bsp_interrupt_vector_disable(vector);
+      bsp_interrupt_vector_disable(vector);
 
       /* Clear entry */
       bsp_interrupt_disable(level);
@@ -458,12 +452,6 @@ static rtems_status_code bsp_interrupt_handler_remove(
 
       /* Allow shared handlers */
       bsp_interrupt_set_handler_unique(index, false);
-
-      /* Check status code */
-      if (sc != RTEMS_SUCCESSFUL) {
-        bsp_interrupt_unlock();
-        return sc;
-      }
     } else {
       /*
        * The match is the list tail and has a predecessor.
diff --git a/c/src/lib/libbsp/shared/src/irq-server.c b/c/src/lib/libbsp/shared/src/irq-server.c
index 905c26198b..9a3ca9abf1 100644
--- a/c/src/lib/libbsp/shared/src/irq-server.c
+++ b/c/src/lib/libbsp/shared/src/irq-server.c
@@ -56,7 +56,9 @@ static void bsp_interrupt_server_trigger(void *arg)
   rtems_interrupt_lock_context lock_context;
   rtems_interrupt_server_entry *e = arg;
 
-  bsp_interrupt_vector_disable(e->vector);
+  if (bsp_interrupt_is_valid_vector(e->vector)) {
+    bsp_interrupt_vector_disable(e->vector);
+  }
 
   rtems_interrupt_lock_acquire(&bsp_interrupt_server_lock, &lock_context);
 
@@ -324,7 +326,9 @@ static void bsp_interrupt_server_task(rtems_task_argument arg)
         (*current->handler)(current->arg);
       } while (action != NULL);
 
-      bsp_interrupt_vector_enable(vector);
+      if (bsp_interrupt_is_valid_vector(vector)) {
+        bsp_interrupt_vector_enable(vector);
+      }
     }
   }
 }
diff --git a/c/src/lib/libbsp/sparc/shared/irq/irq-shared.c b/c/src/lib/libbsp/sparc/shared/irq/irq-shared.c
index f219e49f45..344ed71a34 100644
--- a/c/src/lib/libbsp/sparc/shared/irq/irq-shared.c
+++ b/c/src/lib/libbsp/sparc/shared/irq/irq-shared.c
@@ -70,20 +70,18 @@ rtems_status_code bsp_interrupt_facility_initialize(void)
   return RTEMS_SUCCESSFUL;
 }
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
   int irq = (int)vector;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
   BSP_Cpu_Unmask_interrupt(irq, bsp_irq_cpu(irq));
-
-  return RTEMS_SUCCESSFUL;
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
   int irq = (int)vector;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
   BSP_Cpu_Mask_interrupt(irq, bsp_irq_cpu(irq));
-
-  return RTEMS_SUCCESSFUL;
 }
 
 void BSP_shared_interrupt_mask(int irq)
diff --git a/c/src/lib/libcpu/arm/at91rm9200/irq/irq.c b/c/src/lib/libcpu/arm/at91rm9200/irq/irq.c
index 9ecdacfbb7..95e93845b9 100644
--- a/c/src/lib/libcpu/arm/at91rm9200/irq/irq.c
+++ b/c/src/lib/libcpu/arm/at91rm9200/irq/irq.c
@@ -27,18 +27,16 @@ void bsp_interrupt_dispatch(void)
   AIC_CTL_REG(AIC_EOICR) = 0;
 }
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
   AIC_CTL_REG(AIC_IECR) = 1 << vector;
-
-  return RTEMS_SUCCESSFUL;
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
   AIC_CTL_REG(AIC_IDCR) = 1 << vector;
-
-  return RTEMS_SUCCESSFUL;
 }
 
 rtems_status_code bsp_interrupt_facility_initialize(void)
diff --git a/c/src/lib/libcpu/arm/lpc22xx/irq/irq.c b/c/src/lib/libcpu/arm/lpc22xx/irq/irq.c
index 851705bee2..83e140bd7b 100644
--- a/c/src/lib/libcpu/arm/lpc22xx/irq/irq.c
+++ b/c/src/lib/libcpu/arm/lpc22xx/irq/irq.c
@@ -26,18 +26,16 @@ void bsp_interrupt_dispatch(void)
   VICVectAddr = 0;
 }
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
   VICIntEnable |= 1 << vector;
-
-  return RTEMS_SUCCESSFUL;
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
   VICIntEnClr = 1 << vector;
-
-  return RTEMS_SUCCESSFUL;
 }
 
 rtems_status_code bsp_interrupt_facility_initialize(void)
diff --git a/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c b/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c
index 2d6e34d274..e5887b9717 100644
--- a/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c
+++ b/c/src/lib/libcpu/arm/mc9328mxl/irq/irq.c
@@ -26,24 +26,20 @@ void bsp_interrupt_dispatch(void)
   bsp_interrupt_handler_dispatch(vector);
 }
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-  if (vector >= MC9328MXL_NUM_INTS)
-     return RTEMS_INVALID_ID;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 
-  MC9328MXL_AITC_INTENNUM = vector;
-
-  return RTEMS_SUCCESSFUL;
+  if (vector < MC9328MXL_NUM_INTS)
+    MC9328MXL_AITC_INTENNUM = vector;
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-  if (vector >= MC9328MXL_NUM_INTS)
-     return RTEMS_INVALID_ID;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 
-  MC9328MXL_AITC_INTDISNUM = vector;
-
-  return RTEMS_SUCCESSFUL;
+  if (vector < MC9328MXL_NUM_INTS)
+    MC9328MXL_AITC_INTDISNUM = vector;
 }
 
 rtems_status_code bsp_interrupt_facility_initialize(void)
diff --git a/c/src/lib/libcpu/arm/pxa255/irq/irq.c b/c/src/lib/libcpu/arm/pxa255/irq/irq.c
index 8b46ce149c..425795b165 100644
--- a/c/src/lib/libcpu/arm/pxa255/irq/irq.c
+++ b/c/src/lib/libcpu/arm/pxa255/irq/irq.c
@@ -24,18 +24,16 @@ void bsp_interrupt_dispatch(void)
   bsp_interrupt_handler_dispatch(vector);
 }
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
   XSCALE_INT_ICMR |= 1 << vector;
-
-  return RTEMS_SUCCESSFUL;
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
   XSCALE_INT_ICMR  &= ~(1 << vector);
-
-  return RTEMS_SUCCESSFUL;
 }
 
 rtems_status_code bsp_interrupt_facility_initialize(void)
diff --git a/c/src/lib/libcpu/arm/s3c24xx/irq/irq.c b/c/src/lib/libcpu/arm/s3c24xx/irq/irq.c
index dce6c383b9..ea8f610353 100644
--- a/c/src/lib/libcpu/arm/s3c24xx/irq/irq.c
+++ b/c/src/lib/libcpu/arm/s3c24xx/irq/irq.c
@@ -27,14 +27,14 @@ void bsp_interrupt_dispatch(void)
   bsp_interrupt_handler_dispatch(vector);
 }
 
-rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
+void bsp_interrupt_vector_enable(rtems_vector_number vector)
 {
-  return RTEMS_SUCCESSFUL;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 }
 
-rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
+void bsp_interrupt_vector_disable(rtems_vector_number vector)
 {
-  return RTEMS_SUCCESSFUL;
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
 }
 
 rtems_status_code bsp_interrupt_facility_initialize(void)
diff --git a/c/src/lib/libcpu/powerpc/mpc55xx/irq/irq.c b/c/src/lib/libcpu/powerpc/mpc55xx/irq/irq.c
index 59b2c39c59..789a19a490 100644
--- a/c/src/lib/libcpu/powerpc/mpc55xx/irq/irq.c
+++ b/c/src/lib/libcpu/powerpc/mpc55xx/irq/irq.c
@@ -180,20 +180,14 @@ rtems_status_code bsp_interrupt_facility_initialize(void)
 	return RTEMS_SUCCESSFUL;
 }
 
-rtems_status_code bsp_interrupt_vector_enable( rtems_vector_number vector)
+void bsp_interrupt_vector_enable( rtems_vector_number vector)
 {
-	if (MPC55XX_IRQ_IS_VALID( vector)) {
-		return mpc55xx_intc_set_priority( vector, MPC55XX_INTC_DEFAULT_PRIORITY);
-	} else {
-		return RTEMS_SUCCESSFUL;
-	}
+	bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+	mpc55xx_intc_set_priority( vector, MPC55XX_INTC_DEFAULT_PRIORITY);
 }
 
-rtems_status_code bsp_interrupt_vector_disable( rtems_vector_number vector)
+void bsp_interrupt_vector_disable( rtems_vector_number vector)
 {
-	if (MPC55XX_IRQ_IS_VALID( vector)) {
-		return mpc55xx_intc_set_priority( vector, MPC55XX_INTC_DISABLED_PRIORITY);
-	} else {
-		return RTEMS_SUCCESSFUL;
-	}
+	bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+	mpc55xx_intc_set_priority( vector, MPC55XX_INTC_DISABLED_PRIORITY);
 }
-- 
2.12.3



More information about the devel mailing list