MFi386: Restore cpu_reset proxy code to enable reset from ddb on an AP.
This commit is contained in:
parent
593fbddfba
commit
36bd442095
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=139345
@ -79,6 +79,11 @@ __FBSDID("$FreeBSD$");
|
||||
#include <amd64/isa/isa.h>
|
||||
|
||||
static void cpu_reset_real(void);
|
||||
#ifdef SMP
|
||||
static void cpu_reset_proxy(void);
|
||||
static u_int cpu_reset_proxyid;
|
||||
static volatile u_int cpu_reset_proxy_active;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Finish a fork operation, with process p2 nearly set up.
|
||||
@ -322,15 +327,26 @@ cpu_set_upcall_kse(struct thread *td, struct kse_upcall *ku)
|
||||
td->td_frame->tf_rdi = (register_t)ku->ku_mailbox;
|
||||
}
|
||||
|
||||
#ifdef SMP
|
||||
static void
|
||||
cpu_reset_proxy()
|
||||
{
|
||||
|
||||
cpu_reset_proxy_active = 1;
|
||||
while (cpu_reset_proxy_active == 1)
|
||||
; /* Wait for other cpu to see that we've started */
|
||||
stop_cpus((1<<cpu_reset_proxyid));
|
||||
printf("cpu_reset_proxy: Stopped CPU %d\n", cpu_reset_proxyid);
|
||||
DELAY(1000000);
|
||||
cpu_reset_real();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Force reset the processor by invalidating the entire address space!
|
||||
*/
|
||||
void
|
||||
cpu_reset()
|
||||
{
|
||||
#ifdef SMP
|
||||
u_int map;
|
||||
u_int cnt, map;
|
||||
|
||||
if (smp_active) {
|
||||
map = PCPU_GET(other_cpus) & ~stopped_cpus;
|
||||
@ -339,6 +355,25 @@ cpu_reset()
|
||||
stop_cpus(map);
|
||||
}
|
||||
|
||||
if (PCPU_GET(cpuid) != 0) {
|
||||
cpu_reset_proxyid = PCPU_GET(cpuid);
|
||||
cpustop_restartfunc = cpu_reset_proxy;
|
||||
cpu_reset_proxy_active = 0;
|
||||
printf("cpu_reset: Restarting BSP\n");
|
||||
started_cpus = (1<<0); /* Restart CPU #0 */
|
||||
|
||||
cnt = 0;
|
||||
while (cpu_reset_proxy_active == 0 && cnt < 10000000)
|
||||
cnt++; /* Wait for BSP to announce restart */
|
||||
if (cpu_reset_proxy_active == 0)
|
||||
printf("cpu_reset: Failed to restart BSP\n");
|
||||
enable_intr();
|
||||
cpu_reset_proxy_active = 2;
|
||||
|
||||
while (1);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
DELAY(1000000);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user