aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Thompson <daniel.thompson@linaro.org>2015-10-26 15:41:28 +0000
committerDaniel Thompson <daniel.thompson@linaro.org>2015-10-26 15:41:28 +0000
commitd20d430632a6a397c05c99ce9cc6df59987a3854 (patch)
treec6d99c8609088ab2f9a92b4ae8d709b3bffbf97a
parentb42d65dc575000362356165c4e66b55a73ebfaa2 (diff)
fixup! ARM: add option to flush console before reboot
-rw-r--r--arch/arm/kernel/process.c117
-rw-r--r--arch/arm/kernel/reboot.c30
2 files changed, 30 insertions, 117 deletions
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 007a7c061f72..906c781922ff 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -28,7 +28,6 @@
#include <linux/random.h>
#include <linux/hw_breakpoint.h>
#include <linux/leds.h>
-#include <linux/console.h>
#include <asm/processor.h>
#include <asm/thread_notify.h>
@@ -67,31 +66,6 @@ void arch_trigger_all_cpu_backtrace(void)
}
#endif
-#ifdef CONFIG_ARM_FLUSH_CONSOLE_ON_RESTART
-void arm_machine_flush_console(void)
-{
- printk("\n");
- pr_emerg("Restarting %s\n", linux_banner);
- if (console_trylock()) {
- console_unlock();
- return;
- }
-
- mdelay(50);
-
- local_irq_disable();
- if (!console_trylock())
- pr_emerg("arm_restart: Console was locked! Busting\n");
- else
- pr_emerg("arm_restart: Console was locked!\n");
- console_unlock();
-}
-#else
-void arm_machine_flush_console(void)
-{
-}
-#endif
-
/*
* This is our default idle handler.
*/
@@ -139,97 +113,6 @@ void arch_cpu_idle_dead(void)
#endif
/*
-<<<<<<< HEAD
-=======
- * Called by kexec, immediately prior to machine_kexec().
- *
- * This must completely disable all secondary CPUs; simply causing those CPUs
- * to execute e.g. a RAM-based pin loop is not sufficient. This allows the
- * kexec'd kernel to use any and all RAM as it sees fit, without having to
- * avoid any code or data used by any SW CPU pin loop. The CPU hotplug
- * functionality embodied in disable_nonboot_cpus() to achieve this.
- */
-void machine_shutdown(void)
-{
-#ifdef CONFIG_SMP
- /*
- * Disable preemption so we're guaranteed to
- * run to power off or reboot and prevent
- * the possibility of switching to another
- * thread that might wind up blocking on
- * one of the stopped CPUs.
- */
- preempt_disable();
-#endif
- disable_nonboot_cpus();
-}
-
-/*
- * Halting simply requires that the secondary CPUs stop performing any
- * activity (executing tasks, handling interrupts). smp_send_stop()
- * achieves this.
- */
-void machine_halt(void)
-{
- local_irq_disable();
- smp_send_stop();
-
- local_irq_disable();
- while (1);
-}
-
-/*
- * Power-off simply requires that the secondary CPUs stop performing any
- * activity (executing tasks, handling interrupts). smp_send_stop()
- * achieves this. When the system power is turned off, it will take all CPUs
- * with it.
- */
-void machine_power_off(void)
-{
- local_irq_disable();
- smp_send_stop();
-
- if (pm_power_off)
- pm_power_off();
-}
-
-/*
- * Restart requires that the secondary CPUs stop performing any activity
- * while the primary CPU resets the system. Systems with a single CPU can
- * use soft_restart() as their machine descriptor's .restart hook, since that
- * will cause the only available CPU to reset. Systems with multiple CPUs must
- * provide a HW restart implementation, to ensure that all CPUs reset at once.
- * This is required so that any code running after reset on the primary CPU
- * doesn't have to co-ordinate with other CPUs to ensure they aren't still
- * executing pre-reset code, and using RAM that the primary CPU's code wishes
- * to use. Implementing such co-ordination would be essentially impossible.
- */
-void machine_restart(char *cmd)
-{
- local_irq_disable();
- smp_send_stop();
-
-
- /* Flush the console to make sure all the relevant messages make it
- * out to the console drivers */
- arm_machine_flush_console();
-
- if (arm_pm_restart)
- arm_pm_restart(reboot_mode, cmd);
- else
- do_kernel_restart(cmd);
-
- /* Give a grace period for failure to restart of 1s */
- mdelay(1000);
-
- /* Whoops - the platform was unable to reboot. Tell the user! */
- printk("Reboot failed -- System halted\n");
- local_irq_disable();
- while (1);
-}
-
-/*
->>>>>>> ARM: add option to flush console before reboot
* dump a block of kernel memory from around the given address
*/
static void show_data(unsigned long addr, int nbytes, const char *name)
diff --git a/arch/arm/kernel/reboot.c b/arch/arm/kernel/reboot.c
index 1a4d232796be..31bc4cb7cf1f 100644
--- a/arch/arm/kernel/reboot.c
+++ b/arch/arm/kernel/reboot.c
@@ -6,6 +6,7 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
+#include <linux/console.h>
#include <linux/cpu.h>
#include <linux/delay.h>
#include <linux/reboot.h>
@@ -24,6 +25,31 @@ void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
void (*pm_power_off)(void);
EXPORT_SYMBOL(pm_power_off);
+#ifdef CONFIG_ARM_FLUSH_CONSOLE_ON_RESTART
+void arm_machine_flush_console(void)
+{
+ printk("\n");
+ pr_emerg("Restarting %s\n", linux_banner);
+ if (console_trylock()) {
+ console_unlock();
+ return;
+ }
+
+ mdelay(50);
+
+ local_irq_disable();
+ if (!console_trylock())
+ pr_emerg("arm_restart: Console was locked! Busting\n");
+ else
+ pr_emerg("arm_restart: Console was locked!\n");
+ console_unlock();
+}
+#else
+void arm_machine_flush_console(void)
+{
+}
+#endif
+
/*
* A temporary stack to use for CPU reset. This is static so that we
* don't clobber it with the identity mapping. When running with this
@@ -140,6 +166,10 @@ void machine_restart(char *cmd)
local_irq_disable();
smp_send_stop();
+ /* Flush the console to make sure all the relevant messages make it
+ * out to the console drivers */
+ arm_machine_flush_console();
+
if (arm_pm_restart)
arm_pm_restart(reboot_mode, cmd);
else