MFamd64: Remove the cpu_reset_proxy cruft now that we run boot() on

cpu 0.  Also, restructure cpu_reset to be cleaner (no functional change.)
This commit is contained in:
Nate Lawson 2004-11-30 06:18:46 +00:00
parent 20a9661305
commit 63a6daf68b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=138216

View File

@ -99,11 +99,6 @@ __FBSDID("$FreeBSD$");
#endif
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
static void sf_buf_init(void *arg);
SYSINIT(sock_sf, SI_SUB_MBUF, SI_ORDER_ANY, sf_buf_init, NULL)
@ -467,73 +462,24 @@ kvtop(void *addr)
return (pa);
}
/*
* Force reset the processor by invalidating the entire address space!
*/
#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
void
cpu_reset()
{
#ifdef SMP
if (smp_active == 0) {
cpu_reset_real();
/* NOTREACHED */
} else {
u_int map;
int cnt;
printf("cpu_reset called on cpu#%d\n", PCPU_GET(cpuid));
map = PCPU_GET(other_cpus) & ~ stopped_cpus;
u_int map;
int cnt;
if (smp_active) {
map = PCPU_GET(other_cpus) & ~stopped_cpus;
if (map != 0) {
printf("cpu_reset: Stopping other CPUs\n");
stop_cpus(map); /* Stop all other CPUs */
}
if (PCPU_GET(cpuid) == 0) {
DELAY(1000000);
cpu_reset_real();
/* NOTREACHED */
} else {
/* We are not BSP (CPU #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 */
stop_cpus(map);
}
DELAY(1000000);
}
#else
cpu_reset_real();
#endif
cpu_reset_real();
/* NOTREACHED */
}
static void
@ -562,20 +508,20 @@ cpu_reset_real()
}
outb(0xf0, 0x00); /* Reset. */
#else
#if !defined(BROKEN_KEYBOARD_RESET)
/*
* Attempt to do a CPU reset via the keyboard controller,
* do not turn of the GateA20, as any machine that fails
* do not turn off GateA20, as any machine that fails
* to do the reset here would then end up in no man's land.
*/
#if !defined(BROKEN_KEYBOARD_RESET)
outb(IO_KBD + 4, 0xFE);
DELAY(500000); /* wait 0.5 sec to see if that did it */
printf("Keyboard reset did not work, attempting CPU shutdown\n");
DELAY(1000000); /* wait 1 sec for printf to complete */
#endif
#endif /* PC98 */
/* force a shutdown by unmapping entire address space ! */
/* Force a shutdown by unmapping entire address space. */
bzero((caddr_t)PTD, NBPTD);
/* "good night, sweet prince .... <THUNK!>" */