Support "empty" phandles in interrups-extended properties. This is needed
authorkettenis <kettenis@openbsd.org>
Wed, 27 Jul 2022 20:26:17 +0000 (20:26 +0000)
committerkettenis <kettenis@openbsd.org>
Wed, 27 Jul 2022 20:26:17 +0000 (20:26 +0000)
to support the device tree binding for the "apple,admac" controller.

ok visa@, patrick@

sys/arch/arm64/arm64/intr.c
sys/arch/armv7/armv7/intr.c
sys/arch/powerpc64/powerpc64/intr.c
sys/arch/riscv64/riscv64/intr.c

index e3e8d46..886ce87 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.c,v 1.24 2022/01/02 01:01:04 jsg Exp $ */
+/* $OpenBSD: intr.c,v 1.25 2022/07/27 20:26:17 kettenis Exp $ */
 /*
  * Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
  *
@@ -377,6 +377,13 @@ arm_intr_establish_fdt_idx_cpu(int node, int idx, int level, struct cpu_info *ci
                if (extended) {
                        phandle = cell[0];
 
+                       /* Handle "empty" phandle reference. */
+                       if (phandle == 0) {
+                               cell++;
+                               ncells--;
+                               continue;
+                       }
+
                        LIST_FOREACH(ic, &interrupt_controllers, ic_list) {
                                if (ic->ic_phandle == phandle)
                                        break;
index c0816da..96bf04b 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.c,v 1.20 2022/01/02 01:01:04 jsg Exp $ */
+/* $OpenBSD: intr.c,v 1.21 2022/07/27 20:26:17 kettenis Exp $ */
 /*
  * Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
  *
@@ -366,6 +366,13 @@ arm_intr_establish_fdt_idx_cpu(int node, int idx, int level, struct cpu_info *ci
                if (extended) {
                        phandle = cell[0];
 
+                       /* Handle "empty" phandle reference. */
+                       if (phandle == 0) {
+                               cell++;
+                               ncells--;
+                               continue;
+                       }
+
                        LIST_FOREACH(ic, &interrupt_controllers, ic_list) {
                                if (ic->ic_phandle == phandle)
                                        break;
index d2658a8..ebcf4ef 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: intr.c,v 1.9 2020/09/26 17:56:54 kettenis Exp $       */
+/*     $OpenBSD: intr.c,v 1.10 2022/07/27 20:26:17 kettenis Exp $      */
 
 /*
  * Copyright (c) 2020 Mark Kettenis <kettenis@openbsd.org>
@@ -281,6 +281,13 @@ fdt_intr_establish_idx_cpu(int node, int idx, int level, struct cpu_info *ci,
                if (extended) {
                        phandle = cell[0];
 
+                       /* Handle "empty" phandle reference. */
+                       if (phandle == 0) {
+                               cell++;
+                               ncells--;
+                               continue;
+                       }
+
                        LIST_FOREACH(ic, &interrupt_controllers, ic_list) {
                                if (ic->ic_phandle == phandle)
                                        break;
index 9fbba86..a5263e7 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: intr.c,v 1.9 2022/01/02 01:01:04 jsg Exp $    */
+/*     $OpenBSD: intr.c,v 1.10 2022/07/27 20:26:17 kettenis Exp $      */
 
 /*
  * Copyright (c) 2011 Dale Rahn <drahn@openbsd.org>
@@ -359,6 +359,13 @@ riscv_intr_establish_fdt_idx_cpu(int node, int idx, int level,
                if (extended) {
                        phandle = cell[0];
 
+                       /* Handle "empty" phandle reference. */
+                       if (phandle == 0) {
+                               cell++;
+                               ncells--;
+                               continue;
+                       }
+
                        LIST_FOREACH(ic, &interrupt_controllers, ic_list) {
                                if (ic->ic_phandle == phandle)
                                        break;