patch-2.4.22 linux-2.4.22/arch/ppc/kernel/idle_gen.c
Next file: linux-2.4.22/arch/ppc/kernel/indirect_pci.c
Previous file: linux-2.4.22/arch/ppc/kernel/idle_6xx.S
Back to the patch index
Back to the overall index
- Lines: 42
- Date:
2003-08-25 04:44:40.000000000 -0700
- Orig file:
linux-2.4.21/arch/ppc/kernel/idle_gen.c
- Orig date:
1969-12-31 16:00:00.000000000 -0800
diff -urN linux-2.4.21/arch/ppc/kernel/idle_gen.c linux-2.4.22/arch/ppc/kernel/idle_gen.c
@@ -0,0 +1,41 @@
+/*
+ * This is the old power_save() function from idle.c:
+ *
+ * Written by Cort Dougan (cort@cs.nmt.edu)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ */
+#include <linux/sched.h>
+#include <asm/processor.h>
+#include <asm/cputable.h>
+
+void power_save(void)
+{
+ /* Make sure the CPU has the DOZE feature set. */
+ if (!(cur_cpu_spec[smp_processor_id()]->cpu_features
+ & CPU_FTR_CAN_DOZE))
+ return;
+ /*
+ * Disable interrupts to prevent a lost wakeup
+ * when going to sleep. This is necessary even with
+ * RTLinux since we are not guaranteed an interrupt
+ * didn't come in and is waiting for a __sti() before
+ * emulating one. This way, we really do hard disable.
+ *
+ * We assume that we're sti-ed when we come in here. We
+ * are in the idle loop so if we're cli-ed then it's a bug
+ * anyway.
+ * -- Cort
+ */
+ _nmask_and_or_msr(MSR_EE, 0);
+ if (!current->need_resched) {
+ /* set the POW bit in the MSR, and enable interrupts
+ * so we wake up sometime! */
+ _nmask_and_or_msr(0, MSR_POW | MSR_EE);
+ }
+ _nmask_and_or_msr(0, MSR_EE);
+}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)