From 4eca7e7c2dc930a1850278a29a5e30e1837e1a1c Mon Sep 17 00:00:00 2001 From: jmmv Date: Sat, 10 Mar 2007 14:15:48 +0000 Subject: [PATCH] Implement support for softintrs. Reviewed, corrected and tested by aymeric@. --- sys/arch/ofppc/conf/files.ofppc | 4 +++- sys/arch/ofppc/firepower/firepower_intr.c | 10 ++++------ sys/arch/ofppc/include/intr.h | 7 ++++++- sys/arch/ofppc/include/types.h | 3 ++- sys/arch/ofppc/ofppc/machdep.c | 8 ++++++-- sys/arch/ofppc/ofwgen/ofwgen_intr.c | 16 ++++++---------- 6 files changed, 27 insertions(+), 21 deletions(-) diff --git a/sys/arch/ofppc/conf/files.ofppc b/sys/arch/ofppc/conf/files.ofppc index 3b1ebd70f9d3..f325d28edec5 100644 --- a/sys/arch/ofppc/conf/files.ofppc +++ b/sys/arch/ofppc/conf/files.ofppc @@ -1,4 +1,4 @@ -# $NetBSD: files.ofppc,v 1.25 2007/01/14 22:18:02 aymeric Exp $ +# $NetBSD: files.ofppc,v 1.26 2007/03/10 14:15:48 jmmv Exp $ # # NetBSD/ofppc configuration info # @@ -24,6 +24,8 @@ file dev/cons.c file dev/cninit.c file arch/powerpc/powerpc/procfs_machdep.c procfs +file arch/powerpc/powerpc/softintr.c + # # CPU specific OpenFirmware code # diff --git a/sys/arch/ofppc/firepower/firepower_intr.c b/sys/arch/ofppc/firepower/firepower_intr.c index 78f0face73bc..720a50bd86f2 100644 --- a/sys/arch/ofppc/firepower/firepower_intr.c +++ b/sys/arch/ofppc/firepower/firepower_intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: firepower_intr.c,v 1.9 2006/11/24 21:20:05 wiz Exp $ */ +/* $NetBSD: firepower_intr.c,v 1.10 2007/03/10 14:15:48 jmmv Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: firepower_intr.c,v 1.9 2006/11/24 21:20:05 wiz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: firepower_intr.c,v 1.10 2007/03/10 14:15:48 jmmv Exp $"); #include #include @@ -749,11 +749,9 @@ firepower_pciide_compat_intr_establish(void *v, struct device *dev, void firepower_do_softnet() { - int pisr, s; + int s; s = splsoftnet(); - pisr = netisr; - netisr = 0; - softnet(pisr); + softintr__run(IPL_SOFTNET); splx(s); } diff --git a/sys/arch/ofppc/include/intr.h b/sys/arch/ofppc/include/intr.h index 416887d56f92..18ac36aa6030 100644 --- a/sys/arch/ofppc/include/intr.h +++ b/sys/arch/ofppc/include/intr.h @@ -1,4 +1,4 @@ -/* $NetBSD: intr.h,v 1.8 2007/02/16 02:53:49 ad Exp $ */ +/* $NetBSD: intr.h,v 1.9 2007/03/10 14:15:48 jmmv Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -98,6 +98,10 @@ #ifdef _KERNEL #ifndef _LOCORE +#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS +#include +#endif + struct clockframe; extern int imask[]; @@ -133,6 +137,7 @@ extern struct machvec machine_interface; #define setsoftnet() setsoftintr(IPL_SOFTNET) #define setsoftclock() setsoftintr(IPL_SOFTCLOCK) +#define setsoftserial() setsoftintr(IPL_SERIAL) /* * Software interrupt support. diff --git a/sys/arch/ofppc/include/types.h b/sys/arch/ofppc/include/types.h index 38cb9b0510a0..9f38401dcbe2 100644 --- a/sys/arch/ofppc/include/types.h +++ b/sys/arch/ofppc/include/types.h @@ -1,6 +1,7 @@ -/* $NetBSD: types.h,v 1.6 2006/09/13 07:14:35 gdamore Exp $ */ +/* $NetBSD: types.h,v 1.7 2007/03/10 14:15:48 jmmv Exp $ */ #include #define __HAVE_DEVICE_REGISTER +#define __HAVE_GENERIC_SOFT_INTERRUPTS #define __HAVE_GENERIC_TODR diff --git a/sys/arch/ofppc/ofppc/machdep.c b/sys/arch/ofppc/ofppc/machdep.c index 0932e61a3dcc..43173831dbd9 100644 --- a/sys/arch/ofppc/ofppc/machdep.c +++ b/sys/arch/ofppc/ofppc/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.90 2007/02/09 21:55:07 ad Exp $ */ +/* $NetBSD: machdep.c,v 1.91 2007/03/10 14:15:48 jmmv Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.90 2007/02/09 21:55:07 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.91 2007/03/10 14:15:48 jmmv Exp $"); #include "opt_compat_netbsd.h" #include "opt_ddb.h" @@ -64,6 +64,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.90 2007/02/09 21:55:07 ad Exp $"); #include #include +#include #include #include #include @@ -188,6 +189,9 @@ cpu_startup() */ splhigh(); mtmsr(mfmsr() | PSL_EE | PSL_RI); +#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS + softintr__init(); +#endif if (platform.softintr_init != NULL) platform.softintr_init(); } diff --git a/sys/arch/ofppc/ofwgen/ofwgen_intr.c b/sys/arch/ofppc/ofwgen/ofwgen_intr.c index b31faa0efe21..5278f9315ebf 100644 --- a/sys/arch/ofppc/ofwgen/ofwgen_intr.c +++ b/sys/arch/ofppc/ofwgen/ofwgen_intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: ofwgen_intr.c,v 1.10 2006/11/24 21:20:05 wiz Exp $ */ +/* $NetBSD: ofwgen_intr.c,v 1.11 2007/03/10 14:15:48 jmmv Exp $ */ /* * Copyright (C) 1997 Wolfgang Solfrank. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ofwgen_intr.c,v 1.10 2006/11/24 21:20:05 wiz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ofwgen_intr.c,v 1.11 2007/03/10 14:15:48 jmmv Exp $"); #include #include @@ -202,17 +202,15 @@ do_pending_int(void) cpl |= imask[IPL_SOFTCLOCK]; ipending &= ~B(IPL_SOFTCLOCK); mtmsr(emsr); - softclock(NULL); + softintr__run(IPL_SOFTCLOCK); continue; } if ((ipending & B(IPL_SOFTNET)) != 0 && (cpl & B(IPL_SOFTNET)) == 0) { - int pisr = netisr; - netisr = 0; cpl |= imask[IPL_SOFTNET]; ipending &= ~B(IPL_SOFTNET); mtmsr(emsr); - softnet(pisr); + softintr__run(IPL_SOFTNET); continue; } if ((ipending & B(IPL_SOFT)) != 0 && @@ -323,17 +321,15 @@ intr_return(struct clockframe *frame, int level) cpl |= imask[IPL_SOFTCLOCK]; ipending &= ~B(IPL_SOFTCLOCK); mtmsr(emsr); - softclock(NULL); + softintr__run(IPL_SOFTCLOCK); continue; } if ((ipending & B(IPL_SOFTNET)) != 0 && (cpl & B(IPL_SOFTNET)) == 0) { - int pisr = netisr; - netisr = 0; cpl |= imask[IPL_SOFTNET]; ipending &= ~B(IPL_SOFTNET); mtmsr(emsr); - softnet(pisr); + softintr__run(IPL_SOFTNET); continue; } if ((ipending & B(IPL_SOFT)) != 0 &&