/* * Halt or reboot the machine after syncing/dumping according to howto. */ void cpu_reboot(int howto, char *what) { static int syncing; static char str[256]; char *ap = str, *ap1 = ap; /* * Enable external interrupts in case someone is rebooting * from a strange context via ddb. */ mtmsr(mfmsr() | PSL_EE); boothowto = howto; if (!cold && !(howto & RB_NOSYNC) && !syncing) { syncing = 1; vfs_shutdown(); /* sync */ resettodr(); /* set wall clock */ } #ifdef MULTIPROCESSOR /* Halt other CPU */ ppc_send_ipi(IPI_T_NOTME, PPC_IPI_HALT); delay(100000); /* XXX */ #endif splhigh(); if (!cold && (howto & RB_DUMP)) dumpsys(); doshutdownhooks(); if ((howto & RB_POWERDOWN) == RB_POWERDOWN) { delay(1000000); #if NCUDA > 0 cuda_poweroff(); #endif #if NPMU > 0 pmu_poweroff(); #endif #if NADB > 0 adb_poweroff(); printf("WARNING: powerdown failed!\n"); #endif } if (howto & RB_HALT) { printf("halted\n\n"); /* flush cache for msgbuf */ __syncicache((void *)msgbuf_paddr, round_page(MSGBUFSIZE)); ppc_exit(); } printf("rebooting\n\n"); if (what && *what) { if (strlen(what) > sizeof str - 5) printf("boot string too large, ignored\n"); else { strcpy(str, what); ap1 = ap = str + strlen(str); *ap++ = ' '; } } *ap++ = '-'; if (howto & RB_SINGLE) *ap++ = 's'; if (howto & RB_KDB) *ap++ = 'd'; *ap++ = 0; if (ap[-2] == '-') *ap1 = 0; /* flush cache for msgbuf */ __syncicache((void *)msgbuf_paddr, round_page(MSGBUFSIZE)); #if NCUDA > 0 cuda_restart(); #endif #if NPMU > 0 pmu_restart(); #endif #if NADB > 0 adb_restart(); /* not return */ #endif ppc_exit(); }
void __pmac pmac_restart(char *cmd) { pmu_restart(); }