ia64/xen-unstable

view xen/common/shutdown.c @ 11128:f2f584093379

[POWERPC] Update .hgignore
Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com>
author kfraser@localhost.localdomain
date Tue Aug 15 10:38:59 2006 +0100 (2006-08-15)
parents 16aa4b417c6b
children 74855cdc4a1d
line source
1 #include <xen/config.h>
2 #include <xen/init.h>
3 #include <xen/lib.h>
4 #include <xen/sched.h>
5 #include <xen/domain.h>
6 #include <xen/delay.h>
7 #include <xen/shutdown.h>
8 #include <asm/debugger.h>
9 #include <public/sched.h>
11 /* opt_noreboot: If true, machine will need manual reset on error. */
12 int opt_noreboot;
13 boolean_param("noreboot", opt_noreboot);
15 static void maybe_reboot(void)
16 {
17 if ( opt_noreboot )
18 {
19 printk("'noreboot' set - not rebooting.\n");
20 machine_halt();
21 }
22 else
23 {
24 printk("rebooting machine in 5 seconds.\n");
25 watchdog_disable();
26 mdelay(5000);
27 machine_restart(NULL);
28 }
29 }
31 void dom0_shutdown(u8 reason)
32 {
33 debugger_trap_immediate();
35 switch ( reason )
36 {
37 case SHUTDOWN_poweroff:
38 {
39 printk("Domain 0 halted: halting machine.\n");
40 machine_halt();
41 break; /* not reached */
42 }
44 case SHUTDOWN_crash:
45 {
46 printk("Domain 0 crashed: ");
47 maybe_reboot();
48 break; /* not reached */
49 }
51 case SHUTDOWN_reboot:
52 {
53 printk("Domain 0 shutdown: rebooting machine.\n");
54 machine_restart(NULL);
55 break; /* not reached */
56 }
58 default:
59 {
60 printk("Domain 0 shutdown (unknown reason %u): ", reason);
61 maybe_reboot();
62 break; /* not reached */
63 }
64 }
65 }