2 * The idle loop for all SuperH platforms.
4 * Copyright (C) 2002 - 2008 Paul Mundt
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
10 #include <linux/module.h>
11 #include <linux/init.h>
14 #include <linux/tick.h>
15 #include <linux/preempt.h>
16 #include <linux/thread_info.h>
17 #include <linux/irqflags.h>
18 #include <asm/pgalloc.h>
19 #include <asm/system.h>
20 #include <asm/atomic.h>
22 static int hlt_counter;
23 void (*pm_idle)(void);
24 void (*pm_power_off)(void);
25 EXPORT_SYMBOL(pm_power_off);
27 static int __init nohlt_setup(char *__unused)
32 __setup("nohlt", nohlt_setup);
34 static int __init hlt_setup(char *__unused)
39 __setup("hlt", hlt_setup);
41 static void default_idle(void)
44 clear_thread_flag(TIF_POLLING_NRFLAG);
45 smp_mb__after_clear_bit();
47 stop_critical_timings();
49 while (!need_resched())
52 start_critical_timings();
54 set_thread_flag(TIF_POLLING_NRFLAG);
56 while (!need_resched())
62 set_thread_flag(TIF_POLLING_NRFLAG);
64 /* endless idle loop with no priority at all */
66 void (*idle)(void) = pm_idle;
71 tick_nohz_stop_sched_tick(1);
72 while (!need_resched())
74 tick_nohz_restart_sched_tick();
76 preempt_enable_no_resched();