svn commit: r276990 - in projects/arm_intrng/sys/arm: arm include

Andrew Turner andrew at FreeBSD.org
Sun Jan 11 18:02:15 UTC 2015


Author: andrew
Date: Sun Jan 11 18:02:13 2015
New Revision: 276990
URL: https://svnweb.freebsd.org/changeset/base/276990

Log:
  Pass an unsigned interrupt id in to functions when possible.

Modified:
  projects/arm_intrng/sys/arm/arm/gic.c
  projects/arm_intrng/sys/arm/arm/intrng.c
  projects/arm_intrng/sys/arm/arm/nexus.c
  projects/arm_intrng/sys/arm/arm/pic_if.m
  projects/arm_intrng/sys/arm/include/intr.h

Modified: projects/arm_intrng/sys/arm/arm/gic.c
==============================================================================
--- projects/arm_intrng/sys/arm/arm/gic.c	Sun Jan 11 17:35:55 2015	(r276989)
+++ projects/arm_intrng/sys/arm/arm/gic.c	Sun Jan 11 18:02:13 2015	(r276990)
@@ -127,12 +127,20 @@ static struct arm_gic_softc *arm_gic_sc 
 static int arm_gic_probe(device_t);
 static int arm_gic_attach(device_t);
 static void arm_gic_init_secondary(device_t);
-static int arm_gic_config(device_t, int, enum intr_trigger, enum intr_polarity);
-static void arm_gic_mask(device_t, int);
-static void arm_gic_unmask(device_t, int);
-static void arm_gic_ipi_send(device_t, cpuset_t, int);
-static int arm_gic_ipi_read(device_t dev, int i);
-static void arm_gic_ipi_clear(device_t, int);
+
+#ifdef ARM_INTRNG
+static int arm_gic_intr(void *);
+static pic_config_t arm_gic_config;
+static pic_mask_t arm_gic_mask;
+static pic_unmask_t arm_gic_unmask;
+static pic_eoi_t arm_gic_eoi;
+static pic_init_secondary_t arm_gic_init_secondary;
+#ifdef SMP
+static pic_ipi_send_t arm_gic_ipi_send;
+static pic_ipi_read_t arm_gic_ipi_read;
+static pic_ipi_clear_t arm_gic_ipi_clear;
+#endif
+#endif
 
 #define	gic_c_read_4(_sc, _reg)		\
     bus_space_read_4((_sc)->gic_c_bst, (_sc)->gic_c_bsh, (_reg))
@@ -143,10 +151,7 @@ static void arm_gic_ipi_clear(device_t, 
 #define	gic_d_write_4(_sc, _reg, _val)		\
     bus_space_write_4((_sc)->gic_d_bst, (_sc)->gic_d_bsh, (_reg), (_val))
 
-#ifdef ARM_INTRNG
-static int arm_gic_intr(void *);
-static void arm_gic_eoi(device_t, int);
-#else
+#ifndef ARM_INTRNG
 static int gic_config_irq(int irq, enum intr_trigger trig,
     enum intr_polarity pol);
 static void gic_post_filter(void *);
@@ -390,7 +395,7 @@ arm_gic_intr(void *arg)
 #endif
 
 static int
-arm_gic_config(device_t dev, int irq, enum intr_trigger trig,
+arm_gic_config(device_t dev, u_int irq, enum intr_trigger trig,
     enum intr_polarity pol)
 {
 	struct arm_gic_softc *sc = device_get_softc(dev);
@@ -398,7 +403,7 @@ arm_gic_config(device_t dev, int irq, en
 	uint32_t mask;
 
 	/* Function is public-accessible, so validate input arguments */
-	if ((irq < 0) || (irq >= sc->nirqs))
+	if (irq >= sc->nirqs)
 		goto invalid_args;
 	if ((trig != INTR_TRIGGER_EDGE) && (trig != INTR_TRIGGER_LEVEL) &&
 	    (trig != INTR_TRIGGER_CONFORM))
@@ -444,7 +449,7 @@ invalid_args:
 
 #ifdef ARM_INTRNG
 static void
-arm_gic_eoi(device_t dev, int irq)
+arm_gic_eoi(device_t dev, u_int irq)
 {
 	struct arm_gic_softc *sc = device_get_softc(dev);
 
@@ -457,7 +462,7 @@ arm_gic_eoi(device_t dev, int irq)
 
 
 static void
-arm_gic_mask(device_t dev, int irq)
+arm_gic_mask(device_t dev, u_int irq)
 {
 	struct arm_gic_softc *sc = device_get_softc(dev);
 
@@ -466,7 +471,7 @@ arm_gic_mask(device_t dev, int irq)
 }
 
 static void
-arm_gic_unmask(device_t dev, int irq)
+arm_gic_unmask(device_t dev, u_int irq)
 {
 	struct arm_gic_softc *sc = device_get_softc(dev);
 
@@ -478,7 +483,7 @@ arm_gic_unmask(device_t dev, int irq)
 
 #ifdef SMP
 static void
-arm_gic_ipi_send(device_t dev, cpuset_t cpus, int ipi)
+arm_gic_ipi_send(device_t dev, cpuset_t cpus, u_int ipi)
 {
 	struct arm_gic_softc *sc = device_get_softc(dev);
 	uint32_t val = 0, i;

Modified: projects/arm_intrng/sys/arm/arm/intrng.c
==============================================================================
--- projects/arm_intrng/sys/arm/arm/intrng.c	Sun Jan 11 17:35:55 2015	(r276989)
+++ projects/arm_intrng/sys/arm/arm/intrng.c	Sun Jan 11 18:02:13 2015	(r276990)
@@ -586,7 +586,7 @@ pic_ipi_read(int ipi)
 }
 
 void
-arm_unmask_ipi(int ipi)
+arm_unmask_ipi(u_int ipi)
 {
 
 	KASSERT(ipi < ARM_IPI_COUNT, ("invalid IPI %u", ipi));
@@ -595,7 +595,7 @@ arm_unmask_ipi(int ipi)
 }
 
 void
-arm_mask_ipi(int ipi)
+arm_mask_ipi(u_int ipi)
 {
 
 	KASSERT(ipi < ARM_IPI_COUNT, ("invalid IPI %u", ipi));

Modified: projects/arm_intrng/sys/arm/arm/nexus.c
==============================================================================
--- projects/arm_intrng/sys/arm/arm/nexus.c	Sun Jan 11 17:35:55 2015	(r276989)
+++ projects/arm_intrng/sys/arm/arm/nexus.c	Sun Jan 11 18:02:13 2015	(r276990)
@@ -100,11 +100,12 @@ static int nexus_release_resource(device
 static int nexus_setup_intr(device_t dev, device_t child, struct resource *res,
     int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep);
 static int nexus_teardown_intr(device_t, device_t, struct resource *, void *);
-#if defined(ARM_INTRNG)
-static int nexus_pic_config(device_t, int, enum intr_trigger, enum intr_polarity);
-static void nexus_pic_mask(device_t, int);
-static void nexus_pic_unmask(device_t, int);
-static void nexus_pic_eoi(device_t, int);
+#ifdef ARM_INTRNG
+static pic_config_t nexus_pic_config;
+static pic_mask_t nexus_pic_mask;
+static pic_unmask_t nexus_pic_unmask;
+static pic_eoi_t nexus_pic_eoi;
+
 void arm_irq_handler(struct trapframe *tf, int irqnb);
 #endif
 
@@ -401,7 +402,7 @@ nexus_deactivate_resource(device_t bus, 
 
 #if defined(ARM_INTRNG)
 static int
-nexus_pic_config(device_t bus, int irq, enum intr_trigger trig,
+nexus_pic_config(device_t bus, u_int irq, enum intr_trigger trig,
     enum intr_polarity pol)
 {
 	/* unused */
@@ -409,19 +410,19 @@ nexus_pic_config(device_t bus, int irq, 
 }
 
 static void
-nexus_pic_mask(device_t bus, int irq)
+nexus_pic_mask(device_t bus, u_int irq)
 {
 	/* unused */
 }
 
 static void
-nexus_pic_unmask(device_t bus, int irq)
+nexus_pic_unmask(device_t bus, u_int irq)
 {
 	/* unused */
 }
 
 static void
-nexus_pic_eoi(device_t bus, int irq)
+nexus_pic_eoi(device_t bus, u_int irq)
 {
 	/* unused */
 }

Modified: projects/arm_intrng/sys/arm/arm/pic_if.m
==============================================================================
--- projects/arm_intrng/sys/arm/arm/pic_if.m	Sun Jan 11 17:35:55 2015	(r276989)
+++ projects/arm_intrng/sys/arm/arm/pic_if.m	Sun Jan 11 18:02:13 2015	(r276990)
@@ -42,12 +42,12 @@ CODE {
 		return (0);
 	}
 
-	static void null_pic_bind(device_t dev, int irq, cpuset_t cpumask)
+	static void null_pic_bind(device_t dev, u_int irq, cpuset_t cpumask)
 	{
 		return;
 	}
 
-	static void null_pic_ipi_send(device_t dev, cpuset_t cpus, int ipi)
+	static void null_pic_ipi_send(device_t dev, cpuset_t cpus, u_int ipi)
 	{
 		return;
 	}
@@ -70,7 +70,7 @@ CODE {
 
 METHOD int config {
 	device_t	dev;
-	int		irq;
+	u_int		irq;
 	enum intr_trigger trig;
 	enum intr_polarity pol;
 };
@@ -78,30 +78,30 @@ METHOD int config {
 METHOD int translate {
 	device_t	dev;
 	pcell_t		*cells;
-	int		*irq;
+	u_int		*irq;
 	enum intr_trigger *trig;
 	enum intr_polarity *pol;
 } DEFAULT null_pic_translate;
 
 METHOD void bind {
 	device_t	dev;
-	int		irq;
+	u_int		irq;
 	cpuset_t	cpumask;
 } DEFAULT null_pic_bind;
 
 METHOD void eoi {
 	device_t	dev;
-	int		irq;
+	u_int		irq;
 };
 
 METHOD void mask {
 	device_t	dev;
-	int		irq;
+	u_int		irq;
 };
 
 METHOD void unmask {
 	device_t	dev;
-	int		irq;
+	u_int		irq;
 };
 
 METHOD void init_secondary {
@@ -111,7 +111,7 @@ METHOD void init_secondary {
 METHOD void ipi_send {
 	device_t	dev;
 	cpuset_t	cpus;
-	int		ipi;
+	u_int		ipi;
 } DEFAULT null_pic_ipi_send;
 
 METHOD void ipi_clear {

Modified: projects/arm_intrng/sys/arm/include/intr.h
==============================================================================
--- projects/arm_intrng/sys/arm/include/intr.h	Sun Jan 11 17:35:55 2015	(r276989)
+++ projects/arm_intrng/sys/arm/include/intr.h	Sun Jan 11 18:02:13 2015	(r276990)
@@ -68,8 +68,8 @@ int arm_intrng_config_irq(int, enum intr
 #ifdef SMP
 void arm_init_secondary_ic(void);
 void arm_ipi_map_irq(device_t, u_int, u_int);
-void arm_unmask_ipi(int);
-void arm_mask_ipi(int);
+void arm_unmask_ipi(u_int);
+void arm_mask_ipi(u_int);
 #endif
 
 #else


More information about the svn-src-projects mailing list