__dead void boot(int howto) { if (cold) { if ((howto & RB_USERREQ) == 0) howto |= RB_HALT; goto haltsys; } /* * If RB_NOSYNC was not specified sync the discs. * Note: Unless cold is set to 1 here, syslogd will die during the * unmount. It looks like syslogd is getting woken up only to find * that it cannot page part of the binary in as the filesystem has * been unmounted. */ if ((howto & RB_NOSYNC) == 0) bootsync(howto); if_downall(); uvm_shutdown(); splhigh(); cold = 1; if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP) dumpsys(); haltsys: config_suspend_all(DVACT_POWERDOWN); /* Make sure IRQ's are disabled */ IRQdisable; if ((howto & RB_HALT) != 0) { if ((howto & RB_POWERDOWN) != 0) { board_powerdown(); printf("WARNING: powerdown failed!\n"); } printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); cnpollc(1); cngetc(); cnpollc(0); } printf("rebooting...\n"); board_reset(); cpu_reset(); printf("reboot failed; spinning\n"); for (;;) ; /* NOTREACHED */ }
void boot(int howto) { struct device *mainbus; if (cold) { /* * If the system is cold, just halt, unless the user * explicitely asked for reboot. */ if ((howto & RB_USERREQ) == 0) howto |= RB_HALT; goto haltsys; } /* * If RB_NOSYNC was not specified sync the discs. * Note: Unless cold is set to 1 here, syslogd will die during the * unmount. It looks like syslogd is getting woken up only to find * that it cannot page part of the binary in as the filesystem has * been unmounted. */ if (!(howto & RB_NOSYNC)) bootsync(howto); if_downall(); uvm_shutdown(); /* Say NO to interrupts */ splhigh(); /* Do a dump if requested. */ if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP) dumpsys(); haltsys: doshutdownhooks(); mainbus = device_mainbus(); if (mainbus != NULL) config_suspend(mainbus, DVACT_POWERDOWN); /* Make sure IRQ's are disabled */ IRQdisable; if (howto & RB_HALT) { if (howto & RB_POWERDOWN) { board_powerdown(); printf("WARNING: powerdown failed!\n"); } printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); cnpollc(1); cngetc(); cnpollc(0); } printf("rebooting...\n"); board_reset(); cpu_reset(); printf("reboot failed; spinning\n"); while(1); /*NOTREACHED*/ }