[PATCH v3 30/38] bsp/leon3: Add LEON3_IRQAMP_EXTENDED_INTERRUPT

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Jul 12 13:50:09 UTC 2023


---
 bsps/sparc/leon3/include/bsp/irqimpl.h        |  4 ++++
 bsps/sparc/leon3/start/eirq.c                 |  8 ++++++++
 spec/build/bsps/sparc/leon3/grp.yml           |  2 ++
 .../bsps/sparc/leon3/optirqampextirq.yml      | 19 +++++++++++++++++++
 4 files changed, 33 insertions(+)
 create mode 100644 spec/build/bsps/sparc/leon3/optirqampextirq.yml

diff --git a/bsps/sparc/leon3/include/bsp/irqimpl.h b/bsps/sparc/leon3/include/bsp/irqimpl.h
index ee5beaf72c..f5b0c205e0 100644
--- a/bsps/sparc/leon3/include/bsp/irqimpl.h
+++ b/bsps/sparc/leon3/include/bsp/irqimpl.h
@@ -103,7 +103,11 @@ extern struct ambapp_dev *LEON3_IrqCtrl_Adev;
  *
  * This object should be read-only after initialization.
  */
+#if defined(LEON3_IRQAMP_EXTENDED_INTERRUPT)
+#define LEON3_IrqCtrl_EIrq LEON3_IRQAMP_EXTENDED_INTERRUPT
+#else
 extern uint32_t LEON3_IrqCtrl_EIrq;
+#endif
 
 /**
  * @brief Initializes the interrupt controller for the boot processor.
diff --git a/bsps/sparc/leon3/start/eirq.c b/bsps/sparc/leon3/start/eirq.c
index 5576c37c22..05e6789f69 100644
--- a/bsps/sparc/leon3/start/eirq.c
+++ b/bsps/sparc/leon3/start/eirq.c
@@ -35,8 +35,10 @@
 #include <bsp/irq-generic.h>
 #include <bsp/irqimpl.h>
 
+#if !defined(LEON3_IRQAMP_EXTENDED_INTERRUPT)
 /* GRLIB extended IRQ controller IRQ number */
 uint32_t LEON3_IrqCtrl_EIrq;
+#endif
 
 rtems_interrupt_lock LEON3_IrqCtrl_Lock =
   RTEMS_INTERRUPT_LOCK_INITIALIZER("LEON3 IrqCtrl");
@@ -47,7 +49,9 @@ void leon3_ext_irq_init(irqamp *regs)
   grlib_store_32(&regs->pimask[LEON3_Cpu_Index], 0);
   grlib_store_32(&regs->piforce[LEON3_Cpu_Index], 0);
   grlib_store_32(&regs->iclear, 0xffffffff);
+#if !defined(LEON3_IRQAMP_EXTENDED_INTERRUPT)
   LEON3_IrqCtrl_EIrq = IRQAMP_MPSTAT_EIRQ_GET(grlib_load_32(&regs->mpstat));
+#endif
 }
 
 bool bsp_interrupt_is_valid_vector(rtems_vector_number vector)
@@ -56,11 +60,15 @@ bool bsp_interrupt_is_valid_vector(rtems_vector_number vector)
     return false;
   }
 
+#if defined(LEON3_IRQAMP_EXTENDED_INTERRUPT)
+  return vector <= BSP_INTERRUPT_VECTOR_MAX_EXT;
+#else
   if (LEON3_IrqCtrl_EIrq > 0) {
     return vector <= BSP_INTERRUPT_VECTOR_MAX_EXT;
   }
 
   return vector <= BSP_INTERRUPT_VECTOR_MAX_STD;
+#endif
 }
 
 #if defined(RTEMS_SMP)
diff --git a/spec/build/bsps/sparc/leon3/grp.yml b/spec/build/bsps/sparc/leon3/grp.yml
index 94d11bed55..126ba0df65 100644
--- a/spec/build/bsps/sparc/leon3/grp.yml
+++ b/spec/build/bsps/sparc/leon3/grp.yml
@@ -42,6 +42,8 @@ links:
   uid: optgptimerbase
 - role: build-dependency
   uid: optirqampbase
+- role: build-dependency
+  uid: optirqampextirq
 - role: build-dependency
   uid: optirqampts
 - role: build-dependency
diff --git a/spec/build/bsps/sparc/leon3/optirqampextirq.yml b/spec/build/bsps/sparc/leon3/optirqampextirq.yml
new file mode 100644
index 0000000000..61e077de5d
--- /dev/null
+++ b/spec/build/bsps/sparc/leon3/optirqampextirq.yml
@@ -0,0 +1,19 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+copyrights:
+- Copyright (C) 2021 embedded brains GmbH & Co. KG
+actions:
+- get-integer: null
+- format-and-define: null
+build-type: option
+default:
+- enabled-by: sparc/gr712rc
+  value: 12
+- enabled-by: sparc/gr740
+  value: 10
+enabled-by: true
+format: '{}'
+links: []
+name: LEON3_IRQAMP_EXTENDED_INTERRUPT
+description: |
+  This option specifies the interrupt line of the IRQ(A)MP extended interrupt.
+type: build
-- 
2.35.3



More information about the devel mailing list