[PATCH 11/13] bsps: Add gicv3_sgi_ppi_set_priority()

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


---
 bsps/include/dev/irq/arm-gicv3.h | 11 +++++++++++
 bsps/shared/dev/irq/arm-gicv3.c  |  8 +++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/bsps/include/dev/irq/arm-gicv3.h b/bsps/include/dev/irq/arm-gicv3.h
index 73ad05a507..6f1d5254cc 100644
--- a/bsps/include/dev/irq/arm-gicv3.h
+++ b/bsps/include/dev/irq/arm-gicv3.h
@@ -191,6 +191,17 @@ static inline bool gicv3_sgi_ppi_is_enabled(
   return (sgi_ppi->icspiser[0] & (1U << vector)) != 0;
 }
 
+static inline void gicv3_sgi_ppi_set_priority(
+  rtems_vector_number vector,
+  uint8_t             priority,
+  uint32_t            cpu_index
+)
+{
+  volatile gic_sgi_ppi *sgi_ppi = gicv3_get_sgi_ppi(cpu_index);
+
+  sgi_ppi->icspiprior[vector] = priority;
+}
+
 static inline bool gicv3_sgi_ppi_is_pending(
   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 a34e2872e5..096864a35e 100644
--- a/bsps/shared/dev/irq/arm-gicv3.c
+++ b/bsps/shared/dev/irq/arm-gicv3.c
@@ -230,9 +230,11 @@ rtems_status_code arm_gic_irq_set_priority(
       volatile gic_dist *dist = ARM_GIC_DIST;
       gic_id_set_priority(dist, vector, priority);
     } else {
-      volatile gic_sgi_ppi *sgi_ppi =
-        gicv3_get_sgi_ppi(_SMP_Get_current_processor());
-      sgi_ppi->icspiprior[vector] = priority;
+      gicv3_sgi_ppi_set_priority(
+        vector,
+        priority,
+        _SMP_Get_current_processor()
+      );
     }
   } else {
     sc = RTEMS_INVALID_ID;
-- 
2.34.1



More information about the devel mailing list