summaryrefslogtreecommitdiffstats
path: root/sys/dev/fdt/rkgpio.c
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2020-07-17 08:07:33 +0000
committerpatrick <patrick@openbsd.org>2020-07-17 08:07:33 +0000
commit452daaedc6a44247dc76c56f4c33bc4131b7c50c (patch)
tree482245802e7d6304dfe90d749f5b8e7edac4f384 /sys/dev/fdt/rkgpio.c
parentAdd powerpc64 support; straight copy from octeon. (diff)
downloadwireguard-openbsd-452daaedc6a44247dc76c56f4c33bc4131b7c50c.tar.xz
wireguard-openbsd-452daaedc6a44247dc76c56f4c33bc4131b7c50c.zip
Re-work intr_barrier(9) on arm64 to remove layer violation. So far we
have stored the struct cpu_info * in the wrapper around the interrupt handler cookie, but since we can have a few layers inbetween, this does not seem very nice. Instead have each and every interrupt controller provide a barrier function. This means that intr_barrier(9) will in the end be executed by the interrupt controller that actually wired the pin to a core. And that's the only place where the information is stored. ok kettenis@
Diffstat (limited to 'sys/dev/fdt/rkgpio.c')
-rw-r--r--sys/dev/fdt/rkgpio.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/sys/dev/fdt/rkgpio.c b/sys/dev/fdt/rkgpio.c
index e45d533f1c2..4b31efd13e7 100644
--- a/sys/dev/fdt/rkgpio.c
+++ b/sys/dev/fdt/rkgpio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rkgpio.c,v 1.5 2020/07/14 15:34:15 patrick Exp $ */
+/* $OpenBSD: rkgpio.c,v 1.6 2020/07/17 08:07:34 patrick Exp $ */
/*
* Copyright (c) 2017 Mark Kettenis <kettenis@openbsd.org>
* Copyright (c) 2019 Patrick Wildt <patrick@blueri.se>
@@ -102,6 +102,7 @@ void rkgpio_intr_disestablish(void *);
void rkgpio_recalc_ipl(struct rkgpio_softc *);
void rkgpio_intr_enable(void *);
void rkgpio_intr_disable(void *);
+void rkgpio_intr_barrier(void *);
int
rkgpio_match(struct device *parent, void *match, void *aux)
@@ -148,6 +149,7 @@ rkgpio_attach(struct device *parent, struct device *self, void *aux)
sc->sc_ic.ic_disestablish = rkgpio_intr_disestablish;
sc->sc_ic.ic_enable = rkgpio_intr_enable;
sc->sc_ic.ic_disable = rkgpio_intr_disable;
+ sc->sc_ic.ic_barrier = rkgpio_intr_barrier;
fdt_intr_register(&sc->sc_ic);
printf("\n");
@@ -390,3 +392,12 @@ rkgpio_intr_disable(void *cookie)
HSET4(sc, GPIO_INTMASK, 1 << ih->ih_irq);
splx(s);
}
+
+void
+rkgpio_intr_barrier(void *cookie)
+{
+ struct intrhand *ih = cookie;
+ struct rkgpio_softc *sc = ih->ih_sc;
+
+ intr_barrier(sc->sc_ih);
+}