summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/aviion/aviion/autoconf.c4
-rw-r--r--sys/arch/aviion/aviion/machdep.c4
-rw-r--r--sys/arch/aviion/include/intr.h5
-rw-r--r--sys/arch/luna88k/include/intr.h5
-rw-r--r--sys/arch/luna88k/luna88k/autoconf.c3
-rw-r--r--sys/arch/m88k/conf/files.m88k3
-rw-r--r--sys/arch/m88k/include/_types.h5
-rw-r--r--sys/arch/m88k/include/cpu.h18
-rw-r--r--sys/arch/m88k/include/intr.h100
-rw-r--r--sys/arch/m88k/m88k/db_interface.c11
-rw-r--r--sys/arch/m88k/m88k/eh_common.S40
-rw-r--r--sys/arch/m88k/m88k/genassym.cf6
-rw-r--r--sys/arch/m88k/m88k/m88k_machdep.c50
-rw-r--r--sys/arch/m88k/m88k/softintr.c197
-rw-r--r--sys/arch/mvme88k/include/cpu.h6
-rw-r--r--sys/arch/mvme88k/include/intr.h5
-rw-r--r--sys/arch/mvme88k/mvme88k/autoconf.c4
-rw-r--r--sys/arch/mvme88k/mvme88k/m187_machdep.c5
-rw-r--r--sys/arch/mvme88k/mvme88k/m188_machdep.c10
-rw-r--r--sys/arch/mvme88k/mvme88k/m197_machdep.c7
-rw-r--r--sys/arch/mvme88k/mvme88k/machdep.c9
21 files changed, 377 insertions, 120 deletions
diff --git a/sys/arch/aviion/aviion/autoconf.c b/sys/arch/aviion/aviion/autoconf.c
index 1b0b7619009..7e20e70d0d9 100644
--- a/sys/arch/aviion/aviion/autoconf.c
+++ b/sys/arch/aviion/aviion/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.8 2008/07/21 04:35:54 todd Exp $ */
+/* $OpenBSD: autoconf.c,v 1.9 2009/03/15 20:39:51 miod Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -81,6 +81,8 @@ cpu_configure()
printf("bootpath: '%s' dev %u unit %u part %u\n",
bootargs, bootdev, bootunit, bootpart);
+ softintr_init();
+
if (config_rootfound("mainbus", "mainbus") == 0)
panic("no mainbus found");
diff --git a/sys/arch/aviion/aviion/machdep.c b/sys/arch/aviion/aviion/machdep.c
index 142466997ba..f7075d81c1e 100644
--- a/sys/arch/aviion/aviion/machdep.c
+++ b/sys/arch/aviion/aviion/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.25 2008/06/27 17:22:14 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.26 2009/03/15 20:39:51 miod Exp $ */
/*
* Copyright (c) 2007 Miodrag Vallat.
*
@@ -14,7 +14,7 @@
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-/* $OpenBSD: machdep.c,v 1.25 2008/06/27 17:22:14 miod Exp $ */
+ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
diff --git a/sys/arch/aviion/include/intr.h b/sys/arch/aviion/include/intr.h
index 68a8bfc4f0b..0483a817b4d 100644
--- a/sys/arch/aviion/include/intr.h
+++ b/sys/arch/aviion/include/intr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.h,v 1.2 2007/12/19 22:05:06 miod Exp $ */
+/* $OpenBSD: intr.h,v 1.3 2009/03/15 20:39:53 miod Exp $ */
/*
* Copyright (C) 2000 Steve Murphree, Jr.
* All rights reserved.
@@ -37,8 +37,7 @@
*/
#define IPL_NONE 0
-#define IPL_SOFTCLOCK 1
-#define IPL_SOFTNET 1
+#define IPL_SOFTINT 1
#define IPL_BIO 2
#define IPL_NET 3
#define IPL_TTY 3
diff --git a/sys/arch/luna88k/include/intr.h b/sys/arch/luna88k/include/intr.h
index 9efc183044a..a81fa6423a2 100644
--- a/sys/arch/luna88k/include/intr.h
+++ b/sys/arch/luna88k/include/intr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.h,v 1.5 2006/03/13 19:43:22 brad Exp $ */
+/* $OpenBSD: intr.h,v 1.6 2009/03/15 20:39:53 miod Exp $ */
/*
* Copyright (C) 2000 Steve Murphree, Jr.
* All rights reserved.
@@ -34,8 +34,7 @@
*/
#define IPL_NONE 0
-#define IPL_SOFTCLOCK 1
-#define IPL_SOFTNET 1
+#define IPL_SOFTINT 1
#define IPL_BIO 3
#define IPL_NET 4
#define IPL_TTY 5
diff --git a/sys/arch/luna88k/luna88k/autoconf.c b/sys/arch/luna88k/luna88k/autoconf.c
index 9a9feadf90e..da5d6d4db02 100644
--- a/sys/arch/luna88k/luna88k/autoconf.c
+++ b/sys/arch/luna88k/luna88k/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.14 2008/07/21 04:35:54 todd Exp $ */
+/* $OpenBSD: autoconf.c,v 1.15 2009/03/15 20:39:53 miod Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -72,6 +72,7 @@ struct device *bootdv; /* set by device drivers (if found) */
void
cpu_configure()
{
+ softintr_init();
if (config_rootfound("mainbus", "mainbus") == 0)
panic("no mainbus found");
diff --git a/sys/arch/m88k/conf/files.m88k b/sys/arch/m88k/conf/files.m88k
index 780cb3a40da..b60f213d360 100644
--- a/sys/arch/m88k/conf/files.m88k
+++ b/sys/arch/m88k/conf/files.m88k
@@ -1,4 +1,4 @@
-# $OpenBSD: files.m88k,v 1.22 2009/02/20 20:40:00 miod Exp $
+# $OpenBSD: files.m88k,v 1.23 2009/03/15 20:39:53 miod Exp $
file arch/m88k/m88k/atomic.S multiprocessor
file arch/m88k/m88k/db_disasm.c ddb
@@ -17,6 +17,7 @@ file arch/m88k/m88k/pmap.c
file arch/m88k/m88k/process.S
file arch/m88k/m88k/process_machdep.c
file arch/m88k/m88k/sig_machdep.c
+file arch/m88k/m88k/softintr.c
file arch/m88k/m88k/subr.S
file arch/m88k/m88k/trap.c
file arch/m88k/m88k/vectors_88100.S m88100
diff --git a/sys/arch/m88k/include/_types.h b/sys/arch/m88k/include/_types.h
index 4c27f7769de..896bf022cc2 100644
--- a/sys/arch/m88k/include/_types.h
+++ b/sys/arch/m88k/include/_types.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: _types.h,v 1.5 2008/07/21 20:50:54 martynas Exp $ */
+/* $OpenBSD: _types.h,v 1.6 2009/03/15 20:39:53 miod Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -117,4 +117,7 @@ typedef int __rune_t;
typedef void * __wctrans_t;
typedef void * __wctype_t;
+/* Feature test macros */
+#define __HAVE_GENERIC_SOFT_INTERRUPTS
+
#endif /* _M88K__TYPES_H_ */
diff --git a/sys/arch/m88k/include/cpu.h b/sys/arch/m88k/include/cpu.h
index 1f6a8d82b98..ba51c650a5a 100644
--- a/sys/arch/m88k/include/cpu.h
+++ b/sys/arch/m88k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.45 2009/03/04 19:39:02 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.46 2009/03/15 20:39:53 miod Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* Copyright (c) 1992, 1993
@@ -147,7 +147,6 @@ struct cpu_info {
#define CI_DDB_INDDB 2
#define CI_DDB_PAUSE 3
- int ci_softintr; /* pending soft interrupts */
u_int32_t ci_randseed; /* per-cpu random seed */
int ci_ipi; /* pending ipis */
@@ -162,6 +161,7 @@ struct cpu_info {
#define CI_IPI_CACHE_FLUSH 0x00000040
#define CI_IPI_ICACHE_FLUSH 0x00000080
#define CI_IPI_DMA_CACHECTL 0x00000100
+ void (*ci_softipi_cb)(void); /* 88110 softipi callback */
};
extern cpuid_t master_cpu;
@@ -246,20 +246,6 @@ struct clockframe {
#define CLKF_INTR(framep) \
(((struct cpu_info *)(framep)->tf.tf_cpu)->ci_intrdepth > 1)
-/*
- * Get interrupt glue.
- */
-#include <machine/intr.h>
-
-#define SIR_NET 0x01
-#define SIR_CLOCK 0x02
-#define SIR_IPI 0x04
-
-#define setsoftint(ci,x) atomic_setbits_int(&ci->ci_softintr, x)
-#define setsoftnet() setsoftint(curcpu(), SIR_NET)
-#define setsoftclock() setsoftint(curcpu(), SIR_CLOCK)
-#define setsoftipi(ci) setsoftint(ci, SIR_IPI)
-
#define aston(p) ((p)->p_md.md_astpending = 1)
/*
diff --git a/sys/arch/m88k/include/intr.h b/sys/arch/m88k/include/intr.h
index 1853e9372ca..27839399923 100644
--- a/sys/arch/m88k/include/intr.h
+++ b/sys/arch/m88k/include/intr.h
@@ -1,4 +1,38 @@
-/* $OpenBSD: intr.h,v 1.10 2009/03/15 19:40:40 miod Exp $ */
+/* $OpenBSD: intr.h,v 1.11 2009/03/15 20:39:53 miod Exp $ */
+/*
+ * Copyright (c) 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed for the NetBSD Project by
+ * Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
/*
* Copyright (C) 2000 Steve Murphree, Jr.
* All rights reserved.
@@ -31,10 +65,10 @@
#ifdef _KERNEL
#ifndef _LOCORE
-int getipl(void);
-int setipl(int level);
-int raiseipl(int level);
-int spl0(void);
+int getipl(void);
+int setipl(int level);
+int raiseipl(int level);
+int spl0(void);
/* SPL asserts */
#ifdef DIAGNOSTIC
@@ -50,7 +84,7 @@ void splassert_check(int, const char *);
splassert_check(__wantipl, __func__); \
} \
} while (0)
-#define splsoftassert(wantipl) splassert(wantipl)
+#define splsoftassert(wantipl) splassert(IPL_SOFTINT)
#else
#define splassert(wantipl) do { /* nothing */ } while (0)
#define splsoftassert(wantipl) do { /* nothing */ } while (0)
@@ -58,8 +92,8 @@ void splassert_check(int, const char *);
#endif /* _LOCORE */
-#define splsoftclock() raiseipl(IPL_SOFTCLOCK)
-#define splsoftnet() raiseipl(IPL_SOFTNET)
+#define splsoftclock() raiseipl(IPL_SOFTINT)
+#define splsoftnet() raiseipl(IPL_SOFTINT)
#define splbio() raiseipl(IPL_BIO)
#define splnet() raiseipl(IPL_NET)
#define spltty() raiseipl(IPL_TTY)
@@ -73,5 +107,55 @@ void splassert_check(int, const char *);
#define splx(x) ((x) ? setipl((x)) : spl0())
+/*
+ * Generic software interrupt support for all m88k platforms.
+ */
+
+#ifndef _LOCORE
+
+#define IPL_SOFT 0
+#define IPL_SOFTCLOCK 1
+#define IPL_SOFTNET 2
+#define IPL_SOFTTTY 3
+
+#define SI_SOFT 0 /* for IPL_SOFT */
+#define SI_SOFTCLOCK 1 /* for IPL_SOFTCLOCK */
+#define SI_SOFTNET 2 /* for IPL_SOFTNET */
+#define SI_SOFTTTY 3 /* for IPL_SOFTTTY */
+
+#define SI_NQUEUES 4
+
+#include <machine/mutex.h>
+#include <sys/queue.h>
+
+struct soft_intrhand {
+ TAILQ_ENTRY(soft_intrhand) sih_list;
+ void (*sih_func)(void *);
+ void *sih_arg;
+ struct soft_intrq *sih_siq;
+ int sih_pending;
+};
+
+struct soft_intrq {
+ TAILQ_HEAD(, soft_intrhand) siq_list;
+ int siq_si;
+ struct mutex siq_mtx;
+};
+
+void softintr_disestablish(void *);
+void softintr_dispatch(int);
+void *softintr_establish(int, void (*)(void *), void *);
+void softintr_init(void);
+void softintr_schedule(void *);
+
+extern int softpending;
+
+/* XXX For legacy software interrupts. */
+extern struct soft_intrhand *softnet_intrhand;
+
+#define setsoftnet() softintr_schedule(softnet_intrhand)
+
+#endif /* _LOCORE */
+
#endif /* _KERNEL */
#endif /* _M88K_INTR_H_ */
diff --git a/sys/arch/m88k/m88k/db_interface.c b/sys/arch/m88k/m88k/db_interface.c
index aee32511403..ac092f6d418 100644
--- a/sys/arch/m88k/m88k/db_interface.c
+++ b/sys/arch/m88k/m88k/db_interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_interface.c,v 1.14 2008/10/27 18:03:46 miod Exp $ */
+/* $OpenBSD: db_interface.c,v 1.15 2009/03/15 20:39:53 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
@@ -611,7 +611,7 @@ m88k_db_cpu_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
return;
}
- db_printf(" cpu flags state curproc curpcb depth ipi softintr\n");
+ db_printf(" cpu flags state curproc curpcb depth ipi\n");
CPU_INFO_FOREACH(cpu, ci) {
switch (ci->ci_ddb_state) {
case CI_DDB_RUNNING:
@@ -623,15 +623,18 @@ m88k_db_cpu_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
case CI_DDB_INDDB:
strlcpy(state, "in ddb", sizeof state);
break;
+ case CI_DDB_PAUSE:
+ strlcpy(state, "paused", sizeof state);
+ break;
default:
snprintf(state, sizeof state, "unknown (%d)",
ci->ci_ddb_state);
break;
}
- db_printf("%ccpu%1d %02x %-14s %08x %08x %3d %08x %08x\n",
+ db_printf("%ccpu%1d %02x %-14s %08x %08x %3d %08x\n",
(cpu == cpu_number()) ? '*' : ' ', CPU_INFO_UNIT(ci),
ci->ci_flags, state, ci->ci_curproc, ci->ci_curpcb,
- ci->ci_intrdepth, ci->ci_ipi, ci->ci_softintr);
+ ci->ci_intrdepth, ci->ci_ipi);
}
}
diff --git a/sys/arch/m88k/m88k/eh_common.S b/sys/arch/m88k/m88k/eh_common.S
index b122fa25c96..b9d8cfc5aa1 100644
--- a/sys/arch/m88k/m88k/eh_common.S
+++ b/sys/arch/m88k/m88k/eh_common.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: eh_common.S,v 1.53 2009/03/01 17:43:25 miod Exp $ */
+/* $OpenBSD: eh_common.S,v 1.54 2009/03/15 20:39:53 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
@@ -2131,7 +2131,7 @@ ASGLOBAL(check_ast)
ld FPTR, r31, 0 /* grab exception frame pointer */
/*
- * If the saved ipl is 0, then call dosoftint() to process soft
+ * If the saved ipl is 0, then call spl0() to process soft
* interrupts. And if returning to userland, look for ASTs.
*/
@@ -2142,29 +2142,41 @@ ASGLOBAL(check_ast)
ld r2, FPTR, EF_MASK
bcnd ne0, r2, _ASM_LABEL(ast_done)
- /* save us the setipl calls if no pending software interrupts */
- ldcr r3, CPU
- ld r2, r3, CI_SOFTINTR
- bcnd eq0, r2, _ASM_LABEL(softint_done)
+#ifdef MULTIPROCESSOR
+ /*
+ * Check for IPI soft interrupt
+ */
+ ldcr r3, CPU
+ or r15, r0, r0
+ addu r3, r3, CI_SOFTIPI_CB
+ xmem r15, r3, r0
+ bcnd eq0, r15, _ASM_LABEL(do_softint)
bsr.n _C_LABEL(setipl)
- or r2, r0, IPL_SOFTCLOCK
- bsr _C_LABEL(dosoftint)
- bsr.n _C_LABEL(setipl)
- or r2, r0, IPL_NONE
+ or r2, r0, IPL_NONE
+
+ jsr r15
+ASLOCAL(do_softint)
+#endif
+
+ /*
+ * Process soft interrupts, if any.
+ */
+ bsr _C_LABEL(spl0)
-ASGLOBAL(softint_done)
/* do not service AST if not returning to user mode */
ld r2, FPTR, EF_EPSR
bb1 PSR_SUPERVISOR_MODE_BIT, r2, _ASM_LABEL(ast_done)
-
+1:
ldcr r2, CPU
ld r3, r2, CI_CURPROC
ld r2, r3, P_ASTPENDING
bcnd eq0, r2, _ASM_LABEL(ast_done)
- or r2, r0, FPTR
- XCALL(_C_LABEL(ast), _ASM_LABEL(ast_done))
+ bsr.n _C_LABEL(ast)
+ or r2, r0, FPTR
+
+ br 1b
/*
* void proc_trampoline(void (*func)(void *), void *proc)
diff --git a/sys/arch/m88k/m88k/genassym.cf b/sys/arch/m88k/m88k/genassym.cf
index a06a498bffb..459b52777f1 100644
--- a/sys/arch/m88k/m88k/genassym.cf
+++ b/sys/arch/m88k/m88k/genassym.cf
@@ -1,4 +1,4 @@
-# $OpenBSD: genassym.cf,v 1.19 2009/02/21 18:35:22 miod Exp $
+# $OpenBSD: genassym.cf,v 1.20 2009/03/15 20:39:53 miod Exp $
#
# Copyright (c) 1982, 1990 The Regents of the University of California.
# All rights reserved.
@@ -28,7 +28,7 @@
# SUCH DAMAGE.
#
# @(#)genassym.c 7.8 (Berkeley) 5/7/91
-# $Id: genassym.cf,v 1.19 2009/02/21 18:35:22 miod Exp $
+# $Id: genassym.cf,v 1.20 2009/03/15 20:39:53 miod Exp $
#
include <sys/param.h>
@@ -68,7 +68,7 @@ member ci_pfsr_i1
member ci_pfsr_d0
member ci_pfsr_d1
member ci_want_resched
-member ci_softintr
+member ci_softipi_cb
# pcb fields
struct pcb
diff --git a/sys/arch/m88k/m88k/m88k_machdep.c b/sys/arch/m88k/m88k/m88k_machdep.c
index c824731bce7..0f51383c4ff 100644
--- a/sys/arch/m88k/m88k/m88k_machdep.c
+++ b/sys/arch/m88k/m88k/m88k_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m88k_machdep.c,v 1.48 2009/03/04 19:37:15 miod Exp $ */
+/* $OpenBSD: m88k_machdep.c,v 1.49 2009/03/15 20:39:53 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -53,6 +53,7 @@
#include <sys/exec.h>
#include <sys/errno.h>
#include <sys/lock.h>
+#include <sys/malloc.h>
#ifdef MULTIPROCESSOR
#include <sys/mplock.h>
#endif
@@ -69,8 +70,6 @@
#include <uvm/uvm_extern.h>
-#include <net/netisr.h>
-
#ifdef DDB
#include <machine/db_machdep.h>
#include <ddb/db_extern.h>
@@ -81,7 +80,6 @@ typedef struct {
u_int32_t word_one, word_two;
} m88k_exception_vector_area;
-void dosoftint(void);
void dumpconf(void);
void dumpsys(void);
void regdump(struct trapframe *f);
@@ -348,45 +346,27 @@ need_resched(struct cpu_info *ci)
}
/*
- * Soft interrupt interface
+ * Generic soft interrupt interface
*/
-int netisr;
+void dosoftint(int);
+int softpending;
void
-dosoftint()
+dosoftint(int sir)
{
- struct cpu_info *ci = curcpu();
- int sir, n;
-
- if ((sir = atomic_clear_int(&ci->ci_softintr)) == 0)
- return;
+ int q, mask;
#ifdef MULTIPROCESSOR
__mp_lock(&kernel_lock);
#endif
- uvmexp.softs++;
-
- if (ISSET(sir, SIR_NET)) {
- while ((n = atomic_clear_int(&netisr)) != 0) {
-#define DONETISR(bit, fn) \
- do { \
- if (n & (1 << bit)) \
- fn(); \
- } while (0)
-#include <net/netisr_dispatch.h>
-#undef DONETISR
- }
- }
-
- if (ISSET(sir, SIR_CLOCK))
- softclock();
+ for (q = SI_NQUEUES - 1, mask = 1 << (SI_NQUEUES - 1); mask != 0;
+ q--, mask >>= 1)
+ if (mask & sir)
+ softintr_dispatch(q);
#ifdef MULTIPROCESSOR
- if (ISSET(sir, SIR_IPI))
- softipi();
-
__mp_unlock(&kernel_lock);
#endif
}
@@ -394,16 +374,16 @@ dosoftint()
int
spl0()
{
- struct cpu_info *ci = curcpu();
+ int sir;
int s;
/*
* Try to avoid potentially expensive setipl calls if nothing
* seems to be pending.
*/
- if (ci->ci_softintr != 0) {
- s = setipl(IPL_SOFTCLOCK);
- dosoftint();
+ if ((sir = atomic_clear_int(&softpending)) != 0) {
+ s = setipl(IPL_SOFTINT);
+ dosoftint(sir);
setipl(IPL_NONE);
} else
s = setipl(IPL_NONE);
diff --git a/sys/arch/m88k/m88k/softintr.c b/sys/arch/m88k/m88k/softintr.c
new file mode 100644
index 00000000000..1b96a35ab07
--- /dev/null
+++ b/sys/arch/m88k/m88k/softintr.c
@@ -0,0 +1,197 @@
+/* $OpenBSD: softintr.c,v 1.1 2009/03/15 20:39:53 miod Exp $ */
+/* $NetBSD: softintr.c,v 1.2 2003/07/15 00:24:39 lukem Exp $ */
+
+/*
+ * Copyright (c) 2001 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Jason R. Thorpe for Wasabi Systems, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed for the NetBSD Project by
+ * Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ * or promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <sys/malloc.h>
+
+/* XXX Network interrupts should be converted to new softintrs. */
+#include <net/netisr.h>
+
+#include <uvm/uvm_extern.h>
+
+#include <machine/atomic.h>
+#include <machine/intr.h>
+
+struct soft_intrq soft_intrq[SI_NQUEUES];
+
+struct soft_intrhand *softnet_intrhand;
+
+void netintr(void);
+
+/*
+ * Initialize the software interrupt system.
+ */
+void
+softintr_init(void)
+{
+ struct soft_intrq *siq;
+ int i;
+
+ for (i = 0; i < SI_NQUEUES; i++) {
+ siq = &soft_intrq[i];
+ TAILQ_INIT(&siq->siq_list);
+ siq->siq_si = i;
+ mtx_init(&siq->siq_mtx, IPL_HIGH);
+ }
+
+ /* XXX Establish legacy software interrupt handlers. */
+ softnet_intrhand = softintr_establish(IPL_SOFTNET,
+ (void (*)(void *))netintr, NULL);
+}
+
+/*
+ * Process pending software interrupts on the specified queue.
+ *
+ * NOTE: We must already be at the correct interrupt priority level.
+ */
+void
+softintr_dispatch(int si)
+{
+ struct soft_intrq *siq = &soft_intrq[si];
+ struct soft_intrhand *sih;
+
+ for (;;) {
+ mtx_enter(&siq->siq_mtx);
+ sih = TAILQ_FIRST(&siq->siq_list);
+ if (sih == NULL) {
+ mtx_leave(&siq->siq_mtx);
+ break;
+ }
+
+ TAILQ_REMOVE(&siq->siq_list, sih, sih_list);
+ sih->sih_pending = 0;
+
+ uvmexp.softs++;
+
+ mtx_leave(&siq->siq_mtx);
+
+ (*sih->sih_func)(sih->sih_arg);
+ }
+}
+
+/*
+ * Register a software interrupt handler.
+ */
+void *
+softintr_establish(int ipl, void (*func)(void *), void *arg)
+{
+ struct soft_intrhand *sih;
+ int si;
+
+ switch (ipl) {
+ case IPL_SOFT:
+ si = SI_SOFT;
+ break;
+ case IPL_SOFTCLOCK:
+ si = SI_SOFTCLOCK;
+ break;
+ case IPL_SOFTNET:
+ si = SI_SOFTNET;
+ break;
+ case IPL_SOFTTTY:
+ si = SI_SOFTTTY;
+ break;
+ default:
+ printf("softintr_establish: unknown soft IPL %d\n", ipl);
+ return NULL;
+ }
+
+ sih = malloc(sizeof(*sih), M_DEVBUF, M_NOWAIT);
+ if (__predict_true(sih != NULL)) {
+ sih->sih_func = func;
+ sih->sih_arg = arg;
+ sih->sih_siq = &soft_intrq[si];
+ sih->sih_pending = 0;
+ }
+ return (sih);
+}
+
+/*
+ * Unregister a software interrupt handler.
+ */
+void
+softintr_disestablish(void *arg)
+{
+ struct soft_intrhand *sih = arg;
+ struct soft_intrq *siq = sih->sih_siq;
+
+ mtx_enter(&siq->siq_mtx);
+ if (sih->sih_pending) {
+ TAILQ_REMOVE(&siq->siq_list, sih, sih_list);
+ sih->sih_pending = 0;
+ }
+ mtx_leave(&siq->siq_mtx);
+
+ free(sih, M_DEVBUF);
+}
+
+/*
+ * Schedule a software interrupt.
+ */
+void
+softintr_schedule(void *arg)
+{
+ struct soft_intrhand *sih = (struct soft_intrhand *)arg;
+ struct soft_intrq *siq = sih->sih_siq;
+
+ mtx_enter(&siq->siq_mtx);
+ if (sih->sih_pending == 0) {
+ TAILQ_INSERT_TAIL(&siq->siq_list, sih, sih_list);
+ sih->sih_pending = 1;
+ atomic_setbits_int(&softpending, 1 << siq->siq_si);
+ }
+ mtx_leave(&siq->siq_mtx);
+}
+
+int netisr;
+
+void
+netintr(void)
+{
+ int n;
+
+ while ((n = atomic_clear_int(&netisr)) != 0) {
+#define DONETISR(bit, fn) \
+ do { \
+ if (n & (1 << (bit))) \
+ fn(); \
+ } while (0)
+#include <net/netisr_dispatch.h>
+#undef DONETISR
+ }
+}
diff --git a/sys/arch/mvme88k/include/cpu.h b/sys/arch/mvme88k/include/cpu.h
index c7154245a40..b824f8c6b3a 100644
--- a/sys/arch/mvme88k/include/cpu.h
+++ b/sys/arch/mvme88k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.43 2009/02/27 05:19:34 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.44 2009/03/15 20:39:53 miod Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* Copyright (c) 1992, 1993
@@ -40,11 +40,12 @@
#ifndef _MVME88K_CPU_H_
#define _MVME88K_CPU_H_
-#include <sys/evcount.h>
#include <m88k/cpu.h>
#ifdef _KERNEL
+#include <sys/evcount.h>
+
/* board dependent pointers */
extern void (*md_interrupt_func_ptr)(struct trapframe *);
#define md_interrupt_func (*md_interrupt_func_ptr)
@@ -58,7 +59,6 @@ extern u_int (*md_raiseipl)(u_int);
extern void (*md_init_clocks)(void);
extern void (*md_send_ipi)(int, cpuid_t);
extern void (*md_delay)(int);
-extern void (*md_soft_ipi)(void);
extern void (*md_smp_setup)(struct cpu_info *);
struct intrhand {
diff --git a/sys/arch/mvme88k/include/intr.h b/sys/arch/mvme88k/include/intr.h
index 1df681e0826..93b8f804d4e 100644
--- a/sys/arch/mvme88k/include/intr.h
+++ b/sys/arch/mvme88k/include/intr.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: intr.h,v 1.19 2007/12/27 23:17:55 miod Exp $ */
+/* $OpenBSD: intr.h,v 1.20 2009/03/15 20:39:53 miod Exp $ */
/*
* Copyright (C) 2000 Steve Murphree, Jr.
* All rights reserved.
@@ -37,8 +37,7 @@
*/
#define IPL_NONE 0
-#define IPL_SOFTCLOCK 1
-#define IPL_SOFTNET 1
+#define IPL_SOFTINT 1
#define IPL_BIO 2
#define IPL_NET 3
#define IPL_TTY 3
diff --git a/sys/arch/mvme88k/mvme88k/autoconf.c b/sys/arch/mvme88k/mvme88k/autoconf.c
index 789731a164b..9d52536ec49 100644
--- a/sys/arch/mvme88k/mvme88k/autoconf.c
+++ b/sys/arch/mvme88k/mvme88k/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.43 2009/03/05 21:55:15 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.44 2009/03/15 20:39:53 miod Exp $ */
/*
* Copyright (c) 1998 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -72,6 +72,8 @@ struct device *bootdv; /* set by device drivers (if found) */
void
cpu_configure()
{
+ softintr_init();
+
if (config_rootfound("mainbus", "mainbus") == 0)
panic("no mainbus found");
diff --git a/sys/arch/mvme88k/mvme88k/m187_machdep.c b/sys/arch/mvme88k/mvme88k/m187_machdep.c
index 8e5e953b00d..7f1643c3968 100644
--- a/sys/arch/mvme88k/mvme88k/m187_machdep.c
+++ b/sys/arch/mvme88k/mvme88k/m187_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m187_machdep.c,v 1.19 2009/02/16 22:55:03 miod Exp $ */
+/* $OpenBSD: m187_machdep.c,v 1.20 2009/03/15 20:39:53 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -257,4 +257,7 @@ m187_bootstrap()
md_raiseipl = m187_raiseipl;
md_init_clocks = m1x7_init_clocks;
md_delay = m1x7_delay;
+#ifdef MULTIPROCESSOR
+ md_smp_setup = m88100_smp_setup;
+#endif
}
diff --git a/sys/arch/mvme88k/mvme88k/m188_machdep.c b/sys/arch/mvme88k/mvme88k/m188_machdep.c
index 097580a2086..64b1b697231 100644
--- a/sys/arch/mvme88k/mvme88k/m188_machdep.c
+++ b/sys/arch/mvme88k/mvme88k/m188_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m188_machdep.c,v 1.52 2009/03/09 19:51:18 miod Exp $ */
+/* $OpenBSD: m188_machdep.c,v 1.53 2009/03/15 20:39:53 miod Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
*
@@ -163,7 +163,6 @@ vaddr_t m188_memsize(void);
u_int m188_raiseipl(u_int);
void m188_send_ipi(int, cpuid_t);
u_int m188_setipl(u_int);
-void m188_soft_ipi(void);
void m188_startup(void);
/*
@@ -238,7 +237,6 @@ m188_bootstrap()
md_init_clocks = m188_init_clocks;
#ifdef MULTIPROCESSOR
md_send_ipi = m188_send_ipi;
- md_soft_ipi = m188_soft_ipi;
#endif
md_delay = m188_delay;
#ifdef MULTIPROCESSOR
@@ -451,12 +449,6 @@ m188_clock_ipi_handler(struct trapframe *eframe)
statclock((struct clockframe *)eframe);
}
-void
-m188_soft_ipi()
-{
- /* this function is not used on MVME188 */
-}
-
#endif
/*
diff --git a/sys/arch/mvme88k/mvme88k/m197_machdep.c b/sys/arch/mvme88k/mvme88k/m197_machdep.c
index 5ded305193f..17bf913991f 100644
--- a/sys/arch/mvme88k/mvme88k/m197_machdep.c
+++ b/sys/arch/mvme88k/mvme88k/m197_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m197_machdep.c,v 1.39 2009/03/04 19:39:41 miod Exp $ */
+/* $OpenBSD: m197_machdep.c,v 1.40 2009/03/15 20:39:53 miod Exp $ */
/*
* Copyright (c) 2009 Miodrag Vallat.
@@ -424,7 +424,6 @@ m197_bootstrap()
md_init_clocks = m1x7_init_clocks;
#ifdef MULTIPROCESSOR
md_send_ipi = m197_send_ipi;
- md_soft_ipi = m197_soft_ipi;
md_delay = m197_delay;
md_smp_setup = m197_smp_setup;
#else
@@ -648,7 +647,9 @@ m197_ipi_handler(struct trapframe *eframe)
ci->ci_s_sxip = eframe->tf_sxip;
ci->ci_s_epsr = eframe->tf_epsr;
}
- setsoftipi(ci);
+
+ /* inflict ourselves a soft ipi */
+ ci->ci_softipi_cb = m197_soft_ipi;
}
if (ipi & CI_IPI_DDB) {
diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c
index 419b5ad545c..66e4d0ae524 100644
--- a/sys/arch/mvme88k/mvme88k/machdep.c
+++ b/sys/arch/mvme88k/mvme88k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.227 2009/03/05 21:55:15 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.228 2009/03/15 20:39:53 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -135,7 +135,6 @@ u_int (*md_setipl)(u_int);
u_int (*md_raiseipl)(u_int);
#ifdef MULTIPROCESSOR
void (*md_send_ipi)(int, cpuid_t);
-void (*md_soft_ipi)(void);
#endif
void (*md_delay)(int) = dumb_delay;
#ifdef MULTIPROCESSOR
@@ -1206,12 +1205,6 @@ m88k_broadcast_ipi(int ipi)
}
}
-void
-softipi()
-{
- (*md_soft_ipi)();
-}
-
#endif
void