[PATCH 06/13] bsps: Add gicv3_sgi_ppi_is_enabled()

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


---
 bsps/include/dev/irq/arm-gicv3.h | 10 ++++++++++
 bsps/shared/dev/irq/arm-gicv3.c  |  5 +----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/bsps/include/dev/irq/arm-gicv3.h b/bsps/include/dev/irq/arm-gicv3.h
index 9cfbd8f207..8bfa34c11e 100644
--- a/bsps/include/dev/irq/arm-gicv3.h
+++ b/bsps/include/dev/irq/arm-gicv3.h
@@ -156,6 +156,16 @@ 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 bool gicv3_sgi_ppi_is_enabled(
+  rtems_vector_number vector,
+  uint32_t            cpu_index
+)
+{
+  volatile gic_sgi_ppi *sgi_ppi = gicv3_get_sgi_ppi(cpu_index);
+
+  return (sgi_ppi->icspiser[0] & (1U << vector)) != 0;
+}
+
 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 2978a0d5ad..bd0582b863 100644
--- a/bsps/shared/dev/irq/arm-gicv3.c
+++ b/bsps/shared/dev/irq/arm-gicv3.c
@@ -157,10 +157,7 @@ rtems_status_code bsp_interrupt_vector_is_enabled(
   bsp_interrupt_assert(enabled != NULL);
 
   if ( vector <= ARM_GIC_IRQ_PPI_LAST ) {
-    volatile gic_sgi_ppi *sgi_ppi =
-      gicv3_get_sgi_ppi(_SMP_Get_current_processor());
-
-    *enabled = (sgi_ppi->icspiser[0] & (1U << vector)) != 0;
+    *enabled = gicv3_sgi_ppi_is_enabled(vector, _SMP_Get_current_processor());
   } else {
     volatile gic_dist *dist = ARM_GIC_DIST;
 
-- 
2.34.1



More information about the devel mailing list