Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/powerpc Some PICs have the capability to define the...
details: https://anonhg.NetBSD.org/src/rev/8de7bcb20e9b
branches: trunk
changeset: 772729:8de7bcb20e9b
user: phx <phx%NetBSD.org@localhost>
date: Sat Jan 14 19:35:58 2012 +0000
description:
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.
diffstat:
sys/arch/powerpc/include/intr.h | 35 +++++++++++++++++++--------------
sys/arch/powerpc/pic/intr.c | 16 +++++++++-----
sys/arch/powerpc/pic/pic_distopenpic.c | 19 +++++++++++++----
sys/arch/powerpc/pic/pic_mpcsoc.c | 19 +++++++++++++----
sys/arch/powerpc/pic/pic_openpic.c | 18 ++++++++++++----
5 files changed, 71 insertions(+), 36 deletions(-)
diffs (221 lines):
diff -r bd14d6274a5b -r 8de7bcb20e9b sys/arch/powerpc/include/intr.h
--- a/sys/arch/powerpc/include/intr.h Sat Jan 14 17:42:51 2012 +0000
+++ b/sys/arch/powerpc/include/intr.h Sat Jan 14 19:35:58 2012 +0000
@@ -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 @@
/* 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 *);
diff -r bd14d6274a5b -r 8de7bcb20e9b sys/arch/powerpc/pic/intr.c
--- a/sys/arch/powerpc/pic/intr.c Sat Jan 14 17:42:51 2012 +0000
+++ b/sys/arch/powerpc/pic/intr.c Sat Jan 14 19:35:58 2012 +0000
@@ -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 @@
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 @@
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 *
diff -r bd14d6274a5b -r 8de7bcb20e9b sys/arch/powerpc/pic/pic_distopenpic.c
--- a/sys/arch/powerpc/pic/pic_distopenpic.c Sat Jan 14 17:42:51 2012 +0000
+++ b/sys/arch/powerpc/pic/pic_distopenpic.c Sat Jan 14 19:35:58 2012 +0000
@@ -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 @@
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);
diff -r bd14d6274a5b -r 8de7bcb20e9b sys/arch/powerpc/pic/pic_mpcsoc.c
--- a/sys/arch/powerpc/pic/pic_mpcsoc.c Sat Jan 14 17:42:51 2012 +0000
+++ b/sys/arch/powerpc/pic/pic_mpcsoc.c Sat Jan 14 19:35:58 2012 +0000
@@ -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 @@
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);
diff -r bd14d6274a5b -r 8de7bcb20e9b sys/arch/powerpc/pic/pic_openpic.c
--- a/sys/arch/powerpc/pic/pic_openpic.c Sat Jan 14 17:42:51 2012 +0000
+++ b/sys/arch/powerpc/pic/pic_openpic.c Sat Jan 14 19:35:58 2012 +0000
@@ -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 @@
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);
Home |
Main Index |
Thread Index |
Old Index