Module Name:    src
Committed By:   thorpej
Date:           Sat Jan 26 14:43:46 UTC 2019

Modified Files:
        src/sys/arch/arm/fdt: gic_fdt.c gicv3_fdt.c

Log Message:
Define constants for representing the standard interrupt types
({pos,neg,double}-edge, {high,low}-level) from the FDT "interrupts"
bindings.  Use these defined constants rather than magic numbers.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/fdt/gic_fdt.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/fdt/gicv3_fdt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/fdt/gic_fdt.c
diff -u src/sys/arch/arm/fdt/gic_fdt.c:1.15 src/sys/arch/arm/fdt/gic_fdt.c:1.16
--- src/sys/arch/arm/fdt/gic_fdt.c:1.15	Mon Nov 12 12:41:03 2018
+++ src/sys/arch/arm/fdt/gic_fdt.c	Sat Jan 26 14:43:46 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: gic_fdt.c,v 1.15 2018/11/12 12:41:03 jmcneill Exp $ */
+/* $NetBSD: gic_fdt.c,v 1.16 2019/01/26 14:43:46 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill <[email protected]>
@@ -29,7 +29,7 @@
 #include "pci.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.15 2018/11/12 12:41:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gic_fdt.c,v 1.16 2019/01/26 14:43:46 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -249,7 +249,8 @@ gic_fdt_establish(device_t dev, u_int *s
 	const u_int intr = be32toh(specifier[1]);
 	const u_int irq = type == 0 ? IRQ_SPI(intr) : IRQ_PPI(intr);
 	const u_int trig = be32toh(specifier[2]) & 0xf;
-	const u_int level = (trig & 0x3) ? IST_EDGE : IST_LEVEL;
+	const u_int level = (trig & FDT_INTR_TYPE_DOUBLE_EDGE)
+	    ? IST_EDGE : IST_LEVEL;
 
 	const u_int mpsafe = (flags & FDT_INTR_MPSAFE) ? IST_MPSAFE : 0;
 

Index: src/sys/arch/arm/fdt/gicv3_fdt.c
diff -u src/sys/arch/arm/fdt/gicv3_fdt.c:1.6 src/sys/arch/arm/fdt/gicv3_fdt.c:1.7
--- src/sys/arch/arm/fdt/gicv3_fdt.c:1.6	Sat Nov 24 22:18:57 2018
+++ src/sys/arch/arm/fdt/gicv3_fdt.c	Sat Jan 26 14:43:46 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: gicv3_fdt.c,v 1.6 2018/11/24 22:18:57 jakllsch Exp $ */
+/* $NetBSD: gicv3_fdt.c,v 1.7 2019/01/26 14:43:46 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2015-2018 Jared McNeill <[email protected]>
@@ -31,7 +31,7 @@
 #define	_INTR_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gicv3_fdt.c,v 1.6 2018/11/24 22:18:57 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gicv3_fdt.c,v 1.7 2019/01/26 14:43:46 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -280,7 +280,8 @@ gicv3_fdt_establish(device_t dev, u_int 
 	const u_int intr = be32toh(specifier[1]);
 	const u_int irq = type == 0 ? IRQ_SPI(intr) : IRQ_PPI(intr);
 	const u_int trig = be32toh(specifier[2]) & 0xf;
-	const u_int level = (trig & 0x3) ? IST_EDGE : IST_LEVEL;
+	const u_int level = (trig & FDT_INTR_TYPE_DOUBLE_EDGE)
+	    ? IST_EDGE : IST_LEVEL;
 
 	const u_int mpsafe = (flags & FDT_INTR_MPSAFE) ? IST_MPSAFE : 0;
 

Reply via email to