ia64/xen-unstable

view xen/common/shutdown.c @ 15927:b7eb2bb9b625

IRQ injection changes for HVM PCI passthru.
Signed-off-by: Allen Kay <allen.m.kay@intel.com>
Signed-off-by: Guy Zana <guy@neocleus.com>
author kfraser@localhost.localdomain
date Tue Sep 18 16:09:19 2007 +0100 (2007-09-18)
parents 1c85fe14169f
children 0c857419d354
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();
28 }
29 }
31 void dom0_shutdown(u8 reason)
32 {
33 switch ( reason )
34 {
35 case SHUTDOWN_poweroff:
36 {
37 printk("Domain 0 halted: halting machine.\n");
38 machine_halt();
39 break; /* not reached */
40 }
42 case SHUTDOWN_crash:
43 {
44 debugger_trap_immediate();
45 printk("Domain 0 crashed: ");
46 maybe_reboot();
47 break; /* not reached */
48 }
50 case SHUTDOWN_reboot:
51 {
52 printk("Domain 0 shutdown: rebooting machine.\n");
53 machine_restart();
54 break; /* not reached */
55 }
57 default:
58 {
59 printk("Domain 0 shutdown (unknown reason %u): ", reason);
60 maybe_reboot();
61 break; /* not reached */
62 }
63 }
64 }