[PATCH v3 23/38] bsp/leon3: Add LEON3_IRQAMP_BASE

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


---
 bsps/sparc/leon3/include/bsp/irqimpl.h        |  6 ++++++
 bsps/sparc/leon3/start/amba.c                 |  9 ++++++++-
 spec/build/bsps/sparc/leon3/grp.yml           |  2 ++
 spec/build/bsps/sparc/leon3/optirqampbase.yml | 19 +++++++++++++++++++
 4 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 spec/build/bsps/sparc/leon3/optirqampbase.yml

diff --git a/bsps/sparc/leon3/include/bsp/irqimpl.h b/bsps/sparc/leon3/include/bsp/irqimpl.h
index c957c7fbbc..ee5beaf72c 100644
--- a/bsps/sparc/leon3/include/bsp/irqimpl.h
+++ b/bsps/sparc/leon3/include/bsp/irqimpl.h
@@ -41,6 +41,8 @@
 #include <grlib/irqamp-regs.h>
 #include <grlib/io.h>
 
+#include <bspopts.h>
+
 struct ambapp_dev;
 
 #ifdef __cplusplus
@@ -84,7 +86,11 @@ extern rtems_interrupt_lock LEON3_IrqCtrl_Lock;
 /**
  * @brief This pointer provides the IRQ(A)MP register block address.
  */
+#if defined(LEON3_IRQAMP_BASE)
+#define LEON3_IrqCtrl_Regs ((irqamp *) LEON3_IRQAMP_BASE)
+#else
 extern irqamp *LEON3_IrqCtrl_Regs;
+#endif
 
 /**
  * @brief This pointer provides the IRQ(A)MP device information block.
diff --git a/bsps/sparc/leon3/start/amba.c b/bsps/sparc/leon3/start/amba.c
index 36b988e90b..72f1f5e63b 100644
--- a/bsps/sparc/leon3/start/amba.c
+++ b/bsps/sparc/leon3/start/amba.c
@@ -115,9 +115,10 @@ RTEMS_SYSINIT_ITEM(
 );
 #endif
 
-/* Pointers to Interrupt Controller configuration registers */
+#if !defined(LEON3_IRQAMP_BASE)
 irqamp *LEON3_IrqCtrl_Regs;
 struct ambapp_dev *LEON3_IrqCtrl_Adev;
+#endif
 
 #if !defined(LEON3_GPTIMER_BASE)
 gptimer *LEON3_Timer_Regs;
@@ -140,7 +141,12 @@ static void amba_initialize(void)
   struct ambapp_bus *plb;
 
   plb = ambapp_plb();
+#if defined(LEON3_IRQAMP_BASE) && defined(LEON3_GPTIMER_BASE)
+  (void) plb;
+  (void) adev;
+#endif
 
+#if !defined(LEON3_IRQAMP_BASE)
   /* Find LEON3 Interrupt controller */
   adev = (void *)ambapp_for_each(plb, (OPTIONS_ALL|OPTIONS_APB_SLVS),
                                  VENDOR_GAISLER, GAISLER_IRQMP,
@@ -167,6 +173,7 @@ static void amba_initialize(void)
     icsel = (icsel >> ((7 - (LEON3_Cpu_Index & 0x7)) * 4)) & 0xf;
     LEON3_IrqCtrl_Regs += icsel;
   }
+#endif
 
 #if !defined(LEON3_GPTIMER_BASE)
   /* find GP Timer */
diff --git a/spec/build/bsps/sparc/leon3/grp.yml b/spec/build/bsps/sparc/leon3/grp.yml
index cce4c1dc06..7bb09d268f 100644
--- a/spec/build/bsps/sparc/leon3/grp.yml
+++ b/spec/build/bsps/sparc/leon3/grp.yml
@@ -36,6 +36,8 @@ links:
   uid: optapbuartbase
 - role: build-dependency
   uid: optgptimerbase
+- role: build-dependency
+  uid: optirqampbase
 - role: build-dependency
   uid: optconirq
 - role: build-dependency
diff --git a/spec/build/bsps/sparc/leon3/optirqampbase.yml b/spec/build/bsps/sparc/leon3/optirqampbase.yml
new file mode 100644
index 0000000000..aad978406b
--- /dev/null
+++ b/spec/build/bsps/sparc/leon3/optirqampbase.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: 0x80000200
+- enabled-by: sparc/gr740
+  value: 0xff904000
+enabled-by: true
+format: '{:#010x}'
+links: []
+name: LEON3_IRQAMP_BASE
+description: |
+  This option defines the base address of the IRQ(A)MP register block.
+type: build
-- 
2.35.3



More information about the devel mailing list