Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/sys/dev/fdt Pull up following revision(s) (requested by j...
details: https://anonhg.NetBSD.org/src/rev/9eaf810140a9
branches: netbsd-8
changeset: 434001:9eaf810140a9
user: snj <snj%NetBSD.org@localhost>
date: Wed Jun 14 04:53:12 2017 +0000
description:
Pull up following revision(s) (requested by jmcneill in ticket #30):
sys/dev/fdt/fdt_intr.c: revision 1.11
Fix an issue with interrupt controller lookup wrt cascading interrupt
controllers.
diffstat:
sys/dev/fdt/fdt_intr.c | 42 ++++++++++++++++++++++--------------------
1 files changed, 22 insertions(+), 20 deletions(-)
diffs (98 lines):
diff -r 0e2ff757d0b2 -r 9eaf810140a9 sys/dev/fdt/fdt_intr.c
--- a/sys/dev/fdt/fdt_intr.c Wed Jun 14 04:49:32 2017 +0000
+++ b/sys/dev/fdt/fdt_intr.c Wed Jun 14 04:53:12 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_intr.c,v 1.10 2017/06/02 13:12:33 jmcneill Exp $ */
+/* $NetBSD: fdt_intr.c,v 1.10.2.1 2017/06/14 04:53:12 snj Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.10 2017/06/02 13:12:33 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.10.2.1 2017/06/14 04:53:12 snj Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -44,6 +44,11 @@
struct fdtbus_interrupt_controller *ic_next;
};
+struct fdtbus_interrupt_cookie {
+ struct fdtbus_interrupt_controller *c_ic;
+ void *c_ih;
+};
+
static struct fdtbus_interrupt_controller *fdtbus_ic = NULL;
static bool has_interrupt_map(int);
@@ -79,7 +84,7 @@
}
static struct fdtbus_interrupt_controller *
-fdtbus_get_interrupt_controller_ic(int phandle)
+fdtbus_get_interrupt_controller(int phandle)
{
struct fdtbus_interrupt_controller * ic;
for (ic = fdtbus_ic; ic; ic = ic->ic_next) {
@@ -90,17 +95,6 @@
return NULL;
}
-static struct fdtbus_interrupt_controller *
-fdtbus_get_interrupt_controller(int phandle)
-{
- const int ic_phandle = fdtbus_get_interrupt_parent(phandle);
- if (ic_phandle < 0) {
- return NULL;
- }
-
- return fdtbus_get_interrupt_controller_ic(ic_phandle);
-}
-
int
fdtbus_register_interrupt_controller(device_t dev, int phandle,
const struct fdtbus_interrupt_controller_func *funcs)
@@ -123,8 +117,10 @@
int (*func)(void *), void *arg)
{
struct fdtbus_interrupt_controller *ic;
+ struct fdtbus_interrupt_cookie *c = NULL;
u_int *specifier;
int ihandle;
+ void *ih;
specifier = get_specifier_by_index(phandle, index, &ihandle);
if (specifier == NULL)
@@ -134,17 +130,23 @@
if (ic == NULL)
return NULL;
- return ic->ic_funcs->establish(ic->ic_dev, specifier,
+ ih = ic->ic_funcs->establish(ic->ic_dev, specifier,
ipl, flags, func, arg);
+ if (ih != NULL) {
+ c = kmem_alloc(sizeof(*c), KM_SLEEP);
+ c->c_ic = ic;
+ c->c_ih = ih;
+ }
+
+ return c;
}
void
-fdtbus_intr_disestablish(int phandle, void *ih)
+fdtbus_intr_disestablish(int phandle, void *cookie)
{
- struct fdtbus_interrupt_controller *ic;
-
- ic = fdtbus_get_interrupt_controller(phandle);
- KASSERT(ic != NULL);
+ struct fdtbus_interrupt_cookie *c = cookie;
+ struct fdtbus_interrupt_controller *ic = c->c_ic;
+ void *ih = c->c_ih;
return ic->ic_funcs->disestablish(ic->ic_dev, ih);
}
Home |
Main Index |
Thread Index |
Old Index