debuggers.hg

view xen/common/shutdown.c @ 22848:6341fe0f4e5a

Added tag 4.1.0-rc2 for changeset 9dca60d88c63
author Keir Fraser <keir@xen.org>
date Tue Jan 25 14:06:55 2011 +0000 (2011-01-25)
parents e8acb9753ff1
children
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 <xen/console.h>
9 #include <xen/kexec.h>
10 #include <asm/debugger.h>
11 #include <public/sched.h>
13 /* opt_noreboot: If true, machine will need manual reset on error. */
14 bool_t __read_mostly opt_noreboot;
15 boolean_param("noreboot", opt_noreboot);
17 static void maybe_reboot(void)
18 {
19 if ( opt_noreboot )
20 {
21 printk("'noreboot' set - not rebooting.\n");
22 machine_halt();
23 }
24 else
25 {
26 printk("rebooting machine in 5 seconds.\n");
27 watchdog_disable();
28 machine_restart(5000);
29 }
30 }
32 void dom0_shutdown(u8 reason)
33 {
34 switch ( reason )
35 {
36 case SHUTDOWN_poweroff:
37 {
38 printk("Domain 0 halted: halting machine.\n");
39 machine_halt();
40 break; /* not reached */
41 }
43 case SHUTDOWN_crash:
44 {
45 debugger_trap_immediate();
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(0);
55 break; /* not reached */
56 }
58 case SHUTDOWN_watchdog:
59 {
60 printk("Domain 0 shutdown: watchdog rebooting machine.\n");
61 kexec_crash();
62 machine_restart(0);
63 break; /* not reached */
64 }
66 default:
67 {
68 printk("Domain 0 shutdown (unknown reason %u): ", reason);
69 maybe_reboot();
70 break; /* not reached */
71 }
72 }
73 }