aboutsummaryrefslogtreecommitdiff
path: root/arch/sparc/kernel/reboot.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-12-31 08:19:48 +0100
committerIngo Molnar <mingo@elte.hu>2008-12-31 08:19:48 +0100
commit818fa7f3908c7bd6c0045e9d94dc23a899ef6144 (patch)
treead3435c3f57c8222ad61709b716168932f13be6c /arch/sparc/kernel/reboot.c
parent3fd4bc015ef879a7d2b955ce97fb125e3a51ba7e (diff)
parent5fdf7e5975a0b0f6a0370655612c5dca3fd6311b (diff)
Merge branch 'tracing/kmemtrace' into tracing/kmemtrace2
Diffstat (limited to 'arch/sparc/kernel/reboot.c')
-rw-r--r--arch/sparc/kernel/reboot.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/arch/sparc/kernel/reboot.c b/arch/sparc/kernel/reboot.c
new file mode 100644
index 00000000000..ef89d3d6974
--- /dev/null
+++ b/arch/sparc/kernel/reboot.c
@@ -0,0 +1,53 @@
+/* reboot.c: reboot/shutdown/halt/poweroff handling
+ *
+ * Copyright (C) 2008 David S. Miller <davem@davemloft.net>
+ */
+#include <linux/kernel.h>
+#include <linux/reboot.h>
+#include <linux/module.h>
+#include <linux/pm.h>
+
+#include <asm/system.h>
+#include <asm/oplib.h>
+#include <asm/prom.h>
+
+/* sysctl - toggle power-off restriction for serial console
+ * systems in machine_power_off()
+ */
+int scons_pwroff = 1;
+
+/* This isn't actually used, it exists merely to satisfy the
+ * reference in kernel/sys.c
+ */
+void (*pm_power_off)(void) = machine_power_off;
+EXPORT_SYMBOL(pm_power_off);
+
+void machine_power_off(void)
+{
+ if (strcmp(of_console_device->type, "serial") || scons_pwroff)
+ prom_halt_power_off();
+
+ prom_halt();
+}
+
+void machine_halt(void)
+{
+ prom_halt();
+ panic("Halt failed!");
+}
+
+void machine_restart(char *cmd)
+{
+ char *p;
+
+ p = strchr(reboot_command, '\n');
+ if (p)
+ *p = 0;
+ if (cmd)
+ prom_reboot(cmd);
+ if (*reboot_command)
+ prom_reboot(reboot_command);
+ prom_reboot("");
+ panic("Reboot failed!");
+}
+