Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/fdt Fix a regression with interrupt-map handling in ...
details: https://anonhg.NetBSD.org/src/rev/8c82dd688ec4
branches: trunk
changeset: 320352:8c82dd688ec4
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Mon Jul 02 16:06:50 2018 +0000
description:
Fix a regression with interrupt-map handling in previous.
diffstat:
sys/dev/fdt/fdt_intr.c | 36 +++++++++++++-----------------------
1 files changed, 13 insertions(+), 23 deletions(-)
diffs (59 lines):
diff -r f1472519004f -r 8c82dd688ec4 sys/dev/fdt/fdt_intr.c
--- a/sys/dev/fdt/fdt_intr.c Mon Jul 02 15:10:43 2018 +0000
+++ b/sys/dev/fdt/fdt_intr.c Mon Jul 02 16:06:50 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_intr.c,v 1.13 2018/07/02 12:17:05 jmcneill Exp $ */
+/* $NetBSD: fdt_intr.c,v 1.14 2018/07/02 16:06:50 jmcneill Exp $ */
/*-
* Copyright (c) 2015-2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.13 2018/07/02 12:17:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_intr.c,v 1.14 2018/07/02 16:06:50 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -59,29 +59,19 @@
static int
fdtbus_get_interrupt_parent(int phandle)
{
- u_int interrupt_parent;
+ int iparent = phandle;
- while (phandle >= 0) {
- if (of_getprop_uint32(phandle, "interrupt-parent",
- &interrupt_parent) == 0) {
- break;
- }
- if (phandle == 0) {
- return -1;
- }
- phandle = OF_parent(phandle);
- }
- if (phandle < 0) {
- return -1;
- }
+ do {
+ if (of_hasprop(iparent, "interrupt-parent"))
+ return fdtbus_get_phandle(iparent, "interrupt-parent");
+ else if (of_hasprop(iparent, "interrupt-controller"))
+ return iparent;
+ else if (of_hasprop(iparent, "interrupt-map"))
+ return iparent;
+ iparent = OF_parent(iparent);
+ } while (iparent > 0);
- const void *data = fdtbus_get_data();
- const int off = fdt_node_offset_by_phandle(data, interrupt_parent);
- if (off < 0) {
- return -1;
- }
-
- return fdtbus_offset2phandle(off);
+ return 0;
}
static struct fdtbus_interrupt_controller *
Home |
Main Index |
Thread Index |
Old Index