aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorWu Zhangjin <wuzhangjin@gmail.com>2010-01-27 09:39:46 -0500
committerRalf Baechle <ralf@linux-mips.org>2010-02-27 06:53:17 -0500
commitfc48c41af81b953578a54f80ad07d2f1efa81378 (patch)
treeef93c5ecfbd419ef835e14f44d10f20f9d4d3952 /arch/mips
parente52dd9fc6b9e0c17b220bd38371ff15032a1a155 (diff)
MIPS: Loongson: Cleanup the halt and poweroff action
In the old source code, I have let halt and poweroff do the same action, but in reality, they have different meanings. As the manpage of shutdown shows: -r Reboot after shutdown. -H Halt action is to halt or drop into boot monitor on systems that support it. -P Halt action is to turn off the power. and in the real world, some machines(e.g. NAS) did not provide a power button and the shutdown works as reset, so, we need to provide a mechanism to let the users turn off the power safely without breaking the system, such a mechanism is "halt", which only put the system into a dead loop or a power-save mode and print some information to the screen to tell the users to turn off the power safely. $ shutdown -hH now /* loongson_halt, not turn off the power */ $ shutdown -hP now /* loongson_poweroff, work as poweroff */ Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com> Tested-by: Liu Shiwei <liushiwei@gmail.com> Cc: Liu Shiwei <liushiwei@gmail.com> Cc: linux-mips <linux-mips@linux-mips.org> Patchwork: http://patchwork.linux-mips.org/patch/883/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/loongson/common/reset.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/arch/mips/loongson/common/reset.c b/arch/mips/loongson/common/reset.c
index 33dff188b4de..4bd9c18b07a5 100644
--- a/arch/mips/loongson/common/reset.c
+++ b/arch/mips/loongson/common/reset.c
@@ -25,17 +25,26 @@ static void loongson_restart(char *command)
25 ((void (*)(void))ioremap_nocache(LOONGSON_BOOT_BASE, 4)) (); 25 ((void (*)(void))ioremap_nocache(LOONGSON_BOOT_BASE, 4)) ();
26} 26}
27 27
28static void loongson_halt(void) 28static void loongson_poweroff(void)
29{ 29{
30 mach_prepare_shutdown(); 30 mach_prepare_shutdown();
31 unreachable(); 31 unreachable();
32} 32}
33 33
34static void loongson_halt(void)
35{
36 pr_notice("\n\n** You can safely turn off the power now **\n\n");
37 while (1) {
38 if (cpu_wait)
39 cpu_wait();
40 }
41}
42
34static int __init mips_reboot_setup(void) 43static int __init mips_reboot_setup(void)
35{ 44{
36 _machine_restart = loongson_restart; 45 _machine_restart = loongson_restart;
37 _machine_halt = loongson_halt; 46 _machine_halt = loongson_halt;
38 pm_power_off = loongson_halt; 47 pm_power_off = loongson_poweroff;
39 48
40 return 0; 49 return 0;
41} 50}