Implement support for softintrs.

Reviewed, corrected and tested by aymeric@.
This commit is contained in:
jmmv 2007-03-10 14:15:48 +00:00
parent 0cc210063b
commit 4eca7e7c2d
6 changed files with 27 additions and 21 deletions

View File

@ -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 # NetBSD/ofppc configuration info
# #
@ -24,6 +24,8 @@ file dev/cons.c
file dev/cninit.c file dev/cninit.c
file arch/powerpc/powerpc/procfs_machdep.c procfs file arch/powerpc/powerpc/procfs_machdep.c procfs
file arch/powerpc/powerpc/softintr.c
# #
# CPU specific OpenFirmware code # CPU specific OpenFirmware code
# #

View File

@ -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. * Copyright 2001 Wasabi Systems, Inc.
@ -40,7 +40,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -749,11 +749,9 @@ firepower_pciide_compat_intr_establish(void *v, struct device *dev,
void void
firepower_do_softnet() firepower_do_softnet()
{ {
int pisr, s; int s;
s = splsoftnet(); s = splsoftnet();
pisr = netisr; softintr__run(IPL_SOFTNET);
netisr = 0;
softnet(pisr);
splx(s); splx(s);
} }

View File

@ -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. * Copyright 2001 Wasabi Systems, Inc.
@ -98,6 +98,10 @@
#ifdef _KERNEL #ifdef _KERNEL
#ifndef _LOCORE #ifndef _LOCORE
#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
#include <powerpc/softintr.h>
#endif
struct clockframe; struct clockframe;
extern int imask[]; extern int imask[];
@ -133,6 +137,7 @@ extern struct machvec machine_interface;
#define setsoftnet() setsoftintr(IPL_SOFTNET) #define setsoftnet() setsoftintr(IPL_SOFTNET)
#define setsoftclock() setsoftintr(IPL_SOFTCLOCK) #define setsoftclock() setsoftintr(IPL_SOFTCLOCK)
#define setsoftserial() setsoftintr(IPL_SERIAL)
/* /*
* Software interrupt support. * Software interrupt support.

View File

@ -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 <powerpc/types.h> #include <powerpc/types.h>
#define __HAVE_DEVICE_REGISTER #define __HAVE_DEVICE_REGISTER
#define __HAVE_GENERIC_SOFT_INTERRUPTS
#define __HAVE_GENERIC_TODR #define __HAVE_GENERIC_TODR

View File

@ -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. * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -32,7 +32,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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_compat_netbsd.h"
#include "opt_ddb.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 <dev/ofw/openfirm.h> #include <dev/ofw/openfirm.h>
#include <machine/autoconf.h> #include <machine/autoconf.h>
#include <machine/intr.h>
#include <machine/pmap.h> #include <machine/pmap.h>
#include <machine/powerpc.h> #include <machine/powerpc.h>
#include <machine/trap.h> #include <machine/trap.h>
@ -188,6 +189,9 @@ cpu_startup()
*/ */
splhigh(); splhigh();
mtmsr(mfmsr() | PSL_EE | PSL_RI); mtmsr(mfmsr() | PSL_EE | PSL_RI);
#ifdef __HAVE_GENERIC_SOFT_INTERRUPTS
softintr__init();
#endif
if (platform.softintr_init != NULL) if (platform.softintr_init != NULL)
platform.softintr_init(); platform.softintr_init();
} }

View File

@ -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. * Copyright (C) 1997 Wolfgang Solfrank.
@ -37,7 +37,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__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 <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -202,17 +202,15 @@ do_pending_int(void)
cpl |= imask[IPL_SOFTCLOCK]; cpl |= imask[IPL_SOFTCLOCK];
ipending &= ~B(IPL_SOFTCLOCK); ipending &= ~B(IPL_SOFTCLOCK);
mtmsr(emsr); mtmsr(emsr);
softclock(NULL); softintr__run(IPL_SOFTCLOCK);
continue; continue;
} }
if ((ipending & B(IPL_SOFTNET)) != 0 && if ((ipending & B(IPL_SOFTNET)) != 0 &&
(cpl & B(IPL_SOFTNET)) == 0) { (cpl & B(IPL_SOFTNET)) == 0) {
int pisr = netisr;
netisr = 0;
cpl |= imask[IPL_SOFTNET]; cpl |= imask[IPL_SOFTNET];
ipending &= ~B(IPL_SOFTNET); ipending &= ~B(IPL_SOFTNET);
mtmsr(emsr); mtmsr(emsr);
softnet(pisr); softintr__run(IPL_SOFTNET);
continue; continue;
} }
if ((ipending & B(IPL_SOFT)) != 0 && if ((ipending & B(IPL_SOFT)) != 0 &&
@ -323,17 +321,15 @@ intr_return(struct clockframe *frame, int level)
cpl |= imask[IPL_SOFTCLOCK]; cpl |= imask[IPL_SOFTCLOCK];
ipending &= ~B(IPL_SOFTCLOCK); ipending &= ~B(IPL_SOFTCLOCK);
mtmsr(emsr); mtmsr(emsr);
softclock(NULL); softintr__run(IPL_SOFTCLOCK);
continue; continue;
} }
if ((ipending & B(IPL_SOFTNET)) != 0 && if ((ipending & B(IPL_SOFTNET)) != 0 &&
(cpl & B(IPL_SOFTNET)) == 0) { (cpl & B(IPL_SOFTNET)) == 0) {
int pisr = netisr;
netisr = 0;
cpl |= imask[IPL_SOFTNET]; cpl |= imask[IPL_SOFTNET];
ipending &= ~B(IPL_SOFTNET); ipending &= ~B(IPL_SOFTNET);
mtmsr(emsr); mtmsr(emsr);
softnet(pisr); softintr__run(IPL_SOFTNET);
continue; continue;
} }
if ((ipending & B(IPL_SOFT)) != 0 && if ((ipending & B(IPL_SOFT)) != 0 &&