diff options
author | Robin Holt <holt@sgi.com> | 2013-07-08 19:01:42 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-09 13:33:29 -0400 |
commit | 1b3a5d02ee070c8f9943333b9b6370f486601e0f (patch) | |
tree | 0630bd988dc285ca3af7d3520826b5f0d9e42748 /kernel/reboot.c | |
parent | 7b6d864b48d95e6ea1df7df64475b9cb9616dcf9 (diff) |
reboot: move arch/x86 reboot= handling to generic kernel
Merge together the unicore32, arm, and x86 reboot= command line
parameter handling.
Signed-off-by: Robin Holt <holt@sgi.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Russ Anderson <rja@sgi.com>
Cc: Robin Holt <holt@sgi.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/reboot.c')
-rw-r--r-- | kernel/reboot.c | 76 |
1 files changed, 75 insertions, 1 deletions
diff --git a/kernel/reboot.c b/kernel/reboot.c index abb6a0483716..269ed9384cc4 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #define pr_fmt(fmt) "reboot: " fmt | 7 | #define pr_fmt(fmt) "reboot: " fmt |
8 | 8 | ||
9 | #include <linux/ctype.h> | ||
9 | #include <linux/export.h> | 10 | #include <linux/export.h> |
10 | #include <linux/kexec.h> | 11 | #include <linux/kexec.h> |
11 | #include <linux/kmod.h> | 12 | #include <linux/kmod.h> |
@@ -24,6 +25,18 @@ int C_A_D = 1; | |||
24 | struct pid *cad_pid; | 25 | struct pid *cad_pid; |
25 | EXPORT_SYMBOL(cad_pid); | 26 | EXPORT_SYMBOL(cad_pid); |
26 | 27 | ||
28 | #if defined(CONFIG_ARM) || defined(CONFIG_UNICORE32) | ||
29 | #define DEFAULT_REBOOT_MODE = REBOOT_HARD | ||
30 | #else | ||
31 | #define DEFAULT_REBOOT_MODE | ||
32 | #endif | ||
33 | enum reboot_mode reboot_mode DEFAULT_REBOOT_MODE; | ||
34 | |||
35 | int reboot_default; | ||
36 | int reboot_cpu; | ||
37 | enum reboot_type reboot_type = BOOT_ACPI; | ||
38 | int reboot_force; | ||
39 | |||
27 | /* | 40 | /* |
28 | * If set, this is used for preparing the system to power off. | 41 | * If set, this is used for preparing the system to power off. |
29 | */ | 42 | */ |
@@ -87,7 +100,7 @@ EXPORT_SYMBOL(unregister_reboot_notifier); | |||
87 | static void migrate_to_reboot_cpu(void) | 100 | static void migrate_to_reboot_cpu(void) |
88 | { | 101 | { |
89 | /* The boot cpu is always logical cpu 0 */ | 102 | /* The boot cpu is always logical cpu 0 */ |
90 | int cpu = 0; | 103 | int cpu = reboot_cpu; |
91 | 104 | ||
92 | cpu_hotplug_disable(); | 105 | cpu_hotplug_disable(); |
93 | 106 | ||
@@ -343,3 +356,64 @@ int orderly_poweroff(bool force) | |||
343 | return 0; | 356 | return 0; |
344 | } | 357 | } |
345 | EXPORT_SYMBOL_GPL(orderly_poweroff); | 358 | EXPORT_SYMBOL_GPL(orderly_poweroff); |
359 | |||
360 | static int __init reboot_setup(char *str) | ||
361 | { | ||
362 | for (;;) { | ||
363 | /* | ||
364 | * Having anything passed on the command line via | ||
365 | * reboot= will cause us to disable DMI checking | ||
366 | * below. | ||
367 | */ | ||
368 | reboot_default = 0; | ||
369 | |||
370 | switch (*str) { | ||
371 | case 'w': | ||
372 | reboot_mode = REBOOT_WARM; | ||
373 | break; | ||
374 | |||
375 | case 'c': | ||
376 | reboot_mode = REBOOT_COLD; | ||
377 | break; | ||
378 | |||
379 | case 'h': | ||
380 | reboot_mode = REBOOT_HARD; | ||
381 | break; | ||
382 | |||
383 | case 's': | ||
384 | if (isdigit(*(str+1))) | ||
385 | reboot_cpu = simple_strtoul(str+1, NULL, 0); | ||
386 | else if (str[1] == 'm' && str[2] == 'p' && | ||
387 | isdigit(*(str+3))) | ||
388 | reboot_cpu = simple_strtoul(str+3, NULL, 0); | ||
389 | else | ||
390 | reboot_mode = REBOOT_SOFT; | ||
391 | break; | ||
392 | |||
393 | case 'g': | ||
394 | reboot_mode = REBOOT_GPIO; | ||
395 | break; | ||
396 | |||
397 | case 'b': | ||
398 | case 'a': | ||
399 | case 'k': | ||
400 | case 't': | ||
401 | case 'e': | ||
402 | case 'p': | ||
403 | reboot_type = *str; | ||
404 | break; | ||
405 | |||
406 | case 'f': | ||
407 | reboot_force = 1; | ||
408 | break; | ||
409 | } | ||
410 | |||
411 | str = strchr(str, ','); | ||
412 | if (str) | ||
413 | str++; | ||
414 | else | ||
415 | break; | ||
416 | } | ||
417 | return 1; | ||
418 | } | ||
419 | __setup("reboot=", reboot_setup); | ||