Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/samsung Use fdtbus_intr_establish to hook in bl...
details: https://anonhg.NetBSD.org/src/rev/9eacadfeb7e9
branches: trunk
changeset: 824616:9eacadfeb7e9
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sun Jun 11 16:19:27 2017 +0000
description:
Use fdtbus_intr_establish to hook in block interrupts instead of
intr_establish.
diffstat:
sys/arch/arm/samsung/exynos_combiner.c | 32 +++++++++++++++++++++-----------
1 files changed, 21 insertions(+), 11 deletions(-)
diffs (118 lines):
diff -r 6475f3031cc0 -r 9eacadfeb7e9 sys/arch/arm/samsung/exynos_combiner.c
--- a/sys/arch/arm/samsung/exynos_combiner.c Sun Jun 11 14:34:49 2017 +0000
+++ b/sys/arch/arm/samsung/exynos_combiner.c Sun Jun 11 16:19:27 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos_combiner.c,v 1.6 2016/01/05 21:53:48 marty Exp $ */
+/* $NetBSD: exynos_combiner.c,v 1.7 2017/06/11 16:19:27 jmcneill Exp $ */
/*-
* Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
#include "gpio.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: exynos_combiner.c,v 1.6 2016/01/05 21:53:48 marty Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_combiner.c,v 1.7 2017/06/11 16:19:27 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -66,6 +66,7 @@
int (*irq_handler)(void *);
void * irq_arg;
struct exynos_combiner_irq_entry *irq_next;
+ bool irq_mpsafe;
};
struct exynos_combiner_irq_block {
@@ -73,6 +74,7 @@
struct exynos_combiner_softc *irq_sc;
struct exynos_combiner_irq_entry *irq_entries;
struct exynos_combiner_irq_block *irq_block_next;
+ void *irq_ih;
};
struct exynos_combiner_softc {
@@ -173,7 +175,7 @@
static struct exynos_combiner_irq_entry *
exynos_combiner_new_irq(struct exynos_combiner_irq_block *block,
- int irq, int (*func)(void *), void *arg)
+ int irq, bool mpsafe, int (*func)(void *), void *arg)
{
struct exynos_combiner_irq_entry * n = kmem_zalloc(sizeof(*n),
KM_SLEEP);
@@ -181,6 +183,7 @@
n->irq_handler = func;
n->irq_next = block->irq_entries;
n->irq_arg = arg;
+ n->irq_mpsafe = mpsafe;
block->irq_entries = n;
return n;
}
@@ -196,7 +199,8 @@
return NULL;
}
-static int exynos_combiner_irq(void *cookie)
+static int
+exynos_combiner_irq(void *cookie)
{
struct exynos_combiner_irq_block *blockp = cookie;
struct exynos_combiner_softc *sc = blockp->irq_sc;
@@ -211,9 +215,13 @@
if (istatus & 1 << irq) {
struct exynos_combiner_irq_entry *e =
exynos_combiner_get_irq(blockp, irq);
- if (e)
+ if (e) {
+ if (!e->irq_mpsafe)
+ KERNEL_LOCK(1, curlwp);
e->irq_handler(e->irq_arg);
- else
+ if (!e->irq_mpsafe)
+ KERNEL_UNLOCK_ONE(curlwp);
+ } else
printf("%s: Unexpected irq %d, %d\n", __func__,
intr, irq);
}
@@ -229,6 +237,7 @@
struct exynos_combiner_softc * const sc = device_private(dev);
struct exynos_combiner_irq_block *blockp;
struct exynos_combiner_irq_entry *entryp;
+ const bool mpsafe = (flags & FDT_INTR_MPSAFE) != 0;
const u_int intr = be32toh(specifier[0]);
const u_int irq = be32toh(specifier[1]);
@@ -237,18 +246,19 @@
intr / COMBINER_BLOCKS_PER_GROUP * COMBINER_GROUP_SIZE
+ COMBINER_IESR_OFFSET;
- blockp = exynos_combiner_get_block(sc, intr);
+ blockp = exynos_combiner_get_block(sc, intr);
if (!blockp) {
blockp = exynos_combiner_new_block(sc, intr);
KASSERT(blockp);
- intr_establish(intr, ipl, IST_LEVEL, exynos_combiner_irq,
- blockp);
+ blockp->irq_ih = fdtbus_intr_establish(sc->sc_phandle, intr,
+ IPL_VM /* XXX */, FDT_INTR_MPSAFE, exynos_combiner_irq,
+ blockp);
}
entryp = exynos_combiner_get_irq(blockp, irq);
if (entryp)
return NULL;
- entryp = exynos_combiner_new_irq(blockp, irq, func, arg);
+ entryp = exynos_combiner_new_irq(blockp, irq, mpsafe, func, arg);
KASSERT(entryp);
int istatus =
@@ -262,7 +272,7 @@
exynos_combiner_disestablish(device_t dev, void *ih)
{
/* MJF: Find the ih and disable the handler. */
- intr_disestablish(ih);
+ panic("exynos_combiner_disestablish not implemented");
}
static bool
Home |
Main Index |
Thread Index |
Old Index