Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc Rename the current mp_{pause, resume}_cpus() =...



details:   https://anonhg.NetBSD.org/src/rev/ca3b20846ef1
branches:  trunk
changeset: 541683:ca3b20846ef1
user:      pk <pk%NetBSD.org@localhost>
date:      Thu Jan 16 16:57:43 2003 +0000

description:
Rename the current mp_{pause,resume}_cpus() => mp_{pause,resume}_cpus_ddb().
Implement mp_pause_cpus/mp_resume_cpus on top of the PROM services.

diffstat:

 sys/arch/sparc/include/cpu.h        |    6 +-
 sys/arch/sparc/sparc/cpu.c          |  104 ++++++++++++++++++++++++++---------
 sys/arch/sparc/sparc/db_interface.c |   10 ++-
 3 files changed, 88 insertions(+), 32 deletions(-)

diffs (199 lines):

diff -r b15595b5b96e -r ca3b20846ef1 sys/arch/sparc/include/cpu.h
--- a/sys/arch/sparc/include/cpu.h      Thu Jan 16 16:27:48 2003 +0000
+++ b/sys/arch/sparc/include/cpu.h      Thu Jan 16 16:57:43 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.60 2003/01/14 22:54:53 pk Exp $ */
+/*     $NetBSD: cpu.h,v 1.61 2003/01/16 16:57:44 pk Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -238,6 +238,10 @@
 void mp_pause_cpus(void);
 void mp_resume_cpus(void);
 void mp_halt_cpus(void);
+#ifdef DDB
+void mp_pause_cpus_ddb(void);
+void mp_resume_cpus_ddb(void);
+#endif
 /* msiiep.c */
 void msiiep_swap_endian(int);
 
diff -r b15595b5b96e -r ca3b20846ef1 sys/arch/sparc/sparc/cpu.c
--- a/sys/arch/sparc/sparc/cpu.c        Thu Jan 16 16:27:48 2003 +0000
+++ b/sys/arch/sparc/sparc/cpu.c        Thu Jan 16 16:57:43 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.163 2003/01/16 16:10:44 pk Exp $ */
+/*     $NetBSD: cpu.c,v 1.164 2003/01/16 16:57:43 pk Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -754,41 +754,49 @@
        splx(s);
 }
 
+/*
+ * Tell all CPUs other than the current one to enter the PROM idle loop.
+ */
 void
 mp_pause_cpus()
 {
        int n;
-
-       if (cpus == NULL)
-               return;
-
-       for (n = 0; n < ncpu; n++) {
-               struct cpu_info *cpi = cpus[n];
-
-               if (CPU_NOTREADY(cpi))
-                       continue;
-
-               cpi->msg_lev15.tag = XPMSG15_PAUSECPU;
-               raise_ipi(cpi,15);      /* high priority intr */
-       }
-}
-
-void
-mp_resume_cpus()
-{
-       int n;
-
-       if (cpus == NULL)
-               return;
-
        for (n = 0; n < ncpu; n++) {
                struct cpu_info *cpi = cpus[n];
 
                if (cpi == NULL || cpuinfo.mid == cpi->mid)
                        continue;
 
-               /* tell it to continue */
-               cpi->flags &= ~CPUFLG_PAUSED;
+               /*
+                * This PROM utility will put the OPENPROM_MBX_ABORT
+                * message (0xfc) in the target CPU's mailbox and then
+                * send it a level 15 soft interrupt.
+                */
+               if (prom_cpuidle(cpi->node) != 0)
+                       printf("cpu%d could not be paused\n", cpi->ci_cpuid);
+       }
+}
+
+int cpunum(void); int cpunum(void) {return cpuinfo.ci_cpuid;}
+/*
+ * Resume all idling CPUs.
+ */
+void
+mp_resume_cpus()
+{
+       int n;
+       for (n = 0; n < ncpu; n++) {
+               struct cpu_info *cpi = cpus[n];
+
+               if (cpi == NULL || cpuinfo.mid == cpi->mid)
+                       continue;
+
+               /*
+                * This PROM utility makes the target CPU return
+                * from its prom_cpuidle(0) call (see intr.c:nmi_soft()).
+                */
+               if (prom_cpuresume(cpi->node) != 0)
+                       printf("cpu%d could not be resumed\n", cpi->ci_cpuid);
        }
 }
 
@@ -808,14 +816,54 @@
 
                /*
                 * This PROM utility will put the OPENPROM_MBX_STOP
-                * message (0xfb) in the CPU's mailbox and then send
-                * it a level 15 soft interrupt.
+                * message (0xfb) in the target CPU's mailbox and then
+                * send it a level 15 soft interrupt.
                 */
                r = prom_cpustop(cpi->node);
                printf("cpu%d %shalted\n", cpi->ci_cpuid,
                        r == 0 ? "" : "(boot CPU?) can not be ");
        }
 }
+
+#if defined(DDB)
+void
+mp_pause_cpus_ddb()
+{
+       int n;
+
+       if (cpus == NULL)
+               return;
+
+       for (n = 0; n < ncpu; n++) {
+               struct cpu_info *cpi = cpus[n];
+
+               if (CPU_NOTREADY(cpi))
+                       continue;
+
+               cpi->msg_lev15.tag = XPMSG15_PAUSECPU;
+               raise_ipi(cpi,15);      /* high priority intr */
+       }
+}
+
+void
+mp_resume_cpus_ddb()
+{
+       int n;
+
+       if (cpus == NULL)
+               return;
+
+       for (n = 0; n < ncpu; n++) {
+               struct cpu_info *cpi = cpus[n];
+
+               if (cpi == NULL || cpuinfo.mid == cpi->mid)
+                       continue;
+
+               /* tell it to continue */
+               cpi->flags &= ~CPUFLG_PAUSED;
+       }
+}
+#endif /* DDB */
 #endif /* MULTIPROCESSOR */
 
 /*
diff -r b15595b5b96e -r ca3b20846ef1 sys/arch/sparc/sparc/db_interface.c
--- a/sys/arch/sparc/sparc/db_interface.c       Thu Jan 16 16:27:48 2003 +0000
+++ b/sys/arch/sparc/sparc/db_interface.c       Thu Jan 16 16:57:43 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_interface.c,v 1.52 2003/01/13 19:44:53 pk Exp $ */
+/*     $NetBSD: db_interface.c,v 1.53 2003/01/16 16:57:43 pk Exp $ */
 
 /*
  * Mach Operating System
@@ -231,6 +231,10 @@
 static void db_resume_others(void);
 void ddb_suspend(struct trapframe *tf);
 
+/* from cpu.c */
+void mp_pause_cpus_ddb(void);
+void mp_resume_cpus_ddb(void);
+
 __cpu_simple_lock_t db_lock;
 int ddb_cpu = NOCPU;
 
@@ -250,7 +254,7 @@
        __cpu_simple_unlock(&db_lock);
 
        if (win)
-               mp_pause_cpus();
+               mp_pause_cpus_ddb();
 
        return win;
 }
@@ -259,7 +263,7 @@
 db_resume_others(void)
 {
 
-       mp_resume_cpus();
+       mp_resume_cpus_ddb();
 
        __cpu_simple_lock(&db_lock);
        ddb_cpu = NOCPU;



Home | Main Index | Thread Index | Old Index