Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/fdt attach GICv3 ITS where applicable
details: https://anonhg.NetBSD.org/src/rev/58aa942e6082
branches: trunk
changeset: 837253:58aa942e6082
user: jakllsch <jakllsch%NetBSD.org@localhost>
date: Sat Nov 24 22:18:57 2018 +0000
description:
attach GICv3 ITS where applicable
diffstat:
sys/arch/arm/fdt/gicv3_fdt.c | 45 ++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 43 insertions(+), 2 deletions(-)
diffs (90 lines):
diff -r 4d8881cc0728 -r 58aa942e6082 sys/arch/arm/fdt/gicv3_fdt.c
--- a/sys/arch/arm/fdt/gicv3_fdt.c Sat Nov 24 22:17:12 2018 +0000
+++ b/sys/arch/arm/fdt/gicv3_fdt.c Sat Nov 24 22:18:57 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3_fdt.c,v 1.5 2018/11/19 13:54:15 jakllsch Exp $ */
+/* $NetBSD: gicv3_fdt.c,v 1.6 2018/11/24 22:18:57 jakllsch Exp $ */
/*-
* Copyright (c) 2015-2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -26,10 +26,12 @@
* SUCH DAMAGE.
*/
+#include "pci.h"
+
#define _INTR_PRIVATE
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gicv3_fdt.c,v 1.5 2018/11/19 13:54:15 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3_fdt.c,v 1.6 2018/11/24 22:18:57 jakllsch Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -44,6 +46,7 @@
#include <dev/fdt/fdtvar.h>
#include <arm/cortex/gicv3.h>
+#include <arm/cortex/gicv3_its.h>
#include <arm/cortex/gic_reg.h>
#define GICV3_MAXIRQ 1020
@@ -58,6 +61,9 @@
static void gicv3_fdt_attach(device_t, device_t, void *);
static int gicv3_fdt_map_registers(struct gicv3_fdt_softc *);
+#if NPCI > 0
+static void gicv3_fdt_attach_its(struct gicv3_fdt_softc *, bus_space_tag_t, int);
+#endif
static int gicv3_fdt_intr(void *);
@@ -152,6 +158,16 @@
return;
}
+#if NPCI > 0
+ for (int child = OF_child(phandle); child; child = OF_peer(child)) {
+ if (!fdtbus_status_okay(child))
+ continue;
+ const char * const its_compat[] = { "arm,gic-v3-its", NULL };
+ if (of_match_compatible(child, its_compat))
+ gicv3_fdt_attach_its(sc, faa->faa_bst, child);
+ }
+#endif
+
arm_fdt_irq_set_handler(gicv3_irq_handler);
}
@@ -222,6 +238,31 @@
return 0;
}
+#if NPCI > 0
+static void
+gicv3_fdt_attach_its(struct gicv3_fdt_softc *sc, bus_space_tag_t bst, int phandle)
+{
+ bus_space_handle_t bsh;
+ bus_addr_t addr;
+ bus_size_t size;
+
+ if (fdtbus_get_reg(phandle, 0, &addr, &size) != 0) {
+ aprint_error_dev(sc->sc_gic.sc_dev, "couldn't get ITS address\n");
+ return;
+ }
+
+ if (bus_space_map(bst, addr, size, 0, &bsh) != 0) {
+ aprint_error_dev(sc->sc_gic.sc_dev, "couldn't map ITS\n");
+ return;
+ }
+
+ gicv3_its_init(&sc->sc_gic, bsh, addr, 0);
+
+ aprint_verbose_dev(sc->sc_gic.sc_dev, "ITS @ %#" PRIxBUSADDR "\n",
+ addr);
+}
+#endif
+
static void *
gicv3_fdt_establish(device_t dev, u_int *specifier, int ipl, int flags,
int (*func)(void *), void *arg)
Home |
Main Index |
Thread Index |
Old Index