static void wdt_interrupt(int irq, void *dev_id, struct pt_regs *regs) { /* * Read the status register see what is up and * then printk it. */ unsigned char status=inb_p(WDT_SR); status|=FEATUREMAP1; status&=~FEATUREMAP2; printk(KERN_CRIT "WDT status %d\n", status); if(!(status&WDC_SR_TGOOD)) printk(KERN_CRIT "Overheat alarm.(%d)\n",inb_p(WDT_RT)); if(!(status&WDC_SR_PSUOVER)) printk(KERN_CRIT "PSU over voltage.\n"); if(!(status&WDC_SR_PSUUNDR)) printk(KERN_CRIT "PSU under voltage.\n"); if(!(status&WDC_SR_FANGOOD)) printk(KERN_CRIT "Possible fan fault.\n"); if(!(status&WDC_SR_WCCR)) #ifdef SOFTWARE_REBOOT #ifdef ONLY_TESTING printk(KERN_CRIT "Would Reboot.\n"); #else printk(KERN_CRIT "Initiating system reboot.\n"); hard_reset_now(); #endif #else printk(KERN_CRIT "Reset in 5ms.\n"); #endif }
NORET_TYPE void panic(const char * fmt, ...) { static char buf[1024]; va_list args; int i; va_start(args, fmt); vsprintf(buf, fmt, args); va_end(args); printk(KERN_EMERG "Kernel panic: %s\n",buf); if (current == task[0]) printk(KERN_EMERG "In swapper task - not syncing\n"); else sys_sync(); do_unblank_screen(); if (panic_timeout > 0) { /* * Delay timeout seconds before rebooting the machine. * We can't use the "normal" timers since we just panicked.. */ printk(KERN_EMERG "Rebooting in %d seconds..",panic_timeout); for(i = 0; i < (panic_timeout*1000); i++) udelay(1000); hard_reset_now(); } for(;;); }
/* * This function gets called by ctrl-alt-del - ie the keyboard interrupt. * As it's called within an interrupt, it may NOT sync: the only choice * is whether to reboot at once, or just ignore the ctrl-alt-del. */ void ctrl_alt_del(void) { if (C_A_D) hard_reset_now(); else kill_proc(1, SIGINT, 1); }
/* * Reboot system call: for obvious reasons only root may call it, * and even root needs to set up some magic numbers in the registers * so that some mistake won't make this reboot the whole machine. * You can also set the meaning of the ctrl-alt-del-key here. * * reboot doesn't sync: do that yourself before calling this. */ asmlinkage int sys_reboot(int magic, int magic_too, int flag) { if (!suser()) return -EPERM; if (magic != 0xfee1dead || magic_too != 672274793) return -EINVAL; if (flag == 0x01234567) { #ifdef CONFIG_SCSI_GDTH gdth_halt(); #endif hard_reset_now(); } else if (flag == 0x89ABCDEF) C_A_D = 1; else if (!flag) C_A_D = 0; else if (flag == 0xCDEF0123) { #ifdef CONFIG_SCSI_GDTH gdth_halt(); #endif printk(KERN_EMERG "System halted\n"); sys_kill(-1, SIGKILL); #if defined(CONFIG_APM) && defined(CONFIG_APM_POWER_OFF) apm_power_off(); #endif do_exit(0); } else return -EINVAL; return (0); }
/* * This function gets called by ctrl-alt-del - ie the keyboard interrupt. * As it's called within an interrupt, it may NOT sync: the only choice * is whether to reboot at once, or just ignore the ctrl-alt-del. */ void ctrl_alt_del(void) { if (C_A_D) hard_reset_now(); else send_sig(SIGINT,task[1],1); }
/* * This function gets called by ctrl-alt-del - ie the keyboard interrupt. * As it's called within an interrupt, it may NOT sync: the only choice * is whether to reboot at once, or just ignore the ctrl-alt-del. */ void ctrl_alt_del(void) { if (C_A_D) { #ifdef CONFIG_SCSI_GDTH gdth_halt(); #endif hard_reset_now(); } else kill_proc(1, SIGINT, 1); }
/* * Reboot system call: for obvious reasons only root may call it, * and even root needs to set up some magic numbers in the registers * so that some mistake won't make this reboot the whole machine. * You can also set the meaning of the ctrl-alt-del-key here. * * reboot doesn't sync: do that yourself before calling this. */ asmlinkage int sys_reboot(int magic, int magic_too, int flag) { if (!suser()) return -EPERM; if (magic != 0xfee1dead || magic_too != 672274793) return -EINVAL; if (flag == 0x01234567) hard_reset_now(); else if (flag == 0x89ABCDEF) C_A_D = 1; else if (!flag) C_A_D = 0; else if (flag == 0xCDEF0123) { printk(KERN_EMERG "System halted\n"); sys_kill(-1, SIGKILL); do_exit(0); } else return -EINVAL; return (0); }
static _INLINE_ void receive_chars(struct NIOS_serial *info, struct pt_regs *regs, unsigned short rx) { struct tty_struct *tty = info->tty; unsigned char ch; np_uart * uart= (np_uart *)(info->port); /* * This do { } while() loop will get ALL chars out of Rx FIFO */ do { ch = uart->np_uartrxdata; if(info->is_cons) { #ifdef CONFIG_MAGIC_SYSRQ if(rx & np_uartstatus_brk_mask) { batten_down_hatches(); return; } else if (ch == 0x10) { /* ^P */ show_state(); show_mem(); return; } else if (ch == 0x12) { /* ^R */ hard_reset_now(); return; #ifdef DEBUG } else if (ch == 0x02) { /* ^B */ batten_down_hatches(); return; } else if (ch == 0x01) { /* ^A */ asm("trap 0"); /* Back to monitor */ return; /* (won't be coming back) */ #endif } #endif /* CONFIG_MAGIC_SYSRQ */ } if(!tty) goto clear_and_exit; /* * Make sure that we do not overflow the buffer */ if (tty->flip.count >= TTY_FLIPBUF_SIZE) { queue_task(&tty->flip.tqueue, &tq_timer); return; } if(rx & np_uartstatus_pe_mask) { *tty->flip.flag_buf_ptr++ = TTY_PARITY; status_handle(info, rx); } else if(rx & np_uartstatus_roe_mask) { *tty->flip.flag_buf_ptr++ = TTY_OVERRUN; status_handle(info, rx); } else if(rx & np_uartstatus_fe_mask) { *tty->flip.flag_buf_ptr++ = TTY_FRAME; status_handle(info, rx); } else if(rx & np_uartstatus_brk_mask) { *tty->flip.flag_buf_ptr++ = TTY_BREAK; status_handle(info, rx); } else { *tty->flip.flag_buf_ptr++ = 0; /* XXX */ } *tty->flip.char_buf_ptr++ = ch; tty->flip.count++; } while((rx = uart->np_uartstatus) & np_uartstatus_rrdy_mask); queue_task(&tty->flip.tqueue, &tq_timer); clear_and_exit: return; }
void machine_restart(char *cmd) { hard_reset_now(); }
void cmd_reboot() { monitor_write("System is going down for reboot NOW!\n"); hard_reset_now(); }
void machine_restart(void) { hard_reset_now(); }
static _INLINE_ void receive_chars(struct LEON_serial *info, struct pt_regs *regs, unsigned short rx) { struct tty_struct *tty = info->tty; unsigned char ch; /* * This do { } while() loop will get ALL chars out of Rx FIFO */ do { ch = leon->uartdata1; if(info->is_cons) { if(0 /* LEON does not report break */ & rx) { /* whee, break received */ status_handle(info, rx); return; } else if (ch == 0x10) { /* ^P */ show_state(); show_free_areas(); show_buffers(); show_net_buffers(); return; } else if (ch == 0x12) { /* ^R */ hard_reset_now(); return; } /* It is a 'keyboard interrupt' ;-) */ wake_up(&keypress_wait); } if(!tty) goto clear_and_exit; /* * Make sure that we do not overflow the buffer */ if (tty->flip.count >= TTY_FLIPBUF_SIZE) { queue_task_irq_off(&tty->flip.tqueue, &tq_timer); return; } if(rx & USTAT_PE) { *tty->flip.flag_buf_ptr++ = TTY_PARITY; status_handle(info, rx); } else if(rx & USTAT_OV) { *tty->flip.flag_buf_ptr++ = TTY_OVERRUN; status_handle(info, rx); } else if(rx & USTAT_FE) { *tty->flip.flag_buf_ptr++ = TTY_FRAME; status_handle(info, rx); } else { *tty->flip.flag_buf_ptr++ = 0; /* XXX */ } *tty->flip.char_buf_ptr++ = ch; tty->flip.count++; } while((rx = leon->uartstatus1) & USTAT_DR); queue_task_irq_off(&tty->flip.tqueue, &tq_timer); clear_and_exit: return; }