[PATCH v1 2/3] bsps: Move ARM GICv2 driver to bsps/shared

Kinsey Moore kinsey.moore at oarcorp.com
Tue Dec 1 20:57:54 UTC 2020


This moves the ARM GICv2 driver to bsps/shared to be usable by AArch64
code.
---
 ...-gicv3-aarch64.c => irq-arm-gicvx-aarch64.c} |  2 +-
 ...-gicv3-aarch32.c => irq-arm-gicvx-aarch32.c} |  2 +-
 bsps/include/dev/irq/arm-gic-irq.h              |  4 ++--
 .../irq-gic.c => shared/dev/irq/arm-gicv2.c}    | 17 +++--------------
 bsps/shared/dev/irq/arm-gicv3.c                 |  2 +-
 .../lib/libbsp/arm/altera-cyclone-v/Makefile.am |  3 ++-
 c/src/lib/libbsp/arm/imx/Makefile.am            |  3 ++-
 .../lib/libbsp/arm/realview-pbx-a9/Makefile.am  |  3 ++-
 c/src/lib/libbsp/arm/xen/Makefile.am            |  3 ++-
 c/src/lib/libbsp/arm/xilinx-zynq/Makefile.am    |  3 ++-
 c/src/lib/libbsp/arm/xilinx-zynqmp/Makefile.am  |  3 ++-
 spec/build/bsps/aarch64/a53/obj.yml             |  2 +-
 .../arm/altera-cyclone-v/bspalteracyclonev.yml  |  3 ++-
 spec/build/bsps/arm/imx/bspimx.yml              |  3 ++-
 .../arm/realview-pbx-a9/bsprealviewpbxa9.yml    |  3 ++-
 spec/build/bsps/arm/xen/bspxen.yml              |  3 ++-
 spec/build/bsps/arm/xilinx-zynq/obj.yml         |  3 ++-
 .../bsps/arm/xilinx-zynqmp/bspxilinxzynqmp.yml  |  3 ++-
 18 files changed, 33 insertions(+), 32 deletions(-)
 rename bsps/aarch64/shared/irq/{irq-arm-gicv3-aarch64.c => irq-arm-gicvx-aarch64.c} (98%)
 rename bsps/arm/shared/irq/{irq-arm-gicv3-aarch32.c => irq-arm-gicvx-aarch32.c} (98%)
 rename bsps/{arm/shared/irq/irq-gic.c => shared/dev/irq/arm-gicv2.c} (95%)

diff --git a/bsps/aarch64/shared/irq/irq-arm-gicv3-aarch64.c b/bsps/aarch64/shared/irq/irq-arm-gicvx-aarch64.c
similarity index 98%
rename from bsps/aarch64/shared/irq/irq-arm-gicv3-aarch64.c
rename to bsps/aarch64/shared/irq/irq-arm-gicvx-aarch64.c
index fe74bf46bd..67839118e1 100644
--- a/bsps/aarch64/shared/irq/irq-arm-gicv3-aarch64.c
+++ b/bsps/aarch64/shared/irq/irq-arm-gicvx-aarch64.c
@@ -60,5 +60,5 @@ void arm_interrupt_facility_set_exception_handler(void)
 
 void bsp_interrupt_dispatch(void)
 {
-  gicv3_interrupt_dispatch();
+  gicvx_interrupt_dispatch();
 }
diff --git a/bsps/arm/shared/irq/irq-arm-gicv3-aarch32.c b/bsps/arm/shared/irq/irq-arm-gicvx-aarch32.c
similarity index 98%
rename from bsps/arm/shared/irq/irq-arm-gicv3-aarch32.c
rename to bsps/arm/shared/irq/irq-arm-gicvx-aarch32.c
index b805199ba9..b9267aecba 100644
--- a/bsps/arm/shared/irq/irq-arm-gicv3-aarch32.c
+++ b/bsps/arm/shared/irq/irq-arm-gicvx-aarch32.c
@@ -57,5 +57,5 @@ void arm_interrupt_facility_set_exception_handler(void)
 
 void bsp_interrupt_dispatch(void)
 {
-  gicv3_interrupt_dispatch();
+  gicvx_interrupt_dispatch();
 }
diff --git a/bsps/include/dev/irq/arm-gic-irq.h b/bsps/include/dev/irq/arm-gic-irq.h
index a97191faca..d63fce32d1 100644
--- a/bsps/include/dev/irq/arm-gic-irq.h
+++ b/bsps/include/dev/irq/arm-gic-irq.h
@@ -122,10 +122,10 @@ void arm_interrupt_facility_set_exception_handler(void);
 void arm_interrupt_handler_dispatch(rtems_vector_number vector);
 
 /**
- * This is the GICv3 interrupt dispatcher that is to be called from the
+ * This is the GICv1/GICv2/GICv3 interrupt dispatcher that is to be called from the
  * architecture-specific implementation of the IRQ handler.
  */
-void gicv3_interrupt_dispatch(void);
+void gicvx_interrupt_dispatch(void);
 
 static inline uint32_t arm_gic_irq_processor_count(void)
 {
diff --git a/bsps/arm/shared/irq/irq-gic.c b/bsps/shared/dev/irq/arm-gicv2.c
similarity index 95%
rename from bsps/arm/shared/irq/irq-gic.c
rename to bsps/shared/dev/irq/arm-gicv2.c
index 1a401b67b6..cba8982764 100644
--- a/bsps/arm/shared/irq/irq-gic.c
+++ b/bsps/shared/dev/irq/arm-gicv2.c
@@ -14,10 +14,6 @@
 
 #include <dev/irq/arm-gic.h>
 
-#include <rtems/score/armv4.h>
-
-#include <libcpu/arm-cp15.h>
-
 #include <bsp/irq.h>
 #include <bsp/irq-generic.h>
 #include <bsp/start.h>
@@ -53,7 +49,7 @@
 #define CPUIF_ICCICR GIC_CPUIF_ICCICR_ENABLE
 #endif
 
-void bsp_interrupt_dispatch(void)
+void gicvx_interrupt_dispatch(void)
 {
   volatile gic_cpuif *cpuif = GIC_CPUIF;
   uint32_t icciar = cpuif->icciar;
@@ -61,11 +57,7 @@ void bsp_interrupt_dispatch(void)
   rtems_vector_number spurious = 1023;
 
   if (vector != spurious) {
-    uint32_t psr = _ARMV4_Status_irq_enable();
-
-    bsp_interrupt_handler_dispatch(vector);
-
-    _ARMV4_Status_restore(psr);
+    arm_interrupt_handler_dispatch(vector);
 
     cpuif->icceoir = icciar;
   }
@@ -117,10 +109,7 @@ rtems_status_code bsp_interrupt_facility_initialize(void)
   uint32_t id_count = get_id_count(dist);
   uint32_t id;
 
-  arm_cp15_set_exception_handler(
-    ARM_EXCEPTION_IRQ,
-    _ARMV4_Exception_interrupt
-  );
+  arm_interrupt_facility_set_exception_handler();
 
   for (id = 0; id < id_count; id += 32) {
 #ifdef BSP_ARM_GIC_ENABLE_FIQ_FOR_GROUP_0
diff --git a/bsps/shared/dev/irq/arm-gicv3.c b/bsps/shared/dev/irq/arm-gicv3.c
index ad39872eb0..da19300b15 100644
--- a/bsps/shared/dev/irq/arm-gicv3.c
+++ b/bsps/shared/dev/irq/arm-gicv3.c
@@ -134,7 +134,7 @@
 #define ARM_GIC_REDIST ((volatile gic_redist *) BSP_ARM_GIC_REDIST_BASE)
 #define ARM_GIC_SGI_PPI (((volatile gic_sgi_ppi *) ((char*)BSP_ARM_GIC_REDIST_BASE + (1 << 16))))
 
-void gicv3_interrupt_dispatch(void)
+void gicvx_interrupt_dispatch(void)
 {
   uint32_t icciar = READ_SR(ICC_IAR1);
   rtems_vector_number vector = GIC_CPUIF_ICCIAR_ACKINTID_GET(icciar);
diff --git a/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am b/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am
index b2785988e0..22be647261 100644
--- a/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am
+++ b/c/src/lib/libbsp/arm/altera-cyclone-v/Makefile.am
@@ -62,7 +62,8 @@ endif
 
 # IRQ
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-default-handler.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/irq/irq-gic.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/irq/arm-gicv2.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/irq/irq-arm-gicvx-aarch32.c
 
 # Console
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/console-termios-init.c
diff --git a/c/src/lib/libbsp/arm/imx/Makefile.am b/c/src/lib/libbsp/arm/imx/Makefile.am
index c9537a773d..caef3c6170 100644
--- a/c/src/lib/libbsp/arm/imx/Makefile.am
+++ b/c/src/lib/libbsp/arm/imx/Makefile.am
@@ -51,7 +51,8 @@ endif
 
 # IRQ
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-default-handler.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/irq/irq-gic.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/irq/arm-gicv2.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/irq/irq-arm-gicvx-aarch32.c
 
 # Console
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/console-termios.c
diff --git a/c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am b/c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am
index 77b7db4cca..d1597068ef 100644
--- a/c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am
+++ b/c/src/lib/libbsp/arm/realview-pbx-a9/Makefile.am
@@ -56,7 +56,8 @@ endif
 
 # IRQ
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-default-handler.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/irq/irq-gic.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/irq/arm-gicv2.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/irq/irq-arm-gicvx-aarch32.c
 
 # Console
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/console-termios-init.c
diff --git a/c/src/lib/libbsp/arm/xen/Makefile.am b/c/src/lib/libbsp/arm/xen/Makefile.am
index c8f7eb4f20..e01c33deb5 100644
--- a/c/src/lib/libbsp/arm/xen/Makefile.am
+++ b/c/src/lib/libbsp/arm/xen/Makefile.am
@@ -35,7 +35,8 @@ librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/clock/arm-generic-tim
 librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/cache/cache-cp15.c
 # irq
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-default-handler.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/irq/irq-gic.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/irq/arm-gicv2.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/irq/irq-arm-gicvx-aarch32.c
 # console
 librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/xen/console/console.c
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/console-termios.c
diff --git a/c/src/lib/libbsp/arm/xilinx-zynq/Makefile.am b/c/src/lib/libbsp/arm/xilinx-zynq/Makefile.am
index 299e69c128..a4b9496630 100644
--- a/c/src/lib/libbsp/arm/xilinx-zynq/Makefile.am
+++ b/c/src/lib/libbsp/arm/xilinx-zynq/Makefile.am
@@ -55,7 +55,8 @@ endif
 
 # IRQ
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-default-handler.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/irq/irq-gic.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/irq/arm-gicv2.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/irq/irq-arm-gicvx-aarch32.c
 
 # Console
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/console-termios.c
diff --git a/c/src/lib/libbsp/arm/xilinx-zynqmp/Makefile.am b/c/src/lib/libbsp/arm/xilinx-zynqmp/Makefile.am
index f689c2e294..11d6ab8039 100644
--- a/c/src/lib/libbsp/arm/xilinx-zynqmp/Makefile.am
+++ b/c/src/lib/libbsp/arm/xilinx-zynqmp/Makefile.am
@@ -55,7 +55,8 @@ endif
 
 # IRQ
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/irq/irq-default-handler.c
-librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/irq/irq-gic.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/irq/arm-gicv2.c
+librtemsbsp_a_SOURCES += ../../../../../../bsps/arm/shared/irq/irq-arm-gicvx-aarch32.c
 
 # Console
 librtemsbsp_a_SOURCES += ../../../../../../bsps/shared/dev/serial/console-termios.c
diff --git a/spec/build/bsps/aarch64/a53/obj.yml b/spec/build/bsps/aarch64/a53/obj.yml
index b584a2413c..0d69b59416 100644
--- a/spec/build/bsps/aarch64/a53/obj.yml
+++ b/spec/build/bsps/aarch64/a53/obj.yml
@@ -30,7 +30,7 @@ source:
 - bsps/shared/start/sbrk.c
 - bsps/shared/dev/irq/arm-gicv3.c
 - bsps/shared/irq/irq-default-handler.c
-- bsps/aarch64/shared/irq/irq-arm-gicv3-aarch64.c
+- bsps/aarch64/shared/irq/irq-arm-gicvx-aarch64.c
 - bsps/shared/dev/btimer/btimer-cpucounter.c
 - bsps/shared/dev/clock/arm-generic-timer.c
 - bsps/aarch64/shared/clock/arm-generic-timer-aarch64.c
diff --git a/spec/build/bsps/arm/altera-cyclone-v/bspalteracyclonev.yml b/spec/build/bsps/arm/altera-cyclone-v/bspalteracyclonev.yml
index abe3d7f490..c6732c4d47 100644
--- a/spec/build/bsps/arm/altera-cyclone-v/bspalteracyclonev.yml
+++ b/spec/build/bsps/arm/altera-cyclone-v/bspalteracyclonev.yml
@@ -128,7 +128,8 @@ source:
 - bsps/arm/shared/clock/clock-a9mpcore.c
 - bsps/arm/shared/cp15/arm-cp15-set-exception-handler.c
 - bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c
-- bsps/arm/shared/irq/irq-gic.c
+- bsps/shared/dev/irq/arm-gicv2.c
+- bsps/arm/shared/irq/irq-arm-gicvx-aarch32.c
 - bsps/arm/shared/start/bsp-start-memcpy.S
 - bsps/shared/dev/btimer/btimer-stub.c
 - bsps/shared/dev/getentropy/getentropy-cpucounter.c
diff --git a/spec/build/bsps/arm/imx/bspimx.yml b/spec/build/bsps/arm/imx/bspimx.yml
index 6b3cfdbb2e..5f448682ed 100644
--- a/spec/build/bsps/arm/imx/bspimx.yml
+++ b/spec/build/bsps/arm/imx/bspimx.yml
@@ -97,7 +97,8 @@ source:
 - bsps/arm/shared/clock/arm-generic-timer-aarch32.c
 - bsps/arm/shared/cp15/arm-cp15-set-exception-handler.c
 - bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c
-- bsps/arm/shared/irq/irq-gic.c
+- bsps/shared/dev/irq/arm-gicv2.c
+- bsps/arm/shared/irq/irq-arm-gicvx-aarch32.c
 - bsps/arm/shared/start/bsp-start-memcpy.S
 - bsps/shared/dev/btimer/btimer-stub.c
 - bsps/shared/dev/getentropy/getentropy-cpucounter.c
diff --git a/spec/build/bsps/arm/realview-pbx-a9/bsprealviewpbxa9.yml b/spec/build/bsps/arm/realview-pbx-a9/bsprealviewpbxa9.yml
index 8e4dd318f2..6233aae2f0 100644
--- a/spec/build/bsps/arm/realview-pbx-a9/bsprealviewpbxa9.yml
+++ b/spec/build/bsps/arm/realview-pbx-a9/bsprealviewpbxa9.yml
@@ -67,7 +67,8 @@ source:
 - bsps/arm/shared/cp15/arm-cp15-set-exception-handler.c
 - bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c
 - bsps/arm/shared/fb/arm-pl111.c
-- bsps/arm/shared/irq/irq-gic.c
+- bsps/shared/dev/irq/arm-gicv2.c
+- bsps/arm/shared/irq/irq-arm-gicvx-aarch32.c
 - bsps/arm/shared/serial/arm-pl050.c
 - bsps/arm/shared/start/bsp-start-memcpy.S
 - bsps/shared/dev/btimer/btimer-stub.c
diff --git a/spec/build/bsps/arm/xen/bspxen.yml b/spec/build/bsps/arm/xen/bspxen.yml
index 59d3f8581e..3784315acd 100644
--- a/spec/build/bsps/arm/xen/bspxen.yml
+++ b/spec/build/bsps/arm/xen/bspxen.yml
@@ -63,7 +63,8 @@ source:
 - bsps/arm/shared/clock/arm-generic-timer-aarch32.c
 - bsps/arm/shared/cp15/arm-cp15-set-exception-handler.c
 - bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c
-- bsps/arm/shared/irq/irq-gic.c
+- bsps/shared/dev/irq/arm-gicv2.c
+- bsps/arm/shared/irq/irq-arm-gicvx-aarch32.c
 - bsps/arm/shared/start/bsp-start-memcpy.S
 - bsps/arm/xen/console/console.c
 - bsps/arm/xen/start/bspstart.c
diff --git a/spec/build/bsps/arm/xilinx-zynq/obj.yml b/spec/build/bsps/arm/xilinx-zynq/obj.yml
index 06e13e4ea1..c2dde615b8 100644
--- a/spec/build/bsps/arm/xilinx-zynq/obj.yml
+++ b/spec/build/bsps/arm/xilinx-zynq/obj.yml
@@ -24,7 +24,8 @@ source:
 - bsps/arm/shared/clock/clock-a9mpcore.c
 - bsps/arm/shared/cp15/arm-cp15-set-exception-handler.c
 - bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c
-- bsps/arm/shared/irq/irq-gic.c
+- bsps/shared/dev/irq/arm-gicv2.c
+- bsps/arm/shared/irq/irq-arm-gicvx-aarch32.c
 - bsps/arm/shared/start/bsp-start-memcpy.S
 - bsps/arm/xilinx-zynq/console/console-config.c
 - bsps/arm/xilinx-zynq/console/console-init.c
diff --git a/spec/build/bsps/arm/xilinx-zynqmp/bspxilinxzynqmp.yml b/spec/build/bsps/arm/xilinx-zynqmp/bspxilinxzynqmp.yml
index 8c8013db24..92da7904c9 100644
--- a/spec/build/bsps/arm/xilinx-zynqmp/bspxilinxzynqmp.yml
+++ b/spec/build/bsps/arm/xilinx-zynqmp/bspxilinxzynqmp.yml
@@ -79,7 +79,8 @@ source:
 - bsps/arm/shared/clock/arm-generic-timer-aarch32.c
 - bsps/arm/shared/cp15/arm-cp15-set-exception-handler.c
 - bsps/arm/shared/cp15/arm-cp15-set-ttb-entries.c
-- bsps/arm/shared/irq/irq-gic.c
+- bsps/shared/dev/irq/arm-gicv2.c
+- bsps/arm/shared/irq/irq-arm-gicvx-aarch32.c
 - bsps/arm/shared/start/bsp-start-memcpy.S
 - bsps/arm/xilinx-zynqmp/console/console-config.c
 - bsps/arm/xilinx-zynqmp/start/bspreset.c
-- 
2.20.1



More information about the devel mailing list