From: David S. Miller Date: Tue, 2 Sep 2008 02:31:16 +0000 (-0700) Subject: sparc64: Move reboot handling into seperate file and kill power reg programming. X-Git-Tag: v2.6.28-rc1~706^2~71 X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=cdb3592a20b41377a28a0737dc9af95e53024470 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 [desnacked@gmail.com: rediff for 2.6.27.7] --- Index: linux-2.6.27-gentoo-r6/arch/sparc/include/asm/reboot.h =================================================================== --- linux-2.6.27-gentoo-r6.orig/arch/sparc/include/asm/reboot.h +++ /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: linux-2.6.27-gentoo-r6/arch/sparc64/kernel/Makefile =================================================================== --- linux-2.6.27-gentoo-r6.orig/arch/sparc64/kernel/Makefile +++ linux-2.6.27-gentoo-r6/arch/sparc64/kernel/Makefile @@ -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 pci.o starfire.o \ Index: linux-2.6.27-gentoo-r6/arch/sparc64/kernel/power.c =================================================================== --- linux-2.6.27-gentoo-r6.orig/arch/sparc64/kernel/power.c +++ linux-2.6.27-gentoo-r6/arch/sparc64/kernel/power.c @@ -10,26 +10,16 @@ #include #include #include -#include #include #include #include #include -#include #include #include -#include -#include #include -/* - * sysctl - toggle power-off restriction for serial console - * systems in machine_power_off() - */ -int scons_pwroff = 1; - static void __iomem *power_reg; static irqreturn_t power_handler(int irq, void *dev_id) @@ -40,31 +30,6 @@ static irqreturn_t power_handler(int irq 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) @@ -85,8 +50,6 @@ static int __devinit power_probe(struct 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: linux-2.6.27-gentoo-r6/arch/sparc64/kernel/process.c =================================================================== --- linux-2.6.27-gentoo-r6.orig/arch/sparc64/kernel/process.c +++ linux-2.6.27-gentoo-r6/arch/sparc64/kernel/process.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -31,7 +30,6 @@ #include #include -#include #include #include #include @@ -46,8 +44,6 @@ #include #include #include -#include -#include #include #include #include @@ -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) { Index: linux-2.6.27-gentoo-r6/arch/sparc64/kernel/reboot.c =================================================================== --- /dev/null +++ linux-2.6.27-gentoo-r6/arch/sparc64/kernel/reboot.c @@ -0,0 +1,56 @@ +/* reboot.c: reboot/shutdown/halt/poweroff handling + * + * Copyright (C) 2008 David S. Miller + */ +#include +#include +#include +#include + +#include +#include +#include + +/* 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!"); +} +