Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Use an FDT-based ARM_INTR_IMPL for Tegra.



details:   https://anonhg.NetBSD.org/src/rev/812686051215
branches:  trunk
changeset: 824280:812686051215
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue May 30 22:00:25 2017 +0000

description:
Use an FDT-based ARM_INTR_IMPL for Tegra.

diffstat:

 sys/arch/arm/cortex/gic.c           |   6 +++-
 sys/arch/arm/cortex/gic_intr.h      |   4 ++-
 sys/arch/arm/fdt/arm_fdt.c          |  19 +++++++++++++-
 sys/arch/arm/fdt/arm_fdtvar.h       |   5 +++-
 sys/arch/arm/fdt/fdt_intr.h         |  48 +++++++++++++++++++++++++++++++++++++
 sys/arch/arm/fdt/gic_fdt.c          |   6 +++-
 sys/arch/arm/fdt/gtmr_fdt.c         |   6 ++--
 sys/arch/arm/nvidia/tegra_intr.h    |   8 +-----
 sys/arch/arm/nvidia/tegra_nouveau.c |   5 ++-
 sys/arch/evbarm/conf/std.tegra      |   4 +-
 10 files changed, 89 insertions(+), 22 deletions(-)

diffs (277 lines):

diff -r be47617bf22c -r 812686051215 sys/arch/arm/cortex/gic.c
--- a/sys/arch/arm/cortex/gic.c Tue May 30 21:12:41 2017 +0000
+++ b/sys/arch/arm/cortex/gic.c Tue May 30 22:00:25 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gic.c,v 1.20 2015/07/29 04:59:48 matt Exp $    */
+/*     $NetBSD: gic.c,v 1.21 2017/05/30 22:00:25 jmcneill Exp $        */
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
 #define _INTR_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.20 2015/07/29 04:59:48 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic.c,v 1.21 2017/05/30 22:00:25 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -51,6 +51,8 @@
 #include <arm/cortex/gic_reg.h>
 #include <arm/cortex/mpcore_var.h>
 
+void armgic_irq_handler(void *);
+
 #define        ARMGIC_SGI_IPIBASE      (16 - NIPI)
 
 static int armgic_match(device_t, cfdata_t, void *);
diff -r be47617bf22c -r 812686051215 sys/arch/arm/cortex/gic_intr.h
--- a/sys/arch/arm/cortex/gic_intr.h    Tue May 30 21:12:41 2017 +0000
+++ b/sys/arch/arm/cortex/gic_intr.h    Tue May 30 22:00:25 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: gic_intr.h,v 1.2 2014/04/09 16:59:53 matt Exp $        */
+/*     $NetBSD: gic_intr.h,v 1.3 2017/05/30 22:00:25 jmcneill Exp $    */
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -31,7 +31,9 @@
 #ifndef _ARM_CORTEX_GIC_INTR_H_
 #define _ARM_CORTEX_GIC_INTR_H_
 
+#ifndef ARM_IRQ_HANDLER
 #define        ARM_IRQ_HANDLER         _C_LABEL(armgic_irq_handler)
+#endif
 
 #ifndef _LOCORE
 
diff -r be47617bf22c -r 812686051215 sys/arch/arm/fdt/arm_fdt.c
--- a/sys/arch/arm/fdt/arm_fdt.c        Tue May 30 21:12:41 2017 +0000
+++ b/sys/arch/arm/fdt/arm_fdt.c        Tue May 30 22:00:25 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm_fdt.c,v 1.2 2017/05/30 21:12:41 jmcneill Exp $ */
+/* $NetBSD: arm_fdt.c,v 1.3 2017/05/30 22:00:25 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: arm_fdt.c,v 1.2 2017/05/30 21:12:41 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm_fdt.c,v 1.3 2017/05/30 22:00:25 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -60,6 +60,8 @@
 static TAILQ_HEAD(, arm_fdt_cpu_hatch_cb) arm_fdt_cpu_hatch_cbs =
     TAILQ_HEAD_INITIALIZER(arm_fdt_cpu_hatch_cbs);
 
+static void (*_arm_fdt_irq_handler)(void *) = NULL;
+
 int
 arm_fdt_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -128,3 +130,16 @@
        TAILQ_FOREACH(c, &arm_fdt_cpu_hatch_cbs, next)
                c->cb(c->priv, ci);
 }
+
+void
+arm_fdt_irq_set_handler(void (*irq_handler)(void *))
+{
+       KASSERT(_arm_fdt_irq_handler == NULL);
+       _arm_fdt_irq_handler = irq_handler;
+}
+
+void
+arm_fdt_irq_handler(void *tf)
+{
+       _arm_fdt_irq_handler(tf);
+}
diff -r be47617bf22c -r 812686051215 sys/arch/arm/fdt/arm_fdtvar.h
--- a/sys/arch/arm/fdt/arm_fdtvar.h     Tue May 30 21:12:41 2017 +0000
+++ b/sys/arch/arm/fdt/arm_fdtvar.h     Tue May 30 22:00:25 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm_fdtvar.h,v 1.2 2017/05/30 21:12:41 jmcneill Exp $ */
+/* $NetBSD: arm_fdtvar.h,v 1.3 2017/05/30 22:00:25 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -66,4 +66,7 @@
 void    arm_fdt_cpu_hatch_register(void *, void (*)(void *, struct cpu_info *));
 void    arm_fdt_cpu_hatch(struct cpu_info *);
 
+void   arm_fdt_irq_set_handler(void (*)(void *));
+void   arm_fdt_irq_handler(void *);
+
 #endif /* !_ARM_ARM_FDTVAR_H */
diff -r be47617bf22c -r 812686051215 sys/arch/arm/fdt/fdt_intr.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/fdt/fdt_intr.h       Tue May 30 22:00:25 2017 +0000
@@ -0,0 +1,48 @@
+/* $NetBSD: fdt_intr.h,v 1.1 2017/05/30 22:00:25 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _ARM_FDT_INTR_H
+#define _ARM_FDT_INTR_H
+
+#define        ARM_IRQ_HANDLER         _C_LABEL(arm_fdt_irq_handler)
+
+#ifndef _LOCORE
+
+#define        __HAVE_PIC_SET_PRIORITY
+
+#define        PIC_MAXSOURCES          256
+#define        PIC_MAXMAXSOURCES       (PIC_MAXSOURCES + 32)
+
+void   arm_fdt_irq_set_handler(void (*)(void *));
+void   arm_fdt_irq_handler(void *);
+
+#include <arm/pic/picvar.h>
+
+#endif
+
+#endif /* _ARM_FDT_INTR_H */
diff -r be47617bf22c -r 812686051215 sys/arch/arm/fdt/gic_fdt.c
--- a/sys/arch/arm/fdt/gic_fdt.c        Tue May 30 21:12:41 2017 +0000
+++ b/sys/arch/arm/fdt/gic_fdt.c        Tue May 30 22:00:25 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_fdt.c,v 1.3 2017/05/28 00:40:20 jmcneill Exp $ */
+/* $NetBSD: gic_fdt.c,v 1.4 2017/05/30 22:00:25 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.3 2017/05/28 00:40:20 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.4 2017/05/30 22:00:25 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -129,6 +129,8 @@
        };
 
        config_found(self, &mpcaa, NULL);
+
+       arm_fdt_irq_set_handler(armgic_irq_handler);
 }
 
 static void *
diff -r be47617bf22c -r 812686051215 sys/arch/arm/fdt/gtmr_fdt.c
--- a/sys/arch/arm/fdt/gtmr_fdt.c       Tue May 30 21:12:41 2017 +0000
+++ b/sys/arch/arm/fdt/gtmr_fdt.c       Tue May 30 22:00:25 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gtmr_fdt.c,v 1.2 2017/05/30 21:12:41 jmcneill Exp $ */
+/* $NetBSD: gtmr_fdt.c,v 1.3 2017/05/30 22:00:25 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gtmr_fdt.c,v 1.2 2017/05/30 21:12:41 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gtmr_fdt.c,v 1.3 2017/05/30 22:00:25 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -37,7 +37,7 @@
 #include <sys/kernel.h>
 #include <sys/kmem.h>
 
-#include <arm/cortex/gic_intr.h>
+#include <arm/cortex/gtmr_intr.h>
 #include <arm/cortex/mpcore_var.h>
 #include <arm/cortex/gtmr_var.h>
 
diff -r be47617bf22c -r 812686051215 sys/arch/arm/nvidia/tegra_intr.h
--- a/sys/arch/arm/nvidia/tegra_intr.h  Tue May 30 21:12:41 2017 +0000
+++ b/sys/arch/arm/nvidia/tegra_intr.h  Tue May 30 22:00:25 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_intr.h,v 1.11 2015/11/21 22:55:32 jmcneill Exp $ */
+/* $NetBSD: tegra_intr.h,v 1.12 2017/05/30 22:00:25 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,12 +29,6 @@
 #ifndef _ARM_TEGRA_INTR_H
 #define _ARM_TEGRA_INTR_H
 
-#define PIC_MAXSOURCES         256
-#define PIC_MAXMAXSOURCES      (PIC_MAXSOURCES + 32)
-
-#include <arm/cortex/gic_intr.h>
-#include <arm/cortex/gtmr_intr.h>
-
 #define TEGRA_INTR(x)          ((x) + 32)
 
 #define TEGRA_INTR_TMR1                TEGRA_INTR(0)
diff -r be47617bf22c -r 812686051215 sys/arch/arm/nvidia/tegra_nouveau.c
--- a/sys/arch/arm/nvidia/tegra_nouveau.c       Tue May 30 21:12:41 2017 +0000
+++ b/sys/arch/arm/nvidia/tegra_nouveau.c       Tue May 30 22:00:25 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_nouveau.c,v 1.9 2015/12/22 22:10:36 jmcneill Exp $ */
+/* $NetBSD: tegra_nouveau.c,v 1.10 2017/05/30 22:00:25 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_nouveau.c,v 1.9 2015/12/22 22:10:36 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_nouveau.c,v 1.10 2017/05/30 22:00:25 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -40,6 +40,7 @@
 #include <arm/nvidia/tegra_reg.h>
 #include <arm/nvidia/tegra_pmcreg.h>
 #include <arm/nvidia/tegra_var.h>
+#include <arm/nvidia/tegra_intr.h>
 
 #include <dev/fdt/fdtvar.h>
 
diff -r be47617bf22c -r 812686051215 sys/arch/evbarm/conf/std.tegra
--- a/sys/arch/evbarm/conf/std.tegra    Tue May 30 21:12:41 2017 +0000
+++ b/sys/arch/evbarm/conf/std.tegra    Tue May 30 22:00:25 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: std.tegra,v 1.12 2015/12/22 22:10:36 jmcneill Exp $
+#      $NetBSD: std.tegra,v 1.13 2017/05/30 22:00:25 jmcneill Exp $
 #
 
 machine        evbarm arm
@@ -26,5 +26,5 @@
 makeoptions    BOARDTYPE="tegra"
 makeoptions    BOARDMKFRAG="${THISARM}/conf/mk.tegra"
 
-options        ARM_INTR_IMPL="<arch/arm/nvidia/tegra_intr.h>"
+options        ARM_INTR_IMPL="<arch/arm/fdt/fdt_intr.h>"
 options                ARM_GENERIC_TODR



Home | Main Index | Thread Index | Old Index