blob: a933ee001ea46df785ba1d31b5c5a2761a9fdcbd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#include <xen/init.h>
#include <xen/lib.h>
#include <xen/param.h>
#include <xen/sched.h>
#include <xen/debugger.h>
#include <xen/domain.h>
#include <xen/delay.h>
#include <xen/watchdog.h>
#include <xen/shutdown.h>
#include <xen/console.h>
#include <xen/kexec.h>
#include <public/sched.h>
/* opt_noreboot: If true, machine will need manual reset on error. */
bool_t __read_mostly opt_noreboot;
boolean_param("noreboot", opt_noreboot);
static void noreturn maybe_reboot(void)
{
if ( opt_noreboot )
{
printk("'noreboot' set - not rebooting.\n");
machine_halt();
}
else
{
printk("rebooting machine in 5 seconds.\n");
watchdog_disable();
machine_restart(5000);
}
}
void hwdom_shutdown(u8 reason)
{
switch ( reason )
{
case SHUTDOWN_poweroff:
printk("Hardware Dom%u halted: halting machine\n",
hardware_domain->domain_id);
machine_halt();
break; /* not reached */
case SHUTDOWN_crash:
debugger_trap_immediate();
printk("Hardware Dom%u crashed: ", hardware_domain->domain_id);
kexec_crash(CRASHREASON_HWDOM);
maybe_reboot();
break; /* not reached */
case SHUTDOWN_reboot:
printk("Hardware Dom%u shutdown: rebooting machine\n",
hardware_domain->domain_id);
machine_restart(0);
break; /* not reached */
case SHUTDOWN_watchdog:
printk("Hardware Dom%u shutdown: watchdog rebooting machine\n",
hardware_domain->domain_id);
kexec_crash(CRASHREASON_WATCHDOG);
machine_restart(0);
break; /* not reached */
case SHUTDOWN_soft_reset:
printk("Hardware domain %d did unsupported soft reset, rebooting.\n",
hardware_domain->domain_id);
machine_restart(0);
break; /* not reached */
default:
printk("Hardware Dom%u shutdown (unknown reason %u): ",
hardware_domain->domain_id, reason);
maybe_reboot();
break; /* not reached */
}
}
|