svn commit: r258772 - in projects/specific_leg/sys: arm/arm arm/broadcom/bcm2835 arm/include arm/ti conf dev/fdt
Andrew Turner
andrew at FreeBSD.org
Sat Nov 30 17:31:07 UTC 2013
Author: andrew
Date: Sat Nov 30 17:31:04 2013
New Revision: 258772
URL: http://svnweb.freebsd.org/changeset/base/258772
Log:
Update the interrupt handling code.
- arm_mask_irq, etc. have been moved to the platform code.
- The interrupt decode code is being moved to a common file in sys/dev/fdt
Added:
projects/specific_leg/sys/dev/fdt/fdt_arm.c (contents, props changed)
Deleted:
projects/specific_leg/sys/arm/broadcom/bcm2835/common.c
projects/specific_leg/sys/arm/ti/common.c
Modified:
projects/specific_leg/sys/arm/arm/gic.c
projects/specific_leg/sys/arm/arm/platform.c
projects/specific_leg/sys/arm/arm/platform_if.m
projects/specific_leg/sys/arm/broadcom/bcm2835/bcm2835_intr.c
projects/specific_leg/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
projects/specific_leg/sys/arm/broadcom/bcm2835/files.bcm2835
projects/specific_leg/sys/arm/include/intr.h
projects/specific_leg/sys/arm/ti/files.ti
projects/specific_leg/sys/arm/ti/ti_machdep.c
projects/specific_leg/sys/conf/files.arm
Modified: projects/specific_leg/sys/arm/arm/gic.c
==============================================================================
--- projects/specific_leg/sys/arm/arm/gic.c Sat Nov 30 17:25:00 2013 (r258771)
+++ projects/specific_leg/sys/arm/arm/gic.c Sat Nov 30 17:31:04 2013 (r258772)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mutex.h>
#include <machine/bus.h>
#include <machine/intr.h>
+#include <machine/platformvar.h>
#include <machine/smp.h>
#include <dev/fdt/fdt_common.h>
@@ -250,7 +251,7 @@ gic_post_filter(void *arg)
}
int
-arm_get_next_irq(int last_irq)
+gic_get_next_irq(platform_t plat, int last_irq)
{
uint32_t active_irq;
@@ -276,7 +277,7 @@ arm_get_next_irq(int last_irq)
}
void
-arm_mask_irq(uintptr_t nb)
+gic_mask_irq(platform_t plat, uintptr_t nb)
{
gic_d_write_4(GICD_ICENABLER(nb >> 5), (1UL << (nb & 0x1F)));
@@ -284,7 +285,7 @@ arm_mask_irq(uintptr_t nb)
}
void
-arm_unmask_irq(uintptr_t nb)
+gic_unmask_irq(platform_t plat, uintptr_t nb)
{
gic_d_write_4(GICD_ISENABLER(nb >> 5), (1UL << (nb & 0x1F)));
Modified: projects/specific_leg/sys/arm/arm/platform.c
==============================================================================
--- projects/specific_leg/sys/arm/arm/platform.c Sat Nov 30 17:25:00 2013 (r258771)
+++ projects/specific_leg/sys/arm/arm/platform.c Sat Nov 30 17:31:04 2013 (r258772)
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
#include <vm/vm_page.h>
#include <machine/cpu.h>
+#include <machine/intr.h>
#include <machine/md_var.h>
#include <machine/platform.h>
#include <machine/platformvar.h>
@@ -166,3 +167,21 @@ platform_late_init(void)
PLATFORM_LATE_INIT(plat_obj);
}
+int
+arm_get_next_irq(int last)
+{
+ return PLATFORM_GET_NEXT_IRQ(plat_obj, last);
+}
+
+void
+arm_mask_irq(uintptr_t irq)
+{
+ PLATFORM_MASK_IRQ(plat_obj, irq);
+}
+
+void
+arm_unmask_irq(uintptr_t irq)
+{
+ PLATFORM_UNMASK_IRQ(plat_obj, irq);
+}
+
Modified: projects/specific_leg/sys/arm/arm/platform_if.m
==============================================================================
--- projects/specific_leg/sys/arm/arm/platform_if.m Sat Nov 30 17:25:00 2013 (r258771)
+++ projects/specific_leg/sys/arm/arm/platform_if.m Sat Nov 30 17:31:04 2013 (r258772)
@@ -135,3 +135,24 @@ METHOD void late_init {
platform_t _plat;
};
+/**
+ */
+METHOD int get_next_irq {
+ platform_t _plat;
+ int last;
+};
+
+/**
+ */
+METHOD void mask_irq {
+ platform_t _plat;
+ uintptr_t irq;
+};
+
+/**
+ */
+METHOD void unmask_irq {
+ platform_t _plat;
+ uintptr_t irq;
+};
+
Modified: projects/specific_leg/sys/arm/broadcom/bcm2835/bcm2835_intr.c
==============================================================================
--- projects/specific_leg/sys/arm/broadcom/bcm2835/bcm2835_intr.c Sat Nov 30 17:25:00 2013 (r258771)
+++ projects/specific_leg/sys/arm/broadcom/bcm2835/bcm2835_intr.c Sat Nov 30 17:31:04 2013 (r258772)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/rman.h>
#include <machine/bus.h>
#include <machine/intr.h>
+#include <machine/platformvar.h>
#include <dev/fdt/fdt_common.h>
#include <dev/ofw/openfirm.h>
@@ -137,8 +138,12 @@ static devclass_t bcm_intc_devclass;
DRIVER_MODULE(intc, simplebus, bcm_intc_driver, bcm_intc_devclass, 0, 0);
+int bcm2835_get_next_irq(platform_t, int);
+void bcm2835_mask_irq(platform_t, uintptr_t);
+void bcm2835_unmask_irq(platform_t, uintptr_t);
+
int
-arm_get_next_irq(int last_irq)
+bcm2835_get_next_irq(platform_t plat, int last_irq)
{
uint32_t pending;
int32_t irq = last_irq + 1;
@@ -173,7 +178,7 @@ arm_get_next_irq(int last_irq)
}
void
-arm_mask_irq(uintptr_t nb)
+bcm2835_mask_irq(platform_t plat, uintptr_t nb)
{
dprintf("%s: %d\n", __func__, nb);
@@ -188,7 +193,7 @@ arm_mask_irq(uintptr_t nb)
}
void
-arm_unmask_irq(uintptr_t nb)
+bcm2835_unmask_irq(platform_t plat, uintptr_t nb)
{
dprintf("%s: %d\n", __func__, nb);
Modified: projects/specific_leg/sys/arm/broadcom/bcm2835/bcm2835_machdep.c
==============================================================================
--- projects/specific_leg/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Sat Nov 30 17:25:00 2013 (r258771)
+++ projects/specific_leg/sys/arm/broadcom/bcm2835/bcm2835_machdep.c Sat Nov 30 17:31:04 2013 (r258772)
@@ -137,11 +137,19 @@ cpu_reset()
while (1);
}
+int bcm2835_get_next_irq(platform_t, int);
+void bcm2835_mask_irq(platform_t, uintptr_t);
+void bcm2835_unmask_irq(platform_t, uintptr_t);
+
static platform_method_t bcm2835_methods[] = {
PLATFORMMETHOD(platform_devmap_init, bcm2835_devmap_init),
PLATFORMMETHOD(platform_lastaddr, bcm2835_lastaddr),
PLATFORMMETHOD(platform_late_init, bcm2835_late_init),
+ PLATFORMMETHOD(platform_get_next_irq, bcm2835_get_next_irq),
+ PLATFORMMETHOD(platform_mask_irq, bcm2835_mask_irq),
+ PLATFORMMETHOD(platform_unmask_irq, bcm2835_unmask_irq),
+
PLATFORMMETHOD_END,
};
Modified: projects/specific_leg/sys/arm/broadcom/bcm2835/files.bcm2835
==============================================================================
--- projects/specific_leg/sys/arm/broadcom/bcm2835/files.bcm2835 Sat Nov 30 17:25:00 2013 (r258771)
+++ projects/specific_leg/sys/arm/broadcom/bcm2835/files.bcm2835 Sat Nov 30 17:31:04 2013 (r258772)
@@ -11,7 +11,6 @@ arm/broadcom/bcm2835/bcm2835_sdhci.c op
arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi
arm/broadcom/bcm2835/bcm2835_systimer.c standard
arm/broadcom/bcm2835/bcm2835_wdog.c standard
-arm/broadcom/bcm2835/common.c optional fdt
arm/arm/bus_space-v6.c standard
arm/arm/bus_space_generic.c standard
Modified: projects/specific_leg/sys/arm/include/intr.h
==============================================================================
--- projects/specific_leg/sys/arm/include/intr.h Sat Nov 30 17:25:00 2013 (r258771)
+++ projects/specific_leg/sys/arm/include/intr.h Sat Nov 30 17:31:04 2013 (r258772)
@@ -76,6 +76,11 @@ void arm_setup_irqhandler(const char *,
int arm_remove_irqhandler(int, void *);
extern void (*arm_post_filter)(void *);
+struct platform_kobj;
+
void gic_init_secondary(void);
+int gic_get_next_irq(struct platform_kobj *, int);
+void gic_mask_irq(struct platform_kobj *, uintptr_t);
+void gic_unmask_irq(struct platform_kobj *, uintptr_t);
#endif /* _MACHINE_INTR_H */
Modified: projects/specific_leg/sys/arm/ti/files.ti
==============================================================================
--- projects/specific_leg/sys/arm/ti/files.ti Sat Nov 30 17:25:00 2013 (r258771)
+++ projects/specific_leg/sys/arm/ti/files.ti Sat Nov 30 17:31:04 2013 (r258772)
@@ -11,7 +11,6 @@ arm/arm/cpufunc_asm_arm11.S standard
arm/arm/cpufunc_asm_armv7.S standard
arm/arm/irq_dispatch.S standard
-arm/ti/common.c standard
arm/ti/ti_cpuid.c standard
arm/ti/ti_machdep.c standard
arm/ti/ti_prcm.c standard
Modified: projects/specific_leg/sys/arm/ti/ti_machdep.c
==============================================================================
--- projects/specific_leg/sys/arm/ti/ti_machdep.c Sat Nov 30 17:25:00 2013 (r258771)
+++ projects/specific_leg/sys/arm/ti/ti_machdep.c Sat Nov 30 17:31:04 2013 (r258772)
@@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <machine/devmap.h>
+#include <machine/intr.h>
#include <machine/machdep.h>
#include <machine/platformvar.h>
@@ -157,6 +158,10 @@ static platform_method_t omap4_methods[]
PLATFORMMETHOD(platform_devmap_init, ti_omap4_devmap_init),
PLATFORMMETHOD(platform_lastaddr, ti_lastaddr),
+ PLATFORMMETHOD(platform_get_next_irq, gic_get_next_irq),
+ PLATFORMMETHOD(platform_mask_irq, gic_mask_irq),
+ PLATFORMMETHOD(platform_unmask_irq, gic_unmask_irq),
+
PLATFORMMETHOD_END,
};
Modified: projects/specific_leg/sys/conf/files.arm
==============================================================================
--- projects/specific_leg/sys/conf/files.arm Sat Nov 30 17:25:00 2013 (r258771)
+++ projects/specific_leg/sys/conf/files.arm Sat Nov 30 17:31:04 2013 (r258772)
@@ -63,6 +63,7 @@ cddl/compat/opensolaris/kern/opensolaris
crypto/blowfish/bf_enc.c optional crypto | ipsec
crypto/des/des_enc.c optional crypto | ipsec | netsmb
dev/fb/fb.c optional sc
+dev/fdt/fdt_arm.c optional fdt
dev/fdt/fdt_platform.c optional fdt
dev/hwpmc/hwpmc_arm.c optional hwpmc
dev/kbd/kbd.c optional sc
Added: projects/specific_leg/sys/dev/fdt/fdt_arm.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ projects/specific_leg/sys/dev/fdt/fdt_arm.c Sat Nov 30 17:31:04 2013 (r258772)
@@ -0,0 +1,82 @@
+/*-
+ * Copyright (c) 2013 Andrew Turner
+ * 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 AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/bus.h>
+
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/ofw_bus_subr.h>
+#include <dev/ofw/openfirm.h>
+
+#include "ofw_bus_if.h"
+#include "fdt_common.h"
+
+struct fdt_fixup_entry fdt_fixup_table[] = {
+ { NULL, NULL }
+};
+
+/*
+ * The list of interrupts we can decode in fdt_pic_decode_arm.
+ * TODO: Allwinner needs an offset for gic, this needs to be fixed somehow
+ */
+static const char * fdt_compatible[] = {
+ "arm,gic",
+ "broadcom,bcm2835-armctrl-ic",
+ "ti,aintc",
+ NULL
+};
+
+static int
+fdt_pic_decode_arm(phandle_t node, pcell_t *intr, int *interrupt,
+ int *trig, int *pol)
+{
+ u_int i;
+
+ for (i = 0; fdt_compatible[i] != NULL; i++) {
+ if (fdt_is_compatible(node, fdt_compatible[i]))
+ break;
+ }
+ if (fdt_compatible[i] == NULL)
+ return (ENXIO);
+
+ *interrupt = fdt32_to_cpu(intr[0]);
+ *trig = INTR_TRIGGER_CONFORM;
+ *pol = INTR_POLARITY_CONFORM;
+
+ return (0);
+}
+
+fdt_pic_decode_t fdt_pic_table[] = {
+ &fdt_pic_decode_arm,
+ NULL
+};
+
More information about the svn-src-projects
mailing list