1717#include <linux/stddef.h>
1818#include <linux/unistd.h>
1919#include <linux/user.h>
20- #include <linux/delay.h>
21- #include <linux/reboot.h>
2220#include <linux/interrupt.h>
2321#include <linux/kallsyms.h>
2422#include <linux/init.h>
25- #include <linux/cpu.h>
2623#include <linux/elfcore.h>
2724#include <linux/pm.h>
2825#include <linux/tick.h>
3128#include <linux/random.h>
3229#include <linux/hw_breakpoint.h>
3330#include <linux/leds.h>
34- #include <linux/reboot.h>
3531
36- #include <asm/cacheflush.h>
37- #include <asm/idmap.h>
3832#include <asm/processor.h>
3933#include <asm/thread_notify.h>
4034#include <asm/stacktrace.h>
4135#include <asm/system_misc.h>
4236#include <asm/mach/time.h>
4337#include <asm/tls.h>
44- #include "reboot.h"
38+ #include <asm/vdso.h>
4539
4640#ifdef CONFIG_CC_STACKPROTECTOR
4741#include <linux/stackprotector.h>
@@ -60,74 +54,6 @@ static const char *isa_modes[] __maybe_unused = {
6054 "ARM" , "Thumb" , "Jazelle" , "ThumbEE"
6155};
6256
63- extern void call_with_stack (void (* fn )(void * ), void * arg , void * sp );
64- typedef void (* phys_reset_t )(unsigned long );
65-
66- /*
67- * A temporary stack to use for CPU reset. This is static so that we
68- * don't clobber it with the identity mapping. When running with this
69- * stack, any references to the current task *will not work* so you
70- * should really do as little as possible before jumping to your reset
71- * code.
72- */
73- static u64 soft_restart_stack [16 ];
74-
75- static void __soft_restart (void * addr )
76- {
77- phys_reset_t phys_reset ;
78-
79- /* Take out a flat memory mapping. */
80- setup_mm_for_reboot ();
81-
82- /* Clean and invalidate caches */
83- flush_cache_all ();
84-
85- /* Turn off caching */
86- cpu_proc_fin ();
87-
88- /* Push out any further dirty data, and ensure cache is empty */
89- flush_cache_all ();
90-
91- /* Switch to the identity mapping. */
92- phys_reset = (phys_reset_t )(unsigned long )virt_to_phys (cpu_reset );
93- phys_reset ((unsigned long )addr );
94-
95- /* Should never get here. */
96- BUG ();
97- }
98-
99- void _soft_restart (unsigned long addr , bool disable_l2 )
100- {
101- u64 * stack = soft_restart_stack + ARRAY_SIZE (soft_restart_stack );
102-
103- /* Disable interrupts first */
104- raw_local_irq_disable ();
105- local_fiq_disable ();
106-
107- /* Disable the L2 if we're the last man standing. */
108- if (disable_l2 )
109- outer_disable ();
110-
111- /* Change to the new stack and continue with the reset. */
112- call_with_stack (__soft_restart , (void * )addr , (void * )stack );
113-
114- /* Should never get here. */
115- BUG ();
116- }
117-
118- void soft_restart (unsigned long addr )
119- {
120- _soft_restart (addr , num_online_cpus () == 1 );
121- }
122-
123- /*
124- * Function pointers to optional machine specific functions
125- */
126- void (* pm_power_off )(void );
127- EXPORT_SYMBOL (pm_power_off );
128-
129- void (* arm_pm_restart )(enum reboot_mode reboot_mode , const char * cmd );
130-
13157/*
13258 * This is our default idle handler.
13359 */
@@ -172,79 +98,6 @@ void arch_cpu_idle_dead(void)
17298}
17399#endif
174100
175- /*
176- * Called by kexec, immediately prior to machine_kexec().
177- *
178- * This must completely disable all secondary CPUs; simply causing those CPUs
179- * to execute e.g. a RAM-based pin loop is not sufficient. This allows the
180- * kexec'd kernel to use any and all RAM as it sees fit, without having to
181- * avoid any code or data used by any SW CPU pin loop. The CPU hotplug
182- * functionality embodied in disable_nonboot_cpus() to achieve this.
183- */
184- void machine_shutdown (void )
185- {
186- disable_nonboot_cpus ();
187- }
188-
189- /*
190- * Halting simply requires that the secondary CPUs stop performing any
191- * activity (executing tasks, handling interrupts). smp_send_stop()
192- * achieves this.
193- */
194- void machine_halt (void )
195- {
196- local_irq_disable ();
197- smp_send_stop ();
198-
199- local_irq_disable ();
200- while (1 );
201- }
202-
203- /*
204- * Power-off simply requires that the secondary CPUs stop performing any
205- * activity (executing tasks, handling interrupts). smp_send_stop()
206- * achieves this. When the system power is turned off, it will take all CPUs
207- * with it.
208- */
209- void machine_power_off (void )
210- {
211- local_irq_disable ();
212- smp_send_stop ();
213-
214- if (pm_power_off )
215- pm_power_off ();
216- }
217-
218- /*
219- * Restart requires that the secondary CPUs stop performing any activity
220- * while the primary CPU resets the system. Systems with a single CPU can
221- * use soft_restart() as their machine descriptor's .restart hook, since that
222- * will cause the only available CPU to reset. Systems with multiple CPUs must
223- * provide a HW restart implementation, to ensure that all CPUs reset at once.
224- * This is required so that any code running after reset on the primary CPU
225- * doesn't have to co-ordinate with other CPUs to ensure they aren't still
226- * executing pre-reset code, and using RAM that the primary CPU's code wishes
227- * to use. Implementing such co-ordination would be essentially impossible.
228- */
229- void machine_restart (char * cmd )
230- {
231- local_irq_disable ();
232- smp_send_stop ();
233-
234- if (arm_pm_restart )
235- arm_pm_restart (reboot_mode , cmd );
236- else
237- do_kernel_restart (cmd );
238-
239- /* Give a grace period for failure to restart of 1s */
240- mdelay (1000 );
241-
242- /* Whoops - the platform was unable to reboot. Tell the user! */
243- printk ("Reboot failed -- System halted\n" );
244- local_irq_disable ();
245- while (1 );
246- }
247-
248101void __show_regs (struct pt_regs * regs )
249102{
250103 unsigned long flags ;
0 commit comments