[PATCH] bsps: Move declarations to <bsp/irq-generic.h>

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Mar 20 19:08:09 UTC 2024


Move declarations of bsp_interrupt_get_affinity() and
bsp_interrupt_set_affinity() to <bsp/irq-generic.h>.  Canonicalize the
<bsp/irq.h> includes.

Implement bsp_interrupt_get_affinity() and bsp_interrupt_set_affinity() only if
needed (usually RTEMS_SMP).

Provide stub implementations for i386 to fix build errors.
---
 bsps/aarch64/raspberrypi/include/bsp/irq.h | 28 ------------
 bsps/arm/raspberrypi/include/bsp/irq.h     | 28 ------------
 bsps/arm/raspberrypi/irq/irq.c             | 23 +++++++++-
 bsps/i386/shared/irq/irq.c                 | 33 ++++++++++++++
 bsps/include/bsp/irq-generic.h             | 52 +++++++++++++++++++++-
 bsps/include/dev/irq/arm-gic-irq.h         | 11 -----
 bsps/powerpc/qoriq/clock/clock-config.c    |  2 +-
 bsps/powerpc/qoriq/include/bsp/irq.h       | 11 -----
 bsps/powerpc/qoriq/irq/irq.c               |  1 -
 bsps/powerpc/t32mppc/include/bsp/irq.h     | 23 ----------
 bsps/powerpc/t32mppc/irq/irq.c             | 22 +++++++++
 bsps/riscv/griscv/clock/clockdrv.c         |  2 +-
 bsps/riscv/griscv/include/bsp/irq.h        | 13 ------
 bsps/riscv/griscv/irq/irq.c                |  1 -
 bsps/riscv/noel/include/bsp/irq.h          | 13 ------
 bsps/riscv/riscv/include/bsp/irq.h         | 13 ------
 bsps/riscv/riscv/irq/irq.c                 |  1 -
 bsps/shared/dev/irq/arm-gicv2.c            |  3 +-
 bsps/shared/dev/irq/arm-gicv3.c            |  3 +-
 bsps/shared/irq/irq-affinity.c             |  1 -
 bsps/sparc/erc32/include/bsp/irq.h         | 22 +--------
 bsps/sparc/leon3/clock/ckinit.c            |  3 +-
 bsps/sparc/leon3/include/bsp/irq.h         | 11 -----
 bsps/sparc/leon3/include/tm27.h            |  2 +-
 bsps/sparc/leon3/start/bspsmp.c            |  2 +-
 bsps/sparc/leon3/start/eirq.c              |  1 -
 bsps/sparc/shared/irq/irq-shared.c         | 22 +++++++++
 27 files changed, 160 insertions(+), 187 deletions(-)

diff --git a/bsps/aarch64/raspberrypi/include/bsp/irq.h b/bsps/aarch64/raspberrypi/include/bsp/irq.h
index effec1b040..1ff6ae80de 100644
--- a/bsps/aarch64/raspberrypi/include/bsp/irq.h
+++ b/bsps/aarch64/raspberrypi/include/bsp/irq.h
@@ -23,14 +23,8 @@
 #ifndef ASM
 
 #include <rtems.h>
-#include <rtems/irq.h>
-#include <rtems/irq-extension.h>
 #include <dev/irq/arm-gic-irq.h>
 
-#if defined(RTEMS_SMP)
-#include <rtems/score/processormask.h>
-#endif
-
 /**
  * @defgroup raspberrypi_interrupt Interrrupt Support
  *
@@ -83,27 +77,5 @@
 
 #define BSP_IRQ_COUNT               (BCM2835_INTC_TOTAL_IRQ)
 
-#if defined(RTEMS_SMP)
-static inline rtems_status_code bsp_interrupt_set_affinity(
-  rtems_vector_number   vector,
-  const Processor_mask *affinity
-)
-{
-  (void) vector;
-  (void) affinity;
-  return RTEMS_UNSATISFIED;
-}
-
-static inline rtems_status_code bsp_interrupt_get_affinity(
-  rtems_vector_number  vector,
-  Processor_mask      *affinity
-)
-{
-  (void) vector;
-  _Processor_mask_From_index( affinity, 0 );
-  return RTEMS_UNSATISFIED;
-}
-#endif
-
 #endif /* ASM */
 #endif /* LIBBSP_ARM_RASPBERRYPI_IRQ_H */
diff --git a/bsps/arm/raspberrypi/include/bsp/irq.h b/bsps/arm/raspberrypi/include/bsp/irq.h
index 6801b01d84..895b268dfe 100644
--- a/bsps/arm/raspberrypi/include/bsp/irq.h
+++ b/bsps/arm/raspberrypi/include/bsp/irq.h
@@ -22,12 +22,6 @@
 #ifndef ASM
 
 #include <rtems.h>
-#include <rtems/irq.h>
-#include <rtems/irq-extension.h>
-
-#if defined(RTEMS_SMP)
-#include <rtems/score/processormask.h>
-#endif
 
 /**
  * @defgroup raspberrypi_interrupt Interrrupt Support
@@ -78,27 +72,5 @@
 
 #define BSP_IRQ_COUNT               (BCM2835_INTC_TOTAL_IRQ)
 
-#if defined(RTEMS_SMP)
-static inline rtems_status_code bsp_interrupt_set_affinity(
-  rtems_vector_number   vector,
-  const Processor_mask *affinity
-)
-{
-  (void) vector;
-  (void) affinity;
-  return RTEMS_UNSATISFIED;
-}
-
-static inline rtems_status_code bsp_interrupt_get_affinity(
-  rtems_vector_number  vector,
-  Processor_mask      *affinity
-)
-{
-  (void) vector;
-  _Processor_mask_From_index( affinity, 0 );
-  return RTEMS_UNSATISFIED;
-}
-#endif
-
 #endif /* ASM */
 #endif /* LIBBSP_ARM_RASPBERRYPI_IRQ_H */
diff --git a/bsps/arm/raspberrypi/irq/irq.c b/bsps/arm/raspberrypi/irq/irq.c
index 30e10e5aec..7177cd2c05 100644
--- a/bsps/arm/raspberrypi/irq/irq.c
+++ b/bsps/arm/raspberrypi/irq/irq.c
@@ -19,7 +19,6 @@
 #include <rtems/score/armv4.h>
 
 #include <bsp.h>
-#include <bsp/irq.h>
 #include <bsp/irq-generic.h>
 #include <bsp/raspberrypi.h>
 #include <bsp/linker-symbols.h>
@@ -207,6 +206,28 @@ rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
   return RTEMS_SUCCESSFUL;
 }
 
+#if defined(RTEMS_SMP)
+rtems_status_code bsp_interrupt_get_affinity(
+  rtems_vector_number  vector,
+  Processor_mask      *affinity
+)
+{
+  (void) vector;
+  _Processor_mask_From_index( affinity, 0 );
+  return RTEMS_UNSATISFIED;
+}
+
+rtems_status_code bsp_interrupt_set_affinity(
+  rtems_vector_number   vector,
+  const Processor_mask *affinity
+)
+{
+  (void) vector;
+  (void) affinity;
+  return RTEMS_UNSATISFIED;
+}
+#endif
+
 void bsp_interrupt_handler_default(rtems_vector_number vector)
 {
     printk("spurious interrupt: %" PRIdrtems_vector_number "\n", vector);
diff --git a/bsps/i386/shared/irq/irq.c b/bsps/i386/shared/irq/irq.c
index fe43bc1d7c..57753c2f77 100644
--- a/bsps/i386/shared/irq/irq.c
+++ b/bsps/i386/shared/irq/irq.c
@@ -295,6 +295,17 @@ rtems_status_code bsp_interrupt_raise(rtems_vector_number vector)
   return RTEMS_UNSATISFIED;
 }
 
+#if defined(RTEMS_SMP)
+rtems_status_code bsp_interrupt_raise_on(
+  rtems_vector_number vector,
+  uint32_t            cpu_index
+)
+{
+  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
+  return RTEMS_UNSATISFIED;
+}
+#endif
+
 rtems_status_code bsp_interrupt_clear(rtems_vector_number vector)
 {
   bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
@@ -326,6 +337,28 @@ rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
   return RTEMS_SUCCESSFUL;
 }
 
+#if defined(RTEMS_SMP)
+rtems_status_code bsp_interrupt_get_affinity(
+  rtems_vector_number  vector,
+  Processor_mask      *affinity
+)
+{
+  (void) vector;
+  _Processor_mask_From_index( affinity, 0 );
+  return RTEMS_UNSATISFIED;
+}
+
+rtems_status_code bsp_interrupt_set_affinity(
+  rtems_vector_number   vector,
+  const Processor_mask *affinity
+)
+{
+  (void) vector;
+  (void) affinity;
+  return RTEMS_UNSATISFIED;
+}
+#endif
+
 void bsp_interrupt_facility_initialize(void)
 {
   int i;
diff --git a/bsps/include/bsp/irq-generic.h b/bsps/include/bsp/irq-generic.h
index 5ed9cac688..bd557df9dc 100644
--- a/bsps/include/bsp/irq-generic.h
+++ b/bsps/include/bsp/irq-generic.h
@@ -12,7 +12,7 @@
 /*
  * Copyright (C) 2016 Chris Johns <chrisj at rtems.org>
  *
- * Copyright (C) 2008, 2021 embedded brains GmbH & Co. KG
+ * Copyright (C) 2008, 2024 embedded brains GmbH & Co. KG
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -47,6 +47,7 @@
 
 #include <rtems/irq-extension.h>
 #include <rtems/score/assert.h>
+#include <rtems/score/processormask.h>
 
 #ifdef RTEMS_SMP
   #include <rtems/score/atomic.h>
@@ -372,6 +373,55 @@ rtems_status_code bsp_interrupt_raise_on(
  */
 rtems_status_code bsp_interrupt_clear( rtems_vector_number vector );
 
+/**
+ * @brief Gets the processor affinity set of the interrupt vector.
+ *
+ * The function may have no implementation in uniprocessor configurations.
+ *
+ * @param vector is the interrupt vector number.
+ *
+ * @param[out] affinity is the pointer to a Processor_mask object.  When the
+ *   directive call is successful, the processor affinity set of the interrupt
+ *   vector will be stored in this object.  A set bit in the processor set
+ *   means that the corresponding processor is in the processor affinity set of
+ *   the interrupt vector, otherwise the bit is cleared.
+ *
+ * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
+ *
+ * @retval ::RTEMS_UNSATISFIED The request to get the processor affinity of the
+ *   interrupt vector has not been satisfied.
+ */
+rtems_status_code bsp_interrupt_get_affinity(
+  rtems_vector_number  vector,
+  Processor_mask      *affinity
+);
+
+/**
+ * @brief Sets the processor affinity set of the interrupt vector.
+ *
+ * The function may have no implementation in uniprocessor configurations.
+ *
+ * @param vector is the interrupt vector number.  It shall be valid.
+ *
+ * @param affinity is the pointer to a Processor_mask object.  The processor set
+ *   defines the new processor affinity set of the interrupt vector.  A set bit
+ *   in the processor set means that the corresponding processor shall be in
+ *   the processor affinity set of the interrupt vector, otherwise the bit
+ *   shall be cleared.
+ *
+ * @retval ::RTEMS_SUCCESSFUL The requested operation was successful.
+ *
+ * @retval ::RTEMS_INVALID_NUMBER The referenced processor set was not a valid
+ *   new processor affinity set for the interrupt vector.
+ *
+ * @retval ::RTEMS_UNSATISFIED The request to set the processor affinity of the
+ *   interrupt vector has not been satisfied.
+ */
+rtems_status_code bsp_interrupt_set_affinity(
+  rtems_vector_number   vector,
+  const Processor_mask *affinity
+);
+
 #if defined(RTEMS_SMP)
 /**
  * @brief Handles a spurious interrupt.
diff --git a/bsps/include/dev/irq/arm-gic-irq.h b/bsps/include/dev/irq/arm-gic-irq.h
index b3487176f6..1fcf594360 100644
--- a/bsps/include/dev/irq/arm-gic-irq.h
+++ b/bsps/include/dev/irq/arm-gic-irq.h
@@ -38,7 +38,6 @@
 
 #include <bsp.h>
 #include <dev/irq/arm-gic.h>
-#include <rtems/score/processormask.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -85,16 +84,6 @@ rtems_status_code arm_gic_irq_get_group(
   gic_group *group
 );
 
-rtems_status_code bsp_interrupt_set_affinity(
-  rtems_vector_number vector,
-  const Processor_mask *affinity
-);
-
-rtems_status_code bsp_interrupt_get_affinity(
-  rtems_vector_number vector,
-  Processor_mask *affinity
-);
-
 void arm_gic_trigger_sgi(rtems_vector_number vector, uint32_t targets);
 
 static inline rtems_status_code arm_gic_irq_generate_software_irq(
diff --git a/bsps/powerpc/qoriq/clock/clock-config.c b/bsps/powerpc/qoriq/clock/clock-config.c
index 8ecc19ef0d..17347278f3 100644
--- a/bsps/powerpc/qoriq/clock/clock-config.c
+++ b/bsps/powerpc/qoriq/clock/clock-config.c
@@ -40,7 +40,7 @@
 #include <bsp.h>
 #include <bsp/fatal.h>
 #include <bsp/qoriq.h>
-#include <bsp/irq.h>
+#include <bsp/irq-generic.h>
 
 static struct timecounter qoriq_clock_tc;
 
diff --git a/bsps/powerpc/qoriq/include/bsp/irq.h b/bsps/powerpc/qoriq/include/bsp/irq.h
index 7419095438..5eaf36ba4c 100644
--- a/bsps/powerpc/qoriq/include/bsp/irq.h
+++ b/bsps/powerpc/qoriq/include/bsp/irq.h
@@ -37,7 +37,6 @@
 #define LIBBSP_POWERPC_QORIQ_IRQ_H
 
 #include <bsp.h>
-#include <rtems/score/processormask.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -409,16 +408,6 @@ rtems_status_code qoriq_pic_set_priority(
   int *old_priority
 );
 
-rtems_status_code bsp_interrupt_set_affinity(
-  rtems_vector_number vector,
-  const Processor_mask *affinity
-);
-
-rtems_status_code bsp_interrupt_get_affinity(
-  rtems_vector_number vector,
-  Processor_mask *affinity
-);
-
 rtems_status_code qoriq_pic_msi_allocate(rtems_vector_number *vector);
 
 rtems_status_code qoriq_pic_msi_free(rtems_vector_number vector);
diff --git a/bsps/powerpc/qoriq/irq/irq.c b/bsps/powerpc/qoriq/irq/irq.c
index 8d6afa6c12..2a5e3e9a75 100644
--- a/bsps/powerpc/qoriq/irq/irq.c
+++ b/bsps/powerpc/qoriq/irq/irq.c
@@ -43,7 +43,6 @@
 #include <asm/epapr_hcalls.h>
 
 #include <bsp.h>
-#include <bsp/irq.h>
 #include <bsp/irq-generic.h>
 #include <bsp/vectors.h>
 #include <bsp/utility.h>
diff --git a/bsps/powerpc/t32mppc/include/bsp/irq.h b/bsps/powerpc/t32mppc/include/bsp/irq.h
index be2e7a5883..e4f4614a53 100644
--- a/bsps/powerpc/t32mppc/include/bsp/irq.h
+++ b/bsps/powerpc/t32mppc/include/bsp/irq.h
@@ -29,9 +29,6 @@
 #define LIBBSP_POWERPC_T32MPPC_IRQ_H
 
 #include <rtems.h>
-#include <rtems/irq.h>
-#include <rtems/irq-extension.h>
-#include <rtems/score/processormask.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -39,26 +36,6 @@ extern "C" {
 
 #define BSP_INTERRUPT_VECTOR_COUNT 1
 
-static inline rtems_status_code bsp_interrupt_set_affinity(
-  rtems_vector_number   vector,
-  const Processor_mask *affinity
-)
-{
-  (void) vector;
-  (void) affinity;
-  return RTEMS_SUCCESSFUL;
-}
-
-static inline rtems_status_code bsp_interrupt_get_affinity(
-  rtems_vector_number  vector,
-  Processor_mask      *affinity
-)
-{
-  (void) vector;
-  _Processor_mask_From_index( affinity, 0 );
-  return RTEMS_SUCCESSFUL;
-}
-
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/bsps/powerpc/t32mppc/irq/irq.c b/bsps/powerpc/t32mppc/irq/irq.c
index 6bd37b3df4..a3f2504443 100644
--- a/bsps/powerpc/t32mppc/irq/irq.c
+++ b/bsps/powerpc/t32mppc/irq/irq.c
@@ -92,6 +92,28 @@ rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
 	return RTEMS_SUCCESSFUL;
 }
 
+#if defined(RTEMS_SMP)
+rtems_status_code bsp_interrupt_get_affinity(
+  rtems_vector_number  vector,
+  Processor_mask      *affinity
+)
+{
+  (void) vector;
+  _Processor_mask_From_index( affinity, 0 );
+  return RTEMS_UNSATISFIED;
+}
+
+rtems_status_code bsp_interrupt_set_affinity(
+  rtems_vector_number   vector,
+  const Processor_mask *affinity
+)
+{
+  (void) vector;
+  (void) affinity;
+  return RTEMS_UNSATISFIED;
+}
+#endif
+
 void bsp_interrupt_facility_initialize(void)
 {
 	/* Nothing to do */
diff --git a/bsps/riscv/griscv/clock/clockdrv.c b/bsps/riscv/griscv/clock/clockdrv.c
index 817cb331b6..3174bae468 100644
--- a/bsps/riscv/griscv/clock/clockdrv.c
+++ b/bsps/riscv/griscv/clock/clockdrv.c
@@ -41,7 +41,7 @@
 
 #include <bsp.h>
 #include <amba.h>
-#include <bsp/irq.h>
+#include <bsp/irq-generic.h>
 #include <bspopts.h>
 #include <bsp/fatal.h>
 #include <rtems/rtems/intr.h>
diff --git a/bsps/riscv/griscv/include/bsp/irq.h b/bsps/riscv/griscv/include/bsp/irq.h
index 9256e4ff3c..43ee019620 100644
--- a/bsps/riscv/griscv/include/bsp/irq.h
+++ b/bsps/riscv/griscv/include/bsp/irq.h
@@ -40,9 +40,6 @@
 #ifndef ASM
 
 #include <bsp.h>
-#include <rtems/irq.h>
-#include <rtems/irq-extension.h>
-#include <rtems/score/processormask.h>
 
 #define RISCV_INTERRUPT_VECTOR_SOFTWARE 0
 
@@ -56,16 +53,6 @@
 
 #define BSP_INTERRUPT_VECTOR_COUNT RISCV_INTERRUPT_VECTOR_EXTERNAL(RISCV_MAXIMUM_EXTERNAL_INTERRUPTS)
 
-rtems_status_code bsp_interrupt_set_affinity(
-  rtems_vector_number vector,
-  const Processor_mask *affinity
-);
-
-rtems_status_code bsp_interrupt_get_affinity(
-  rtems_vector_number vector,
-  Processor_mask *affinity
-);
-
 #endif /* ASM */
 
 #endif /* LIBBSP_RISCV_GRISCV_IRQ_H */
diff --git a/bsps/riscv/griscv/irq/irq.c b/bsps/riscv/griscv/irq/irq.c
index 507302d4dd..12af7d7b3d 100644
--- a/bsps/riscv/griscv/irq/irq.c
+++ b/bsps/riscv/griscv/irq/irq.c
@@ -34,7 +34,6 @@
  * SUCH DAMAGE.
  */
 
-#include <bsp/irq.h>
 #include <bsp/fatal.h>
 #include <bsp/irq-generic.h>
 #include <amba.h>
diff --git a/bsps/riscv/noel/include/bsp/irq.h b/bsps/riscv/noel/include/bsp/irq.h
index 0c0dc1a48e..3bbea3edfe 100644
--- a/bsps/riscv/noel/include/bsp/irq.h
+++ b/bsps/riscv/noel/include/bsp/irq.h
@@ -42,9 +42,6 @@
 #ifndef ASM
 
 #include <bsp.h>
-#include <rtems/irq.h>
-#include <rtems/irq-extension.h>
-#include <rtems/score/processormask.h>
 
 #define RISCV_INTERRUPT_VECTOR_SOFTWARE 0
 
@@ -60,16 +57,6 @@
 
 #define BSP_INTERRUPT_CUSTOM_VALID_VECTOR
 
-rtems_status_code bsp_interrupt_set_affinity(
-  rtems_vector_number vector,
-  const Processor_mask *affinity
-);
-
-rtems_status_code bsp_interrupt_get_affinity(
-  rtems_vector_number vector,
-  Processor_mask *affinity
-);
-
 #endif /* ASM */
 
 #endif /* LIBBSP_GENERIC_RISCV_IRQ_H */
diff --git a/bsps/riscv/riscv/include/bsp/irq.h b/bsps/riscv/riscv/include/bsp/irq.h
index 0c0dc1a48e..3bbea3edfe 100644
--- a/bsps/riscv/riscv/include/bsp/irq.h
+++ b/bsps/riscv/riscv/include/bsp/irq.h
@@ -42,9 +42,6 @@
 #ifndef ASM
 
 #include <bsp.h>
-#include <rtems/irq.h>
-#include <rtems/irq-extension.h>
-#include <rtems/score/processormask.h>
 
 #define RISCV_INTERRUPT_VECTOR_SOFTWARE 0
 
@@ -60,16 +57,6 @@
 
 #define BSP_INTERRUPT_CUSTOM_VALID_VECTOR
 
-rtems_status_code bsp_interrupt_set_affinity(
-  rtems_vector_number vector,
-  const Processor_mask *affinity
-);
-
-rtems_status_code bsp_interrupt_get_affinity(
-  rtems_vector_number vector,
-  Processor_mask *affinity
-);
-
 #endif /* ASM */
 
 #endif /* LIBBSP_GENERIC_RISCV_IRQ_H */
diff --git a/bsps/riscv/riscv/irq/irq.c b/bsps/riscv/riscv/irq/irq.c
index 4679d5a624..ada418b7fb 100644
--- a/bsps/riscv/riscv/irq/irq.c
+++ b/bsps/riscv/riscv/irq/irq.c
@@ -36,7 +36,6 @@
  * SUCH DAMAGE.
  */
 
-#include <bsp/irq.h>
 #include <bsp/fatal.h>
 #include <bsp/fdt.h>
 #include <bsp/irq-generic.h>
diff --git a/bsps/shared/dev/irq/arm-gicv2.c b/bsps/shared/dev/irq/arm-gicv2.c
index 8dc0895956..3cd27b2fa6 100644
--- a/bsps/shared/dev/irq/arm-gicv2.c
+++ b/bsps/shared/dev/irq/arm-gicv2.c
@@ -36,7 +36,6 @@
 #include <dev/irq/arm-gic.h>
 #include <dev/irq/arm-gic-arch.h>
 
-#include <bsp/irq.h>
 #include <bsp/irq-generic.h>
 #include <bsp/start.h>
 
@@ -328,6 +327,7 @@ rtems_status_code arm_gic_irq_get_group(
   return sc;
 }
 
+#ifdef RTEMS_SMP
 rtems_status_code bsp_interrupt_set_affinity(
   rtems_vector_number vector,
   const Processor_mask *affinity
@@ -387,6 +387,7 @@ rtems_status_code bsp_interrupt_get_affinity(
   _Processor_mask_From_uint32_t(affinity, targets, 0);
   return RTEMS_SUCCESSFUL;
 }
+#endif
 
 void arm_gic_trigger_sgi(rtems_vector_number vector, uint32_t targets)
 {
diff --git a/bsps/shared/dev/irq/arm-gicv3.c b/bsps/shared/dev/irq/arm-gicv3.c
index 108d64348a..f85582ccff 100644
--- a/bsps/shared/dev/irq/arm-gicv3.c
+++ b/bsps/shared/dev/irq/arm-gicv3.c
@@ -27,7 +27,6 @@
 
 #include <dev/irq/arm-gicv3.h>
 
-#include <bsp/irq.h>
 #include <bsp/irq-generic.h>
 #include <bsp/start.h>
 
@@ -242,6 +241,7 @@ rtems_status_code arm_gic_irq_get_priority(
   return sc;
 }
 
+#ifdef RTEMS_SMP
 rtems_status_code bsp_interrupt_set_affinity(
   rtems_vector_number vector,
   const Processor_mask *affinity
@@ -274,6 +274,7 @@ rtems_status_code bsp_interrupt_get_affinity(
   _Processor_mask_From_uint32_t(affinity, targets, 0);
   return RTEMS_SUCCESSFUL;
 }
+#endif
 
 void arm_gic_trigger_sgi(rtems_vector_number vector, uint32_t targets)
 {
diff --git a/bsps/shared/irq/irq-affinity.c b/bsps/shared/irq/irq-affinity.c
index 6c1522f77f..7e9250a948 100644
--- a/bsps/shared/irq/irq-affinity.c
+++ b/bsps/shared/irq/irq-affinity.c
@@ -36,7 +36,6 @@
 
 #include <bsp/irq-generic.h>
 
-#include <rtems/score/processormask.h>
 #include <rtems/score/smpimpl.h>
 
 rtems_status_code rtems_interrupt_set_affinity(
diff --git a/bsps/sparc/erc32/include/bsp/irq.h b/bsps/sparc/erc32/include/bsp/irq.h
index 1b021d1f9b..210883ad05 100644
--- a/bsps/sparc/erc32/include/bsp/irq.h
+++ b/bsps/sparc/erc32/include/bsp/irq.h
@@ -37,31 +37,11 @@
 #ifndef LIBBSP_ERC32_IRQ_CONFIG_H
 #define LIBBSP_ERC32_IRQ_CONFIG_H
 
-#include <rtems/score/processormask.h>
+#include <rtems.h>
 
 #define BSP_INTERRUPT_VECTOR_MAX_STD 15 /* Standard IRQ controller */
 #define BSP_INTERRUPT_VECTOR_COUNT (BSP_INTERRUPT_VECTOR_MAX_STD + 1)
 
 #define BSP_INTERRUPT_CUSTOM_VALID_VECTOR
 
-static inline rtems_status_code bsp_interrupt_set_affinity(
-  rtems_vector_number   vector,
-  const Processor_mask *affinity
-)
-{
-  (void) vector;
-  (void) affinity;
-  return RTEMS_SUCCESSFUL;
-}
-
-static inline rtems_status_code bsp_interrupt_get_affinity(
-  rtems_vector_number  vector,
-  Processor_mask      *affinity
-)
-{
-  (void) vector;
-  _Processor_mask_From_index( affinity, 0 );
-  return RTEMS_SUCCESSFUL;
-}
-
 #endif /* LIBBSP_ERC32_IRQ_CONFIG_H */
diff --git a/bsps/sparc/leon3/clock/ckinit.c b/bsps/sparc/leon3/clock/ckinit.c
index f0307bf908..503cb28bab 100644
--- a/bsps/sparc/leon3/clock/ckinit.c
+++ b/bsps/sparc/leon3/clock/ckinit.c
@@ -42,9 +42,8 @@
 
 #include <bsp.h>
 #include <bsp/fatal.h>
-#include <bsp/irq.h>
+#include <bsp/irq-generic.h>
 #include <bsp/leon3.h>
-#include <rtems/rtems/intr.h>
 #include <grlib/irqamp.h>
 #include <rtems/score/profiling.h>
 #include <rtems/timecounter.h>
diff --git a/bsps/sparc/leon3/include/bsp/irq.h b/bsps/sparc/leon3/include/bsp/irq.h
index 2e500622bf..dd6fd91aa1 100644
--- a/bsps/sparc/leon3/include/bsp/irq.h
+++ b/bsps/sparc/leon3/include/bsp/irq.h
@@ -38,7 +38,6 @@
 #define LIBBSP_LEON3_IRQ_CONFIG_H
 
 #include <rtems.h>
-#include <rtems/score/processormask.h>
 
 #define BSP_INTERRUPT_VECTOR_MAX_STD 15 /* Standard IRQ controller */
 #define BSP_INTERRUPT_VECTOR_MAX_EXT 31 /* Extended IRQ controller */
@@ -48,14 +47,4 @@
 /* The check is different depending on IRQ controller, runtime detected */
 #define BSP_INTERRUPT_CUSTOM_VALID_VECTOR
 
-rtems_status_code bsp_interrupt_set_affinity(
-  rtems_vector_number vector,
-  const Processor_mask *affinity
-);
-
-rtems_status_code bsp_interrupt_get_affinity(
-  rtems_vector_number vector,
-  Processor_mask *affinity
-);
-
 #endif /* LIBBSP_LEON3_IRQ_CONFIG_H */
diff --git a/bsps/sparc/leon3/include/tm27.h b/bsps/sparc/leon3/include/tm27.h
index 3de349f363..75004ef5ae 100644
--- a/bsps/sparc/leon3/include/tm27.h
+++ b/bsps/sparc/leon3/include/tm27.h
@@ -40,7 +40,7 @@
 #define __tm27_h
 
 #include <bsp.h>
-#include <bsp/irq.h>
+#include <bsp/irq-generic.h>
 
 #if defined(RTEMS_SMP)
 #include <rtems/score/smpimpl.h>
diff --git a/bsps/sparc/leon3/start/bspsmp.c b/bsps/sparc/leon3/start/bspsmp.c
index 8c7c88da63..82d6e5a163 100644
--- a/bsps/sparc/leon3/start/bspsmp.c
+++ b/bsps/sparc/leon3/start/bspsmp.c
@@ -16,7 +16,7 @@
 #include <bsp.h>
 #include <bsp/bootcard.h>
 #include <bsp/fatal.h>
-#include <bsp/irq.h>
+#include <bsp/irq-generic.h>
 #include <bsp/leon3.h>
 #include <rtems/bspIo.h>
 #include <rtems/sysinit.h>
diff --git a/bsps/sparc/leon3/start/eirq.c b/bsps/sparc/leon3/start/eirq.c
index 78a1baef25..a0934a7848 100644
--- a/bsps/sparc/leon3/start/eirq.c
+++ b/bsps/sparc/leon3/start/eirq.c
@@ -38,7 +38,6 @@
  *
  */
 
-#include <bsp/irq.h>
 #include <bsp/irq-generic.h>
 #include <bsp/irqimpl.h>
 
diff --git a/bsps/sparc/shared/irq/irq-shared.c b/bsps/sparc/shared/irq/irq-shared.c
index efa1d86020..18360b2b8e 100644
--- a/bsps/sparc/shared/irq/irq-shared.c
+++ b/bsps/sparc/shared/irq/irq-shared.c
@@ -140,3 +140,25 @@ rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
   BSP_Cpu_Mask_interrupt(vector, 0);
   return RTEMS_SUCCESSFUL;
 }
+
+#if defined(RTEMS_SMP)
+rtems_status_code bsp_interrupt_get_affinity(
+  rtems_vector_number  vector,
+  Processor_mask      *affinity
+)
+{
+  (void) vector;
+  _Processor_mask_From_index( affinity, 0 );
+  return RTEMS_UNSATISFIED;
+}
+
+rtems_status_code bsp_interrupt_set_affinity(
+  rtems_vector_number   vector,
+  const Processor_mask *affinity
+)
+{
+  (void) vector;
+  (void) affinity;
+  return RTEMS_UNSATISFIED;
+}
+#endif
-- 
2.35.3



More information about the devel mailing list