[PATCH 07/13] bsps: Add gicv3_sgi_ppi_enable()

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Mar 18 07:19:09 UTC 2022


---
 bsps/include/dev/irq/arm-gicv3.h | 15 +++++++++++++++
 bsps/shared/dev/irq/arm-gicv3.c  | 10 +---------
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/bsps/include/dev/irq/arm-gicv3.h b/bsps/include/dev/irq/arm-gicv3.h
index 8bfa34c11e..effa7a8ffb 100644
--- a/bsps/include/dev/irq/arm-gicv3.h
+++ b/bsps/include/dev/irq/arm-gicv3.h
@@ -156,6 +156,21 @@ static inline volatile gic_sgi_ppi *gicv3_get_sgi_ppi(uint32_t cpu_index)
     ((uintptr_t)BSP_ARM_GIC_REDIST_BASE + cpu_index * 0x20000 + 0x10000);
 }
 
+static inline void gicv3_sgi_ppi_enable(
+  rtems_vector_number vector,
+  uint32_t            cpu_index
+)
+{
+  volatile gic_sgi_ppi *sgi_ppi = gicv3_get_sgi_ppi(cpu_index);
+
+  /* Set G1NS */
+  sgi_ppi->icspigrpr[0] |= 1U << vector;
+  sgi_ppi->icspigrpmodr[0] &= ~(1U << vector);
+
+  /* Set enable */
+  sgi_ppi->icspiser[0] = 1U << vector;
+}
+
 static inline bool gicv3_sgi_ppi_is_enabled(
   rtems_vector_number vector,
   uint32_t            cpu_index
diff --git a/bsps/shared/dev/irq/arm-gicv3.c b/bsps/shared/dev/irq/arm-gicv3.c
index bd0582b863..c71a9f15ab 100644
--- a/bsps/shared/dev/irq/arm-gicv3.c
+++ b/bsps/shared/dev/irq/arm-gicv3.c
@@ -177,15 +177,7 @@ rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
 
     gic_id_enable(dist, vector);
   } else {
-    volatile gic_sgi_ppi *sgi_ppi =
-      gicv3_get_sgi_ppi(_SMP_Get_current_processor());
-
-    /* Set G1NS */
-    sgi_ppi->icspigrpr[0] |= 1U << vector;
-    sgi_ppi->icspigrpmodr[0] &= ~(1U << vector);
-
-    /* Set enable */
-    sgi_ppi->icspiser[0] = 1U << vector;
+    gicv3_sgi_ppi_enable(vector, _SMP_Get_current_processor());
   }
 
   return RTEMS_SUCCESSFUL;
-- 
2.34.1



More information about the devel mailing list