Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sgimips Use common mips generic software interrupt ...
details: https://anonhg.NetBSD.org/src/rev/c4a207efe5fd
branches: trunk
changeset: 551988:c4a207efe5fd
user: simonb <simonb%NetBSD.org@localhost>
date: Mon Sep 15 06:39:20 2003 +0000
description:
Use common mips generic software interrupt routines.
Changes from Izumi Tsutsui, tested by Havard Eidnes.
diffstat:
sys/arch/sgimips/conf/files.sgimips | 5 +-
sys/arch/sgimips/include/intr.h | 42 +-------
sys/arch/sgimips/sgimips/machdep.c | 34 +++---
sys/arch/sgimips/sgimips/softintr.c | 165 ------------------------------------
4 files changed, 29 insertions(+), 217 deletions(-)
diffs (truncated from 322 to 300 lines):
diff -r a1df97bdff49 -r c4a207efe5fd sys/arch/sgimips/conf/files.sgimips
--- a/sys/arch/sgimips/conf/files.sgimips Mon Sep 15 05:11:31 2003 +0000
+++ b/sys/arch/sgimips/conf/files.sgimips Mon Sep 15 06:39:20 2003 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.sgimips,v 1.23 2003/07/27 01:19:31 thorpej Exp $
+# $NetBSD: files.sgimips,v 1.24 2003/09/15 06:39:20 simonb Exp $
maxpartitions 16
@@ -71,7 +71,8 @@
file arch/sgimips/sgimips/console.c
file arch/sgimips/sgimips/disksubr.c
file arch/sgimips/sgimips/machdep.c
-file arch/sgimips/sgimips/softintr.c
+
+file arch/mips/mips/softintr.c
file dev/md_root.c memory_disk_hooks
diff -r a1df97bdff49 -r c4a207efe5fd sys/arch/sgimips/include/intr.h
--- a/sys/arch/sgimips/include/intr.h Mon Sep 15 05:11:31 2003 +0000
+++ b/sys/arch/sgimips/include/intr.h Mon Sep 15 06:39:20 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.13 2002/05/03 01:51:38 rafal Exp $ */
+/* $NetBSD: intr.h,v 1.14 2003/09/15 06:39:22 simonb Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang
@@ -54,12 +54,14 @@
#define IST_LEVEL 3 /* level-triggered */
/* Soft interrupt numbers */
-#define IPL_SOFTSERIAL 0 /* serial software interrupts */
-#define IPL_SOFTNET 1 /* network software interrupts */
-#define IPL_SOFTCLOCK 2 /* clock software interrupts */
-#define IPL_NSOFT 3
+#define IPL_SOFT 0 /* generic software interrupts */
+#define IPL_SOFTSERIAL 1 /* serial software interrupts */
+#define IPL_SOFTNET 2 /* network software interrupts */
+#define IPL_SOFTCLOCK 3 /* clock software interrupts */
+#define _IPL_NSOFT 4
#define IPL_SOFTNAMES { \
+ "misc", \
"serial", \
"net", \
"clock", \
@@ -73,30 +75,6 @@
#include <sys/device.h>
#include <mips/cpuregs.h>
-/*
- * software simulated interrupt
- */
-#define setsoft(x) do { \
- extern u_int ssir; \
- int s; \
- \
- s = splhigh(); \
- ssir |= 1 << (x); \
- _setsoftintr(MIPS_SOFT_INT_MASK_1); \
- splx(s); \
-} while (0)
-
-#define softintr_schedule(arg) \
-do { \
- struct sgimips_intrhand *__ih = (arg); \
- __ih->ih_pending = 1; \
- setsoft(__ih->ih_intrhead->intr_ipl); \
-} while (0)
-
-extern struct sgimips_intrhand *softnet_intrhand;
-
-#define setsoftnet() softintr_schedule(softnet_intrhand)
-
#define NINTR 32
struct sgimips_intrhand {
@@ -152,10 +130,8 @@
#define spllowersoftclock() _spllower(MIPS_SOFT_INT_MASK_1)
extern void * cpu_intr_establish(int, int, int (*)(void *), void *);
-void * softintr_establish(int, void (*)(void *), void *);
-void softintr_disestablish(void *);
-void softintr_init(void);
-void softintr_dispatch(void);
+
+#include <mips/softintr.h>
#endif /* _LOCORE */
#endif /* !_KERNEL */
diff -r a1df97bdff49 -r c4a207efe5fd sys/arch/sgimips/sgimips/machdep.c
--- a/sys/arch/sgimips/sgimips/machdep.c Mon Sep 15 05:11:31 2003 +0000
+++ b/sys/arch/sgimips/sgimips/machdep.c Mon Sep 15 06:39:20 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.55 2003/07/15 03:35:55 lukem Exp $ */
+/* $NetBSD: machdep.c,v 1.56 2003/09/15 06:39:22 simonb Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.55 2003/07/15 03:35:55 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.56 2003/09/15 06:39:22 simonb Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -105,6 +105,13 @@
struct sgimips_intrhand intrtab[NINTR];
+const uint32_t mips_ipl_si_to_sr[_IPL_NSOFT] = {
+ MIPS_SOFT_INT_MASK_0, /* IPL_SOFT */
+ MIPS_SOFT_INT_MASK_0, /* IPL_SOFTCLOCK */
+ MIPS_SOFT_INT_MASK_1, /* IPL_SOFTNET */
+ MIPS_SOFT_INT_MASK_1, /* IPL_SOFTSERIAL */
+};
+
/* Our exported CPU info; we can have only one. */
struct cpu_info cpu_info_store;
@@ -871,21 +878,14 @@
if (ipending & MIPS_HARD_INT_MASK)
(*platform.iointr)(status, cause, pc, ipending);
- /*
- * Service pending soft interrupts -- make sure to re-enable
- * only those hardware interrupts that are not masked and
- * that weren't pending on the current invocation of the
- * interrupt handler, else we risk infinite stack growth
- * due to nested interrupts.
- */
- /* software simulated interrupt */
- if ((ipending & MIPS_SOFT_INT_MASK_1) ||
- (ssir && (status & MIPS_SOFT_INT_MASK_1))) {
- _splset(MIPS_SR_INT_IE |
- (status & ~ipending & MIPS_HARD_INT_MASK));
- _clrsoftintr(MIPS_SOFT_INT_MASK_1);
- softintr_dispatch();
- }
+ /* software interrupt */
+ ipending &= (MIPS_SOFT_INT_MASK_1|MIPS_SOFT_INT_MASK_0);
+ if (ipending == 0)
+ return;
+
+ _clrsoftintr(ipending);
+
+ softintr_dispatch(ipending);
}
void unconfigured_system_type(int ipnum)
diff -r a1df97bdff49 -r c4a207efe5fd sys/arch/sgimips/sgimips/softintr.c
--- a/sys/arch/sgimips/sgimips/softintr.c Mon Sep 15 05:11:31 2003 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/* $NetBSD: softintr.c,v 1.4 2003/07/15 03:35:55 lukem Exp $ */
-
-/*
- * Copyright (c) 2001 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Wayne Knowles
- *
- * 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 by the NetBSD
- * Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``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 THE FOUNDATION OR CONTRIBUTORS
- * 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/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: softintr.c,v 1.4 2003/07/15 03:35:55 lukem Exp $");
-
-#include <sys/param.h>
-#include <sys/malloc.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <net/netisr.h> /* Legacy softnet support */
-
-#include <machine/intr.h>
-#include <machine/sysconf.h>
-
-struct sgimips_intr softintr_tab[IPL_NSOFT];
-
-/* XXX For legacy software interrupts. */
-struct sgimips_intrhand *softnet_intrhand;
-
-u_int32_t ssir;
-
-/*
- * softintr_init:
- *
- * Initialize the software interrupt system.
- */
-void
-softintr_init()
-{
- static const char *softintr_names[] = IPL_SOFTNAMES;
- struct sgimips_intr *sip;
- int i;
-
- for (i = 0; i < IPL_NSOFT; i++) {
- sip = &softintr_tab[i];
- sip->intr_ipl = i;
- LIST_INIT(&sip->intr_q);
- evcnt_attach_dynamic(&sip->ih_evcnt, EVCNT_TYPE_INTR,
- NULL, "soft", softintr_names[i]);
- }
-
- /* XXX Establish legacy software interrupt handlers. */
- softnet_intrhand = softintr_establish(IPL_SOFTNET,
- (void (*)(void *))netintr, NULL);
-
- KASSERT(softnet_intrhand != NULL);
-}
-
-/*
- * softintr_dispatch:
- *
- * Process pending software interrupts.
- *
- * Called at splsoft()
- */
-void
-softintr_dispatch()
-{
- struct sgimips_intr *sip;
- struct sgimips_intrhand *sih;
- u_int32_t n, i, s;
-
- s = splhigh();
- n = ssir; ssir = 0;
- splx(s);
- sip = softintr_tab;
- for (i = 0; i < IPL_NSOFT; sip++, i++) {
- if ((n & (1 << i)) == 0)
- continue;
- sip->ih_evcnt.ev_count++;
-
- LIST_FOREACH(sih, &sip->intr_q, ih_q) {
- if (sih->ih_pending) {
- uvmexp.softs++;
- sih->ih_pending = 0;
- (*sih->ih_fun)(sih->ih_arg);
- }
- }
- }
-}
-
-/*
- * softintr_establish: [interface]
- *
- * Register a software interrupt handler.
- */
-void *
-softintr_establish(int ipl, void (*func)(void *), void *arg)
-{
- struct sgimips_intr *sip;
- struct sgimips_intrhand *sih;
- int s;
-
- if (__predict_false(ipl >= IPL_NSOFT || ipl < 0))
- panic("softintr_establish");
-
- sip = &softintr_tab[ipl];
-
- sih = malloc(sizeof(*sih), M_DEVBUF, M_NOWAIT);
- if (__predict_true(sih != NULL)) {
- sih->ih_fun = (void *)func;
- sih->ih_arg = arg;
- sih->ih_intrhead = sip;
- sih->ih_pending = 0;
-
- s = splsoft();
Home |
Main Index |
Thread Index |
Old Index