Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/alpha Move IPI processing into a separate function.



details:   https://anonhg.NetBSD.org/src/rev/0d566caf4d2c
branches:  trunk
changeset: 499458:0d566caf4d2c
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Nov 20 19:24:36 2000 +0000

description:
Move IPI processing into a separate function.

diffstat:

 sys/arch/alpha/alpha/interrupt.c |  27 +++---------------------
 sys/arch/alpha/alpha/ipifuncs.c  |  43 ++++++++++++++++++++++++++++++++++++++-
 sys/arch/alpha/include/intr.h    |   6 +---
 3 files changed, 47 insertions(+), 29 deletions(-)

diffs (150 lines):

diff -r 5ce70338d909 -r 0d566caf4d2c sys/arch/alpha/alpha/interrupt.c
--- a/sys/arch/alpha/alpha/interrupt.c  Mon Nov 20 17:48:05 2000 +0000
+++ b/sys/arch/alpha/alpha/interrupt.c  Mon Nov 20 19:24:36 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: interrupt.c,v 1.52 2000/11/18 19:25:36 thorpej Exp $ */
+/* $NetBSD: interrupt.c,v 1.53 2000/11/20 19:24:36 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.52 2000/11/18 19:25:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.53 2000/11/20 19:24:36 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -114,27 +114,9 @@
        switch (a0) {
        case ALPHA_INTR_XPROC:  /* interprocessor interrupt */
 #if defined(MULTIPROCESSOR)
-           {
-               u_long pending_ipis, bit;
-
-#ifdef DIAGNOSTIC
-               if (sc == NULL) {
-                       /* XXX panic? */
-                       printf("WARNING: no softc for ID %lu\n", ci->ci_cpuid);
-                       return;
-               }
-#endif
+               atomic_add_ulong(&ci->ci_intrdepth, 1);
 
-               atomic_add_ulong(&ci->ci_intrdepth, 1);
-               sc->sc_evcnt_ipi.ev_count++;
-
-               pending_ipis = atomic_loadlatch_ulong(&ci->ci_ipis, 0);
-               for (bit = 0; bit < ALPHA_NIPIS; bit++) {
-                       if (pending_ipis & (1UL << bit)) {
-                               sc->sc_evcnt_which_ipi[bit].ev_count++;
-                               (*ipifuncs[bit])();
-                       }
-               }
+               alpha_ipi_process(ci);
 
                /*
                 * Handle inter-console messages if we're the primary
@@ -145,7 +127,6 @@
                        cpu_iccb_receive();
 
                atomic_sub_ulong(&ci->ci_intrdepth, 1);
-           }
 #else
                printf("WARNING: received interprocessor interrupt!\n");
 #endif /* MULTIPROCESSOR */
diff -r 5ce70338d909 -r 0d566caf4d2c sys/arch/alpha/alpha/ipifuncs.c
--- a/sys/arch/alpha/alpha/ipifuncs.c   Mon Nov 20 17:48:05 2000 +0000
+++ b/sys/arch/alpha/alpha/ipifuncs.c   Mon Nov 20 19:24:36 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ipifuncs.c,v 1.21 2000/11/19 20:05:25 sommerfeld Exp $ */
+/* $NetBSD: ipifuncs.c,v 1.22 2000/11/20 19:24:36 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -39,7 +39,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.21 2000/11/19 20:05:25 sommerfeld Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipifuncs.c,v 1.22 2000/11/20 19:24:36 thorpej Exp $");
 
 /*
  * Interprocessor interrupt handlers.
@@ -59,6 +59,8 @@
 #include <machine/intr.h>
 #include <machine/rpb.h>
 
+typedef void (*ipifunc_t)(void);
+
 void   alpha_ipi_halt(void);
 void   alpha_ipi_tbia(void);
 void   alpha_ipi_tbiap(void);
@@ -118,6 +120,43 @@
 }
 
 /*
+ * Process IPIs for a CPU.
+ */
+void
+alpha_ipi_process(struct cpu_info *ci)
+{
+       struct cpu_softc *sc = ci->ci_softc;
+       u_long pending_ipis, bit;
+
+#ifdef DIAGNOSTIC
+       if (sc == NULL) {
+               /* XXX panic? */
+               printf("WARNING: no softc for ID %lu\n", ci->ci_cpuid);
+               return;
+       }
+#endif
+
+       pending_ipis = atomic_loadlatch_ulong(&ci->ci_ipis, 0);
+
+       /*
+        * For various reasons, it is possible to have spurious calls
+        * to this routine, so just bail out now if there are none
+        * pending.
+        */
+       if (pending_ipis == 0)
+               return;
+
+       sc->sc_evcnt_ipi.ev_count++;
+
+       for (bit = 0; bit < ALPHA_NIPIS; bit++) {
+               if (pending_ipis & (1UL << bit)) {
+                       sc->sc_evcnt_which_ipi[bit].ev_count++;
+                       (*ipifuncs[bit])();
+               }
+       }
+}
+
+/*
  * Send an interprocessor interrupt.
  */
 void
diff -r 5ce70338d909 -r 0d566caf4d2c sys/arch/alpha/include/intr.h
--- a/sys/arch/alpha/include/intr.h     Mon Nov 20 17:48:05 2000 +0000
+++ b/sys/arch/alpha/include/intr.h     Mon Nov 20 19:24:36 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intr.h,v 1.35 2000/11/18 19:25:37 thorpej Exp $ */
+/* $NetBSD: intr.h,v 1.36 2000/11/20 19:24:36 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -165,12 +165,10 @@
 
 #define        ALPHA_NIPIS             9       /* must not exceed 64 */
 
-typedef void (*ipifunc_t)(void);
-extern ipifunc_t ipifuncs[ALPHA_NIPIS];
-
 struct cpu_info;
 
 void   alpha_ipi_init(struct cpu_info *);
+void   alpha_ipi_process(struct cpu_info *);
 void   alpha_send_ipi(unsigned long, unsigned long);
 void   alpha_broadcast_ipi(unsigned long);
 void   alpha_multicast_ipi(unsigned long, unsigned long);



Home | Main Index | Thread Index | Old Index