From a9c20d2c53bf405dde42d8677a2378e4d0144c68 Mon Sep 17 00:00:00 2001
From: Armin Luntzer <armin.luntzer@univie.ac.at>
Date: Thu, 24 May 2018 15:43:09 +0200
Subject: [PATCH] add config compile options for backend calls

---
 arch/sparc/include/asm/leon.h |  9 ++++++++-
 arch/sparc/kernel/irq.c       | 23 ++++++++++++++++++-----
 2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/arch/sparc/include/asm/leon.h b/arch/sparc/include/asm/leon.h
index 8737d41..f1b0a43 100644
--- a/arch/sparc/include/asm/leon.h
+++ b/arch/sparc/include/asm/leon.h
@@ -192,11 +192,18 @@ static inline unsigned long leon_get_fp(void)
 }
 
 
-/* XXX need to make sure this trap is installed */ 
 __attribute__((unused))
+#ifdef CONFIG_ARCH_CUSTOM_BOOT_CODE
+#include <kernel/printk.h>
+#endif
 static inline void leon_reg_win_flush(void)
 {
+#ifdef CONFIG_ARCH_CUSTOM_BOOT_CODE
+	pr_warn("NOT IMPLEMENTED: leon_reg_win_flush() %s:%d\n", __FILE__, __LINE__);
+#else
+	/* BCC/libgloss provide such functionality via SW trap 3 */
 	__asm__ __volatile__("ta 3");
+#endif /* CONFIG_ARCH_CUSTOM_BOOT_CODE */
 }
 
 
diff --git a/arch/sparc/kernel/irq.c b/arch/sparc/kernel/irq.c
index 547093a..82d3729 100644
--- a/arch/sparc/kernel/irq.c
+++ b/arch/sparc/kernel/irq.c
@@ -263,8 +263,10 @@ static struct sobj_attribute *eirl_attributes[] = {
 #endif /* CONFIG_IRQ_STATS_COLLECT */
 
 
-/* XXX we use BCC's libgloss implementation for now */
+#ifndef CONFIG_ARCH_CUSTOM_BOOT_CODE
+/* provided by BCC's libgloss  */
 extern int catch_interrupt (int func, int irq);
+#endif /* CONFIG_ARCH_CUSTOM_BOOT_CODE */
 
 
 /**
@@ -470,7 +472,7 @@ void leon_irq_queue_execute(void)
  *
  * XXX maybe we want to keep acking IRQs as in eirq_dispatch...
  */
-
+__attribute__((unused))
 static int leon_irq_dispatch(unsigned int irq)
 {
 	struct irl_vector_elem *p_elem;
@@ -501,7 +503,7 @@ static int leon_irq_dispatch(unsigned int irq)
  *
  * @note handler return codes ignored for now
  */
-
+__attribute__((unused))
 static int leon_eirq_dispatch(unsigned int irq)
 {
 	unsigned int eirq;
@@ -626,8 +628,15 @@ int irl_register_handler(unsigned int irq,
 	leon_enable_irq(irq, 0);
 #endif /* CONFIG_LEON2 */
 
-	/* XXX this is the call to whatever the low level handler is */
+
+	/* here goes the call to whatever the low level handler is */
+#ifdef CONFIG_ARCH_CUSTOM_BOOT_CODE
+	pr_warn("NOT IMPLEMENTED: catch_interrupt() %s:%d\n", __FILE__, __LINE__);
+	return -1;
+#else
+	/* provided by BCC/libgloss */
 	return catch_interrupt(((int) leon_irq_dispatch), irq);
+#endif /* CONFIG_ARCH_CUSTOM_BOOT_CODE */
 }
 
 
@@ -908,8 +917,12 @@ static void leon_setup_eirq(void)
 	}
 
 	leon_eirq = eirq;
-
+#ifdef CONFIG_ARCH_CUSTOM_BOOT_CODE
+	pr_warn("NOT IMPLEMENTED: catch_interrupt() %s:%d\n", __FILE__, __LINE__);
+#else
+	/* provided by BCC/libgloss */
 	BUG_ON(catch_interrupt((int) leon_eirq_dispatch, leon_eirq));
+#endif /* CONFIG_ARCH_CUSTOM_BOOT_CODE */
 
 #ifdef CONFIG_LEON3
 	/* XXX for now, just register to the current CPU */
-- 
GitLab