void cpu_reboot(int howto, char *bootstr) { #ifdef DIAGNOSTIC /* info */ printf("boot: howto=%08x curproc=%p\n", howto, curproc); #endif /* * If we are still cold then hit the air brakes * and crash to earth fast */ if (cold) { doshutdownhooks(); pmf_system_shutdown(boothowto); printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); cngetc(); printf("rebooting...\n"); cpu_reset(); /*NOTREACHED*/ } /* * 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(); /* Say NO to interrupts */ splhigh(); /* Do a dump if requested. */ if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP) dumpsys(); /* Run any shutdown hooks */ doshutdownhooks(); pmf_system_shutdown(boothowto); /* Make sure IRQ's are disabled */ IRQdisable; if (howto & RB_HALT) { printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); cngetc(); } printf("rebooting...\n"); cpu_reset(); /*NOTREACHED*/ }
void cpu_reboot(int howto, char *bootstr) { /* Take a snapshot before clobbering any registers. */ savectx(curpcb); if (cold) { howto |= RB_HALT; goto haltsys; } /* If "always halt" was specified as a boot flag, obey. */ if (boothowto & RB_HALT) howto |= RB_HALT; boothowto = howto; if ((howto & RB_NOSYNC) == 0 && (waittime < 0)) { waittime = 0; vfs_shutdown(); /* * If we've been adjusting the clock, the todr * will be out of synch; adjust it now. */ resettodr(); } splhigh(); if (howto & RB_DUMP) dumpsys(); haltsys: doshutdownhooks(); pmf_system_shutdown(boothowto); if (howto & RB_HALT) { printf("\n"); printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); cnpollc(1); /* For proper keyboard command handling */ cngetc(); cnpollc(0); } printf("rebooting...\n\n"); delay(500000); *(volatile char *)MIPS_PHYS_TO_KSEG1(LED_ADDR) = LED_RESET; printf("WARNING: reboot failed!\n"); for (;;) ; }
/* main guts */ void cpu_reboot(int howto, char *bootstr) { extern void usermode_reboot(void); if (cold) howto |= RB_HALT; if ((howto & RB_NOSYNC) == 0) vfs_shutdown(); else suspendsched(); doshutdownhooks(); pmf_system_shutdown(boothowto); if ((howto & RB_POWERDOWN) == RB_POWERDOWN) thunk_exit(0); splhigh(); if (howto & RB_DUMP) thunk_abort(); if (howto & RB_HALT) { printf("\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"); usermode_reboot(); /* NOTREACHED */ cpu_unreachable(); }
/* * 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; boothowto = howto; if (!cold && !(howto & RB_NOSYNC) && !syncing) { syncing = 1; vfs_shutdown(); /* sync */ resettodr(); /* set wall clock */ } splhigh(); if (!cold && (howto & RB_DUMP)) ibm4xx_dumpsys(); doshutdownhooks(); pmf_system_shutdown(boothowto); if ((howto & RB_POWERDOWN) == RB_POWERDOWN) { /* Power off here if we know how...*/ } if (howto & RB_HALT) { printf("halted\n\n"); #if 0 goto reboot; /* XXX for now... */ #endif #ifdef DDB printf("dropping to debugger\n"); while(1) Debugger(); #endif } 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 0 reboot: #endif ppc4xx_reset(); printf("ppc4xx_reset() failed!\n"); #ifdef DDB while(1) Debugger(); #else while (1) /* nothing */; #endif }
void cpu_reboot(volatile int howto, char *bootstr) { /* take a snap shot before clobbering any registers */ savectx(curpcb); #ifdef DEBUG if (panicstr) stacktrace(); #endif /* If system is cold, just halt. */ if (cold) { howto |= RB_HALT; goto haltsys; } /* If "always halt" was specified as a boot flag, obey. */ if ((boothowto & RB_HALT) != 0) howto |= RB_HALT; boothowto = howto; if ((howto & RB_NOSYNC) == 0 && waittime < 0) { /* * Synchronize the disks.... */ waittime = 0; vfs_shutdown(); /* * If we've been adjusting the clock, the todr * will be out of synch; adjust it now. */ resettodr(); } /* Disable interrupts. */ disable_intr(); splhigh(); /* If rebooting and a dump is requested do it. */ #if 0 if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP) #else if (howto & RB_DUMP) #endif dumpsys(); haltsys: /* run any shutdown hooks */ doshutdownhooks(); pmf_system_shutdown(boothowto); if ((howto & RB_POWERDOWN) == RB_POWERDOWN) prom_halt(0x80); /* rom monitor RB_PWOFF */ /* Finally, halt/reboot the system. */ printf("%s\n\n", howto & RB_HALT ? "halted." : "rebooting..."); prom_halt(howto & RB_HALT); /*NOTREACHED*/ }
/* * void cpu_reboot(int howto, char *bootstr) * * Reboots the system * * Deal with any syncing, unmounting, dumping and shutdown hooks, * then reset the CPU. */ void cpu_reboot(int howto, char *bootstr) { /* * If we are still cold then hit the air brakes * and crash to earth fast */ if (cold) { doshutdownhooks(); pmf_system_shutdown(boothowto); printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); cngetc(); printf("rebooting...\n"); goto reset; } /* Disable console buffering */ /* * 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(); /* Say NO to interrupts */ splhigh(); /* Do a dump if requested. */ if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP) dumpsys(); /* Run any shutdown hooks */ doshutdownhooks(); pmf_system_shutdown(boothowto); /* Make sure IRQ's are disabled */ IRQdisable; if (howto & RB_HALT) { printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); cngetc(); } printf("rebooting...\n\r"); reset: /* * Make really really sure that all interrupts are disabled, * and poke the Internal Bus and Peripheral Bus reset lines. */ (void) disable_interrupts(I32_bit|F32_bit); *(volatile uint32_t *)(IYONIX_80321_VBASE + VERDE_ATU_BASE + ATU_PCSR) = PCSR_RIB | PCSR_RPB; /* ...and if that didn't work, just croak. */ printf("RESET FAILED!\n"); for (;;); }
void cpu_reboot(int howto, char *bootstr) { static int waittime = -1; /* Take a snapshot before clobbering any registers. */ savectx(curpcb); /* If "always halt" was specified as a boot flag, obey. */ if (boothowto & RB_HALT) howto |= RB_HALT; boothowto = howto; /* If system is cold, just halt. */ if (cold) { boothowto |= RB_HALT; goto haltsys; } if ((boothowto & RB_NOSYNC) == 0 && waittime < 0) { waittime = 0; /* * Synchronize the disks.... */ vfs_shutdown(); /* * If we've been adjusting the clock, the todr * will be out of synch; adjust it now. */ resettodr(); } /* Disable interrupts. */ splhigh(); if (boothowto & RB_DUMP) dumpsys(); haltsys: /* Run any shutdown hooks. */ doshutdownhooks(); pmf_system_shutdown(boothowto); #if 0 if ((boothowto & RB_POWERDOWN) == RB_POWERDOWN) if (board && board->ab_poweroff) board->ab_poweroff(); #endif /* * Firmware may autoboot (depending on settings), and we cannot pass * flags to it (at least I haven't figured out how to yet), so * we "pseudo-halt" now. */ if (boothowto & RB_HALT) { printf("\n"); printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); cnpollc(1); /* For proper keyboard command handling */ cngetc(); cnpollc(0); } printf("reseting board...\n\n"); mips_icache_sync_all(); mips_dcache_wbinv_all(); atheros_reset(); __asm volatile("jr %0" :: "r"(MIPS_RESET_EXC_VEC)); printf("Oops, back from reset\n\nSpinning..."); for (;;) /* spin forever */ ; /* XXX */ /*NOTREACHED*/ }
void cpu_reboot(int howto, char *bootstr) { /* * If we are still cold then hit the air brakes * and crash to earth fast */ if (cold) { doshutdownhooks(); pmf_system_shutdown(boothowto); printf("Halted while still in the ICE age.\n"); printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); cngetc(); printf("rebooting...\n"); ixp12x0_reset(); } /* Disable console buffering */ cnpollc(1); /* * 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(); /* Say NO to interrupts */ splhigh(); /* Do a dump if requested. */ if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP) dumpsys(); /* Run any shutdown hooks */ doshutdownhooks(); pmf_system_shutdown(boothowto); /* Make sure IRQ's are disabled */ IRQdisable; if (howto & RB_HALT) { printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); cngetc(); } printf("rebooting...\n"); /* all interrupts are disabled */ disable_interrupts(I32_bit); ixp12x0_reset(); /* ...and if that didn't work, just croak. */ printf("RESET FAILED!\n"); for (;;); }
/* * void cpu_reboot(int howto, char *bootstr) * * Reboots the system * * Deal with any syncing, unmounting, dumping and shutdown hooks, * then reset the CPU. */ void cpu_reboot(int howto, char *bootstr) { #ifdef DIAGNOSTIC /* info */ printf("boot: howto=%08x curproc=%p\n", howto, curproc); #endif /* * If we are still cold then hit the air brakes * and crash to earth fast */ if (cold) { doshutdownhooks(); pmf_system_shutdown(boothowto); printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); cngetc(); goto reset; } /* Disable console buffering */ /* * 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(); /* Say NO to interrupts */ splhigh(); /* Do a dump if requested. */ if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP) dumpsys(); /* Run any shutdown hooks */ doshutdownhooks(); pmf_system_shutdown(boothowto); /* Make sure IRQ's are disabled */ IRQdisable; if ((howto & (RB_HALT | RB_POWERDOWN)) == RB_HALT) { printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); cngetc(); } reset: /* * Make really really sure that all interrupts are disabled, */ (void) disable_interrupts(I32_bit | F32_bit); if (howto & RB_POWERDOWN) { uint32_t reg; printf("powering down...\n\r"); /* Delay to allow the UART's Tx FIFO to drain */ delay(50000); #define GPRD(r) *((volatile uint32_t *)(IXP425_GPIO_VBASE+(r))) #define GPWR(r,v) *((volatile uint32_t *)(IXP425_GPIO_VBASE+(r))) = (v) /* * Power-down pin requires a short pulse */ reg = GPRD(IXP425_GPIO_GPOUTR); reg |= 1u << GPIO_POWER_OFF; GPWR(IXP425_GPIO_GPOUTR, reg); delay(1000); reg = GPRD(IXP425_GPIO_GPOUTR); reg &= ~(1u << GPIO_POWER_OFF); GPWR(IXP425_GPIO_GPOUTR, reg); delay(500000); printf("POWER OFF FAILED! TRYING TO REBOOT INSTEAD\n\r"); } printf("rebooting...\n\r"); #define WDWR(r,v) *((volatile uint32_t *)(IXP425_OST_WDOG_VBASE+(r))) = (v) /* Force a watchdog reset */ WDWR(IXP425_OST_WDOG_KEY, OST_WDOG_KEY_MAJICK); WDWR(IXP425_OST_WDOG_ENAB, OST_WDOG_ENAB_RST_ENA); WDWR(IXP425_OST_WDOG, 0x1000); WDWR(IXP425_OST_WDOG_ENAB, OST_WDOG_ENAB_RST_ENA | OST_WDOG_ENAB_CNT_ENA); delay(500000); /* ...and if that didn't work, just croak. */ printf("RESET FAILED!\n"); for (;;); }
/* * void cpu_reboot(int howto, char *bootstr) * * Reboots the system * * Deal with any syncing, unmounting, dumping and shutdown hooks, * then reset the CPU. */ void cpu_reboot(int howto, char *bootstr) { /* * If we are still cold then hit the air brakes * and crash to earth fast */ if (cold) { doshutdownhooks(); pmf_system_shutdown(boothowto); printf("\r\n"); printf("The operating system has halted.\r\n"); printf("Please press any key to reboot.\r\n"); cngetc(); printf("\r\nrebooting...\r\n"); goto reset; } /* Disable console buffering */ /* * 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(); /* Say NO to interrupts */ splhigh(); /* Do a dump if requested. */ if ((howto & (RB_DUMP | RB_HALT)) == RB_DUMP) dumpsys(); /* Run any shutdown hooks */ doshutdownhooks(); pmf_system_shutdown(boothowto); /* Make sure IRQ's are disabled */ IRQdisable; if (howto & RB_HALT) { printf("\r\n"); printf("The operating system has halted.\r\n"); printf("Please press any key to reboot.\r\n"); cngetc(); } printf("\r\nrebooting...\r\n"); reset: /* * Make really really sure that all interrupts are disabled, * and poke the Internal Bus and Peripheral Bus reset lines. */ (void) disable_interrupts(I32_bit|F32_bit); #if NEPWDOG > 0 epwdog_reset(); #else { uint32_t ctrl = EP93XX_APB_VBASE + EP93XX_APB_WDOG + EP93XX_WDOG_Ctrl; uint32_t val = EP93XX_WDOG_ENABLE; __asm volatile ( "str %1, [%0]\n" : : "r" (ctrl), "r" (val) ); } #endif for (;;); }
void cpu_reboot(int howto, char *bootstr) { static int waittime = -1; const struct alchemy_board *board; /* Take a snapshot before clobbering any registers. */ savectx(curpcb); board = board_info(); KASSERT(board != NULL); /* If "always halt" was specified as a boot flag, obey. */ if (boothowto & RB_HALT) howto |= RB_HALT; boothowto = howto; /* If system is cold, just halt. */ if (cold) { boothowto |= RB_HALT; goto haltsys; } if ((boothowto & RB_NOSYNC) == 0 && waittime < 0) { waittime = 0; /* * Synchronize the disks.... */ vfs_shutdown(); /* * If we've been adjusting the clock, the todr * will be out of synch; adjust it now. */ resettodr(); } /* Disable interrupts. */ splhigh(); if (boothowto & RB_DUMP) dumpsys(); haltsys: /* Run any shutdown hooks. */ doshutdownhooks(); pmf_system_shutdown(boothowto); if ((boothowto & RB_POWERDOWN) == RB_POWERDOWN) if (board && board->ab_poweroff) board->ab_poweroff(); /* * YAMON may autoboot (depending on settings), and we cannot pass * flags to it (at least I haven't figured out how to yet), so * we "pseudo-halt" now. */ if (boothowto & RB_HALT) { printf("\n"); printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); cnpollc(1); /* For proper keyboard command handling */ cngetc(); cnpollc(0); } printf("reseting board...\n\n"); /* * Try to use board-specific reset logic, which might involve a better * hardware reset. */ if (board->ab_reboot) board->ab_reboot(); #if 1 /* XXX * For some reason we are leaving the ethernet MAC in a state where * YAMON isn't happy with it. So just call the reset vector (grr, * Alchemy YAMON doesn't have a "reset" command). */ mips_icache_sync_all(); mips_dcache_wbinv_all(); __asm volatile("jr %0" :: "r"(MIPS_RESET_EXC_VEC)); #else printf("%s\n\n", ((howto & RB_HALT) != 0) ? "halted." : "rebooting..."); yamon_exit(boothowto); printf("Oops, back from yamon_exit()\n\nSpinning..."); #endif for (;;) /* spin forever */ ; /* XXX */ /*NOTREACHED*/ }