Module Name: src
Committed By: phx
Date: Sat Jan 14 19:35:59 UTC 2012
Modified Files:
src/sys/arch/powerpc/include: intr.h
src/sys/arch/powerpc/pic: intr.c pic_distopenpic.c pic_mpcsoc.c
pic_openpic.c
Log Message:
Some PICs have the capability to define the interrupt's polarity (OpenPIC
for example). So the accepted interrupt types have been extended to:
- IST_EDGE_FALLING (which is the same as IST_EDGE)
- IST_EDGE_RISING (new)
- IST_LEVEL_LOW (is the same as IST_LEVEL)
- IST_LEVEL_HIGH (new)
Old code will continue to work without modification.
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/powerpc/include/intr.h
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/powerpc/pic/intr.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/pic/pic_distopenpic.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/powerpc/pic/pic_mpcsoc.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/powerpc/pic/pic_openpic.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/powerpc/include/intr.h
diff -u src/sys/arch/powerpc/include/intr.h:1.9 src/sys/arch/powerpc/include/intr.h:1.10
--- src/sys/arch/powerpc/include/intr.h:1.9 Mon Jun 20 20:24:28 2011
+++ src/sys/arch/powerpc/include/intr.h Sat Jan 14 19:35:58 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.9 2011/06/20 20:24:28 matt Exp $ */
+/* $NetBSD: intr.h,v 1.10 2012/01/14 19:35:58 phx Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@@ -28,7 +28,7 @@
#ifndef _LOCORE
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.h,v 1.9 2011/06/20 20:24:28 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.h,v 1.10 2012/01/14 19:35:58 phx Exp $");
#endif
#ifndef POWERPC_INTR_MACHDEP_H
@@ -38,21 +38,26 @@ __KERNEL_RCSID(0, "$NetBSD: intr.h,v 1.9
/* Interrupt priority `levels'. */
-#define IPL_NONE 0 /* nothing */
-#define IPL_SOFTCLOCK 1 /* timeouts */
-#define IPL_SOFTBIO 2 /* block I/O */
-#define IPL_SOFTNET 3 /* protocol stacks */
-#define IPL_SOFTSERIAL 4 /* serial */
-#define IPL_VM 5 /* memory allocation */
-#define IPL_SCHED 6
-#define IPL_HIGH 7 /* everything */
-#define NIPL 8
+#define IPL_NONE 0 /* nothing */
+#define IPL_SOFTCLOCK 1 /* timeouts */
+#define IPL_SOFTBIO 2 /* block I/O */
+#define IPL_SOFTNET 3 /* protocol stacks */
+#define IPL_SOFTSERIAL 4 /* serial */
+#define IPL_VM 5 /* memory allocation */
+#define IPL_SCHED 6
+#define IPL_HIGH 7 /* everything */
+#define NIPL 8
/* Interrupt sharing types. */
-#define IST_NONE 0 /* none */
-#define IST_PULSE 1 /* pulsed */
-#define IST_EDGE 2 /* edge-triggered */
-#define IST_LEVEL 3 /* level-triggered */
+#define IST_NONE 0 /* none */
+#define IST_PULSE 1 /* pulsed */
+#define IST_EDGE 2 /* falling edge triggered */
+#define IST_LEVEL 3 /* low level triggered */
+
+#define IST_EDGE_FALLING IST_EDGE
+#define IST_EDGE_RISING 4 /* rising edge triggered */
+#define IST_LEVEL_LOW IST_LEVEL
+#define IST_LEVEL_HIGH 5 /* high level triggered */
#if !defined(_LOCORE)
void * intr_establish(int, int, int, int (*)(void *), void *);
Index: src/sys/arch/powerpc/pic/intr.c
diff -u src/sys/arch/powerpc/pic/intr.c:1.18 src/sys/arch/powerpc/pic/intr.c:1.19
--- src/sys/arch/powerpc/pic/intr.c:1.18 Tue Sep 27 01:02:36 2011
+++ src/sys/arch/powerpc/pic/intr.c Sat Jan 14 19:35:59 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.c,v 1.18 2011/09/27 01:02:36 jym Exp $ */
+/* $NetBSD: intr.c,v 1.19 2012/01/14 19:35:59 phx Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.18 2011/09/27 01:02:36 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.19 2012/01/14 19:35:59 phx Exp $");
#include "opt_interrupt.h"
#include "opt_multiprocessor.h"
@@ -168,8 +168,10 @@ intr_establish(int hwirq, int type, int
case IST_NONE:
is->is_type = type;
break;
- case IST_EDGE:
- case IST_LEVEL:
+ case IST_EDGE_FALLING:
+ case IST_EDGE_RISING:
+ case IST_LEVEL_LOW:
+ case IST_LEVEL_HIGH:
if (type == is->is_type)
break;
/* FALLTHROUGH */
@@ -327,8 +329,10 @@ mapirq(int hwirq)
static const char * const intr_typenames[] = {
[IST_NONE] = "none",
[IST_PULSE] = "pulsed",
- [IST_EDGE] = "edge-triggered",
- [IST_LEVEL] = "level-triggered",
+ [IST_EDGE_FALLING] = "falling edge triggered",
+ [IST_EDGE_RISING] = "rising edge triggered",
+ [IST_LEVEL_LOW] = "low level triggered",
+ [IST_LEVEL_HIGH] = "high level triggered",
};
const char *
Index: src/sys/arch/powerpc/pic/pic_distopenpic.c
diff -u src/sys/arch/powerpc/pic/pic_distopenpic.c:1.7 src/sys/arch/powerpc/pic/pic_distopenpic.c:1.8
--- src/sys/arch/powerpc/pic/pic_distopenpic.c:1.7 Sat Jul 2 13:08:25 2011
+++ src/sys/arch/powerpc/pic/pic_distopenpic.c Sat Jan 14 19:35:59 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: pic_distopenpic.c,v 1.7 2011/07/02 13:08:25 mrg Exp $ */
+/* $NetBSD: pic_distopenpic.c,v 1.8 2012/01/14 19:35:59 phx Exp $ */
/*-
* Copyright (c) 2008 Tim Rightnour
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pic_distopenpic.c,v 1.7 2011/07/02 13:08:25 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic_distopenpic.c,v 1.8 2012/01/14 19:35:59 phx Exp $");
#include "opt_openpic.h"
#include "opt_interrupt.h"
@@ -182,9 +182,18 @@ distopic_establish_irq(struct pic_ops *p
x = irq;
x |= OPENPIC_IMASK;
- x |= (realirq == 0 && isu == 0) ?
- OPENPIC_POLARITY_POSITIVE : OPENPIC_POLARITY_NEGATIVE;
- x |= (type == IST_EDGE) ? OPENPIC_SENSE_EDGE : OPENPIC_SENSE_LEVEL;
+
+ if ((realirq == 0 && isu == 0) ||
+ type == IST_EDGE_RISING || type == IST_LEVEL_HIGH)
+ x |= OPENPIC_POLARITY_POSITIVE;
+ else
+ x |= OPENPIC_POLARITY_NEGATIVE;
+
+ if (type == IST_EDGE_FALLING || type == IST_EDGE_RISING)
+ x |= OPENPIC_SENSE_EDGE;
+ else
+ x |= OPENPIC_SENSE_LEVEL;
+
x |= realpri << OPENPIC_PRIORITY_SHIFT;
distopic_write(opic, isu, OPENPIC_DSRC_VECTOR_OFFSET(realirq), x);
Index: src/sys/arch/powerpc/pic/pic_mpcsoc.c
diff -u src/sys/arch/powerpc/pic/pic_mpcsoc.c:1.2 src/sys/arch/powerpc/pic/pic_mpcsoc.c:1.3
--- src/sys/arch/powerpc/pic/pic_mpcsoc.c:1.2 Mon Jun 20 06:21:45 2011
+++ src/sys/arch/powerpc/pic/pic_mpcsoc.c Sat Jan 14 19:35:59 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: pic_mpcsoc.c,v 1.2 2011/06/20 06:21:45 matt Exp $ */
+/* $NetBSD: pic_mpcsoc.c,v 1.3 2012/01/14 19:35:59 phx Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pic_mpcsoc.c,v 1.2 2011/06/20 06:21:45 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic_mpcsoc.c,v 1.3 2012/01/14 19:35:59 phx Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@@ -161,9 +161,18 @@ mpcpic_establish_irq(struct pic_ops *pic
x = irq;
x |= OPENPIC_IMASK;
- x |= (i8259iswired && irq == 0) ?
- OPENPIC_POLARITY_POSITIVE : OPENPIC_POLARITY_NEGATIVE;
- x |= (type == IST_EDGE) ? OPENPIC_SENSE_EDGE : OPENPIC_SENSE_LEVEL;
+
+ if ((i8259iswired && irq == 0) ||
+ type == IST_EDGE_RISING || type == IST_LEVEL_HIGH)
+ x |= OPENPIC_POLARITY_POSITIVE;
+ else
+ x |= OPENPIC_POLARITY_NEGATIVE;
+
+ if (type == IST_EDGE_FALLING || type == IST_EDGE_RISING)
+ x |= OPENPIC_SENSE_EDGE;
+ else
+ x |= OPENPIC_SENSE_LEVEL;
+
x |= realpri << OPENPIC_PRIORITY_SHIFT;
openpic_write(MPCPIC_IVEC(irq), x);
Index: src/sys/arch/powerpc/pic/pic_openpic.c
diff -u src/sys/arch/powerpc/pic/pic_openpic.c:1.6 src/sys/arch/powerpc/pic/pic_openpic.c:1.7
--- src/sys/arch/powerpc/pic/pic_openpic.c:1.6 Mon Jun 20 06:21:45 2011
+++ src/sys/arch/powerpc/pic/pic_openpic.c Sat Jan 14 19:35:59 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: pic_openpic.c,v 1.6 2011/06/20 06:21:45 matt Exp $ */
+/* $NetBSD: pic_openpic.c,v 1.7 2012/01/14 19:35:59 phx Exp $ */
/*-
* Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pic_openpic.c,v 1.6 2011/06/20 06:21:45 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pic_openpic.c,v 1.7 2012/01/14 19:35:59 phx Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@@ -144,9 +144,17 @@ opic_establish_irq(struct pic_ops *pic,
x = irq;
x |= OPENPIC_IMASK;
- x |= (irq == 0) ?
- OPENPIC_POLARITY_POSITIVE : OPENPIC_POLARITY_NEGATIVE;
- x |= (type == IST_EDGE) ? OPENPIC_SENSE_EDGE : OPENPIC_SENSE_LEVEL;
+
+ if (irq == 0 || type == IST_EDGE_RISING || type == IST_LEVEL_HIGH)
+ x |= OPENPIC_POLARITY_POSITIVE;
+ else
+ x |= OPENPIC_POLARITY_NEGATIVE;
+
+ if (type == IST_EDGE_FALLING || type == IST_EDGE_RISING)
+ x |= OPENPIC_SENSE_EDGE;
+ else
+ x |= OPENPIC_SENSE_LEVEL;
+
x |= realpri << OPENPIC_PRIORITY_SHIFT;
openpic_write(OPENPIC_SRC_VECTOR(irq), x);