aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-09-01 22:31:16 -0400
committerDavid S. Miller <davem@davemloft.net>2008-09-02 03:31:11 -0400
commitcdb3592a20b41377a28a0737dc9af95e53024470 (patch)
tree378d6001731b78e9c8bcb15d642dc34a18e887f7 /arch/sparc64
parente822358ac24550d889895d5866797ae8c9b188c2 (diff)
sparc64: Move reboot handling into seperate file and kill power reg programming.
We should always use prom_power_off(). Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64')
-rw-r--r--arch/sparc64/kernel/Makefile2
-rw-r--r--arch/sparc64/kernel/power.c37
-rw-r--r--arch/sparc64/kernel/process.c33
-rw-r--r--arch/sparc64/kernel/reboot.c56
4 files changed, 57 insertions, 71 deletions
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile
index 928aa7c8058e..fb02807167eb 100644
--- a/arch/sparc64/kernel/Makefile
+++ b/arch/sparc64/kernel/Makefile
@@ -7,7 +7,7 @@ EXTRA_CFLAGS := -Werror
7 7
8extra-y := head.o init_task.o vmlinux.lds 8extra-y := head.o init_task.o vmlinux.lds
9 9
10obj-y := process.o setup.o cpu.o idprom.o \ 10obj-y := process.o setup.o cpu.o idprom.o reboot.o \
11 traps.o auxio.o una_asm.o sysfs.o iommu.o \ 11 traps.o auxio.o una_asm.o sysfs.o iommu.o \
12 irq.o ptrace.o time.o sys_sparc.o signal.o \ 12 irq.o ptrace.o time.o sys_sparc.o signal.o \
13 unaligned.o central.o starfire.o \ 13 unaligned.o central.o starfire.o \
diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c
index 7559ad395a33..076cad7f9757 100644
--- a/arch/sparc64/kernel/power.c
+++ b/arch/sparc64/kernel/power.c
@@ -7,21 +7,11 @@
7#include <linux/module.h> 7#include <linux/module.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/interrupt.h> 9#include <linux/interrupt.h>
10#include <linux/pm.h>
11#include <linux/reboot.h> 10#include <linux/reboot.h>
12#include <linux/of_device.h> 11#include <linux/of_device.h>
13 12
14#include <asm/auxio.h>
15#include <asm/prom.h> 13#include <asm/prom.h>
16#include <asm/io.h> 14#include <asm/io.h>
17#include <asm/sstate.h>
18#include <asm/reboot.h>
19
20/*
21 * sysctl - toggle power-off restriction for serial console
22 * systems in machine_power_off()
23 */
24int scons_pwroff = 1;
25 15
26static void __iomem *power_reg; 16static void __iomem *power_reg;
27 17
@@ -33,31 +23,6 @@ static irqreturn_t power_handler(int irq, void *dev_id)
33 return IRQ_HANDLED; 23 return IRQ_HANDLED;
34} 24}
35 25
36static void (*poweroff_method)(void) = machine_alt_power_off;
37
38void machine_power_off(void)
39{
40 sstate_poweroff();
41 if (strcmp(of_console_device->type, "serial") || scons_pwroff) {
42 if (power_reg) {
43 /* Both register bits seem to have the
44 * same effect, so until I figure out
45 * what the difference is...
46 */
47 writel(AUXIO_PCIO_CPWR_OFF | AUXIO_PCIO_SPWR_OFF, power_reg);
48 } else {
49 if (poweroff_method != NULL) {
50 poweroff_method();
51 /* not reached */
52 }
53 }
54 }
55 machine_halt();
56}
57
58void (*pm_power_off)(void) = machine_power_off;
59EXPORT_SYMBOL(pm_power_off);
60
61static int __init has_button_interrupt(unsigned int irq, struct device_node *dp) 26static int __init has_button_interrupt(unsigned int irq, struct device_node *dp)
62{ 27{
63 if (irq == 0xffffffff) 28 if (irq == 0xffffffff)
@@ -78,8 +43,6 @@ static int __devinit power_probe(struct of_device *op, const struct of_device_id
78 printk(KERN_INFO "%s: Control reg at %lx\n", 43 printk(KERN_INFO "%s: Control reg at %lx\n",
79 op->node->name, res->start); 44 op->node->name, res->start);
80 45
81 poweroff_method = machine_halt; /* able to use the standard halt */
82
83 if (has_button_interrupt(irq, op->node)) { 46 if (has_button_interrupt(irq, op->node)) {
84 if (request_irq(irq, 47 if (request_irq(irq,
85 power_handler, 0, "power", NULL) < 0) 48 power_handler, 0, "power", NULL) < 0)
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c
index 15f4178592e7..11bb6c4612de 100644
--- a/arch/sparc64/kernel/process.c
+++ b/arch/sparc64/kernel/process.c
@@ -22,7 +22,6 @@
22#include <linux/ptrace.h> 22#include <linux/ptrace.h>
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/user.h> 24#include <linux/user.h>
25#include <linux/reboot.h>
26#include <linux/delay.h> 25#include <linux/delay.h>
27#include <linux/compat.h> 26#include <linux/compat.h>
28#include <linux/tick.h> 27#include <linux/tick.h>
@@ -31,7 +30,6 @@
31#include <linux/elfcore.h> 30#include <linux/elfcore.h>
32#include <linux/sysrq.h> 31#include <linux/sysrq.h>
33 32
34#include <asm/oplib.h>
35#include <asm/uaccess.h> 33#include <asm/uaccess.h>
36#include <asm/system.h> 34#include <asm/system.h>
37#include <asm/page.h> 35#include <asm/page.h>
@@ -46,8 +44,6 @@
46#include <asm/mmu_context.h> 44#include <asm/mmu_context.h>
47#include <asm/unistd.h> 45#include <asm/unistd.h>
48#include <asm/hypervisor.h> 46#include <asm/hypervisor.h>
49#include <asm/sstate.h>
50#include <asm/reboot.h>
51#include <asm/syscalls.h> 47#include <asm/syscalls.h>
52#include <asm/irq_regs.h> 48#include <asm/irq_regs.h>
53#include <asm/smp.h> 49#include <asm/smp.h>
@@ -115,35 +111,6 @@ void cpu_idle(void)
115 } 111 }
116} 112}
117 113
118void machine_halt(void)
119{
120 sstate_halt();
121 prom_halt();
122 panic("Halt failed!");
123}
124
125void machine_alt_power_off(void)
126{
127 sstate_poweroff();
128 prom_halt_power_off();
129 panic("Power-off failed!");
130}
131
132void machine_restart(char * cmd)
133{
134 char *p;
135
136 sstate_reboot();
137 p = strchr (reboot_command, '\n');
138 if (p) *p = 0;
139 if (cmd)
140 prom_reboot(cmd);
141 if (*reboot_command)
142 prom_reboot(reboot_command);
143 prom_reboot("");
144 panic("Reboot failed!");
145}
146
147#ifdef CONFIG_COMPAT 114#ifdef CONFIG_COMPAT
148static void show_regwindow32(struct pt_regs *regs) 115static void show_regwindow32(struct pt_regs *regs)
149{ 116{
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 */
17int scons_pwroff = 1;
18
19/* This isn't actually used, it exists merely to satisfy the
20 * reference in kernel/sys.c
21 */
22void (*pm_power_off)(void) = machine_power_off;
23EXPORT_SYMBOL(pm_power_off);
24
25void 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
34void machine_halt(void)
35{
36 sstate_halt();
37 prom_halt();
38 panic("Halt failed!");
39}
40
41void 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