diff options
Diffstat (limited to 'arch/sparc64/kernel/reboot.c')
-rw-r--r-- | arch/sparc64/kernel/reboot.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/arch/sparc64/kernel/reboot.c b/arch/sparc64/kernel/reboot.c new file mode 100644 index 000000000000..04dd34cbb872 --- /dev/null +++ b/arch/sparc64/kernel/reboot.c | |||
@@ -0,0 +1,56 @@ | |||
1 | /* reboot.c: reboot/shutdown/halt/poweroff handling | ||
2 | * | ||
3 | * Copyright (C) 2008 David S. Miller <davem@davemloft.net> | ||
4 | */ | ||
5 | #include <linux/kernel.h> | ||
6 | #include <linux/reboot.h> | ||
7 | #include <linux/module.h> | ||
8 | #include <linux/pm.h> | ||
9 | |||
10 | #include <asm/sstate.h> | ||
11 | #include <asm/oplib.h> | ||
12 | #include <asm/prom.h> | ||
13 | |||
14 | /* sysctl - toggle power-off restriction for serial console | ||
15 | * systems in machine_power_off() | ||
16 | */ | ||
17 | int scons_pwroff = 1; | ||
18 | |||
19 | /* This isn't actually used, it exists merely to satisfy the | ||
20 | * reference in kernel/sys.c | ||
21 | */ | ||
22 | void (*pm_power_off)(void) = machine_power_off; | ||
23 | EXPORT_SYMBOL(pm_power_off); | ||
24 | |||
25 | void machine_power_off(void) | ||
26 | { | ||
27 | sstate_poweroff(); | ||
28 | if (strcmp(of_console_device->type, "serial") || scons_pwroff) | ||
29 | prom_halt_power_off(); | ||
30 | |||
31 | prom_halt(); | ||
32 | } | ||
33 | |||
34 | void machine_halt(void) | ||
35 | { | ||
36 | sstate_halt(); | ||
37 | prom_halt(); | ||
38 | panic("Halt failed!"); | ||
39 | } | ||
40 | |||
41 | void machine_restart(char *cmd) | ||
42 | { | ||
43 | char *p; | ||
44 | |||
45 | sstate_reboot(); | ||
46 | p = strchr(reboot_command, '\n'); | ||
47 | if (p) | ||
48 | *p = 0; | ||
49 | if (cmd) | ||
50 | prom_reboot(cmd); | ||
51 | if (*reboot_command) | ||
52 | prom_reboot(reboot_command); | ||
53 | prom_reboot(""); | ||
54 | panic("Reboot failed!"); | ||
55 | } | ||
56 | |||