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.
This commit is contained in:
parent
58b50d0643
commit
72c28f7bb7
|
@ -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 @@ int emulinstr(int, struct trapframe *);
|
|||
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);
|
||||
|
||||
|
|
|
@ -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 @@ xcall(func, arg0, arg1, arg2, arg3, cpuset)
|
|||
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 @@ mp_halt_cpus()
|
|||
|
||||
/*
|
||||
* 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 */
|
||||
|
||||
/*
|
||||
|
|
|
@ -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 int db_suspend_others(void);
|
|||
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 @@ db_suspend_others(void)
|
|||
__cpu_simple_unlock(&db_lock);
|
||||
|
||||
if (win)
|
||||
mp_pause_cpus();
|
||||
mp_pause_cpus_ddb();
|
||||
|
||||
return win;
|
||||
}
|
||||
|
@ -259,7 +263,7 @@ static void
|
|||
db_resume_others(void)
|
||||
{
|
||||
|
||||
mp_resume_cpus();
|
||||
mp_resume_cpus_ddb();
|
||||
|
||||
__cpu_simple_lock(&db_lock);
|
||||
ddb_cpu = NOCPU;
|
||||
|
|
Loading…
Reference in New Issue