2 * Idle daemon for PowerPC. Idle daemon will handle any action
3 * that needs to be taken when the system becomes idle.
5 * Originally Written by Cort Dougan (cort@cs.nmt.edu)
7 * iSeries supported added by Mike Corrigan <mikejc@us.ibm.com>
9 * Additional shared processor, SMT, and firmware support
10 * Copyright (c) 2003 Dave Engebretsen <engebret@us.ibm.com>
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
18 #include <linux/config.h>
19 #include <linux/sched.h>
20 #include <linux/kernel.h>
21 #include <linux/smp.h>
22 #include <linux/cpu.h>
23 #include <linux/sysctl.h>
25 #include <asm/system.h>
26 #include <asm/processor.h>
27 #include <asm/cputable.h>
29 #include <asm/machdep.h>
32 extern void power4_idle(void);
34 void default_idle(void)
36 unsigned int cpu
= smp_processor_id();
37 set_thread_flag(TIF_POLLING_NRFLAG
);
40 if (!need_resched()) {
41 while (!need_resched() && !cpu_is_offline(cpu
)) {
45 * Go into low thread priority and possibly
56 preempt_enable_no_resched();
59 if (cpu_is_offline(cpu
) && system_state
== SYSTEM_RUNNING
)
64 void native_idle(void)
74 preempt_enable_no_resched();
79 if (cpu_is_offline(smp_processor_id()) &&
80 system_state
== SYSTEM_RUNNING
)
87 BUG_ON(NULL
== ppc_md
.idle_loop
);
95 * Register the sysctl to set/clear powersave_nap.
97 static ctl_table powersave_nap_ctl_table
[]={
99 .ctl_name
= KERN_PPC_POWERSAVE_NAP
,
100 .procname
= "powersave-nap",
101 .data
= &powersave_nap
,
102 .maxlen
= sizeof(int),
104 .proc_handler
= &proc_dointvec
,
108 static ctl_table powersave_nap_sysctl_root
[] = {
109 { 1, "kernel", NULL
, 0, 0755, powersave_nap_ctl_table
, },
114 register_powersave_nap_sysctl(void)
116 register_sysctl_table(powersave_nap_sysctl_root
, 0);
120 __initcall(register_powersave_nap_sysctl
);