sparc64: Move reboot handling into seperate file and kill power reg programming.
authorDavid S. Miller <davem@davemloft.net>
Tue, 2 Sep 2008 02:31:16 +0000 (19:31 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 2 Sep 2008 07:31:11 +0000 (00:31 -0700)
We should always use prom_power_off().

Signed-off-by: David S. Miller <davem@davemloft.net>
arch/sparc/include/asm/reboot.h [deleted file]
arch/sparc64/kernel/Makefile
arch/sparc64/kernel/power.c
arch/sparc64/kernel/process.c
arch/sparc64/kernel/reboot.c [new file with mode: 0644]

diff --git a/arch/sparc/include/asm/reboot.h b/arch/sparc/include/asm/reboot.h
deleted file mode 100644 (file)
index 3f3f43f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _SPARC64_REBOOT_H
-#define _SPARC64_REBOOT_H
-
-extern void machine_alt_power_off(void);
-
-#endif /* _SPARC64_REBOOT_H */
index 928aa7c8058edc4e446d8c1d50b08a1fb2e59a82..fb02807167ebe1378d4e894635f713cd5caaff84 100644 (file)
@@ -7,7 +7,7 @@ EXTRA_CFLAGS := -Werror
 
 extra-y                := head.o init_task.o vmlinux.lds
 
-obj-y          := process.o setup.o cpu.o idprom.o \
+obj-y          := process.o setup.o cpu.o idprom.o reboot.o \
                   traps.o auxio.o una_asm.o sysfs.o iommu.o \
                   irq.o ptrace.o time.o sys_sparc.o signal.o \
                   unaligned.o central.o starfire.o \
index 7559ad395a33d4bf293d53791899b5e270b25c56..076cad7f975766aaae812714de7613452d2978cf 100644 (file)
@@ -7,21 +7,11 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
-#include <linux/pm.h>
 #include <linux/reboot.h>
 #include <linux/of_device.h>
 
-#include <asm/auxio.h>
 #include <asm/prom.h>
 #include <asm/io.h>
-#include <asm/sstate.h>
-#include <asm/reboot.h>
-
-/*
- * sysctl - toggle power-off restriction for serial console 
- * systems in machine_power_off()
- */
-int scons_pwroff = 1; 
 
 static void __iomem *power_reg;
 
@@ -33,31 +23,6 @@ static irqreturn_t power_handler(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-static void (*poweroff_method)(void) = machine_alt_power_off;
-
-void machine_power_off(void)
-{
-       sstate_poweroff();
-       if (strcmp(of_console_device->type, "serial") || scons_pwroff) {
-               if (power_reg) {
-                       /* Both register bits seem to have the
-                        * same effect, so until I figure out
-                        * what the difference is...
-                        */
-                       writel(AUXIO_PCIO_CPWR_OFF | AUXIO_PCIO_SPWR_OFF, power_reg);
-               } else {
-                       if (poweroff_method != NULL) {
-                               poweroff_method();
-                               /* not reached */
-                       }
-               }
-       }
-       machine_halt();
-}
-
-void (*pm_power_off)(void) = machine_power_off;
-EXPORT_SYMBOL(pm_power_off);
-
 static int __init has_button_interrupt(unsigned int irq, struct device_node *dp)
 {
        if (irq == 0xffffffff)
@@ -78,8 +43,6 @@ static int __devinit power_probe(struct of_device *op, const struct of_device_id
        printk(KERN_INFO "%s: Control reg at %lx\n",
               op->node->name, res->start);
 
-       poweroff_method = machine_halt;  /* able to use the standard halt */
-
        if (has_button_interrupt(irq, op->node)) {
                if (request_irq(irq,
                                power_handler, 0, "power", NULL) < 0)
index 15f4178592e762d4bbff775679ae80c70e91423d..11bb6c4612de9f2137a878bc5273fd2a1e5f7152 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/ptrace.h>
 #include <linux/slab.h>
 #include <linux/user.h>
-#include <linux/reboot.h>
 #include <linux/delay.h>
 #include <linux/compat.h>
 #include <linux/tick.h>
@@ -31,7 +30,6 @@
 #include <linux/elfcore.h>
 #include <linux/sysrq.h>
 
-#include <asm/oplib.h>
 #include <asm/uaccess.h>
 #include <asm/system.h>
 #include <asm/page.h>
@@ -46,8 +44,6 @@
 #include <asm/mmu_context.h>
 #include <asm/unistd.h>
 #include <asm/hypervisor.h>
-#include <asm/sstate.h>
-#include <asm/reboot.h>
 #include <asm/syscalls.h>
 #include <asm/irq_regs.h>
 #include <asm/smp.h>
@@ -115,35 +111,6 @@ void cpu_idle(void)
        }
 }
 
-void machine_halt(void)
-{
-       sstate_halt();
-       prom_halt();
-       panic("Halt failed!");
-}
-
-void machine_alt_power_off(void)
-{
-       sstate_poweroff();
-       prom_halt_power_off();
-       panic("Power-off failed!");
-}
-
-void machine_restart(char * cmd)
-{
-       char *p;
-       
-       sstate_reboot();
-       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!");
-}
-
 #ifdef CONFIG_COMPAT
 static void show_regwindow32(struct pt_regs *regs)
 {
diff --git a/arch/sparc64/kernel/reboot.c b/arch/sparc64/kernel/reboot.c
new file mode 100644 (file)
index 0000000..04dd34c
--- /dev/null
@@ -0,0 +1,56 @@
+/* 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/sstate.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)
+{
+       sstate_poweroff();
+       if (strcmp(of_console_device->type, "serial") || scons_pwroff)
+               prom_halt_power_off();
+
+       prom_halt();
+}
+
+void machine_halt(void)
+{
+       sstate_halt();
+       prom_halt();
+       panic("Halt failed!");
+}
+
+void machine_restart(char *cmd)
+{
+       char *p;
+
+       sstate_reboot();
+       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!");
+}
+