summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/aim/machdep.c
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2008-03-07 22:27:06 +0000
committermarcel <marcel@FreeBSD.org>2008-03-07 22:27:06 +0000
commit37503bed38aa9304c3b657c2bf893df779fd13ed (patch)
tree9f48ed3f05e5d512df0ddf1e6bef225e75ecc82d /sys/powerpc/aim/machdep.c
parentdf20e1735314eed9a226f7e24d8dc9de19712a24 (diff)
downloadFreeBSD-src-37503bed38aa9304c3b657c2bf893df779fd13ed.zip
FreeBSD-src-37503bed38aa9304c3b657c2bf893df779fd13ed.tar.gz
For AIM, have cpu_idle() set MSR_POW when the powerpc_pow_enabled
variable is set. On my Mac Mini this puts the CPU in NAP mode when the kernel is idle and, any technical or environmental reasons aside, avoids that I have to listen to the fan all day :-)
Diffstat (limited to 'sys/powerpc/aim/machdep.c')
-rw-r--r--sys/powerpc/aim/machdep.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/powerpc/aim/machdep.c b/sys/powerpc/aim/machdep.c
index 23c6eb2..4a70556 100644
--- a/sys/powerpc/aim/machdep.c
+++ b/sys/powerpc/aim/machdep.c
@@ -107,6 +107,7 @@ __FBSDID("$FreeBSD$");
#include <machine/cpu.h>
#include <machine/elf.h>
#include <machine/fpu.h>
+#include <machine/hid.h>
#include <machine/kdb.h>
#include <machine/md_var.h>
#include <machine/metadata.h>
@@ -737,15 +738,22 @@ cpu_halt(void)
void
cpu_idle(void)
{
- /* TODO: Insert code to halt (until next interrupt) */
+ uint32_t msr;
+
+ msr = mfmsr();
#ifdef INVARIANTS
- if ((mfmsr() & PSL_EE) != PSL_EE) {
+ if ((msr & PSL_EE) != PSL_EE) {
struct thread *td = curthread;
printf("td msr %x\n", td->td_md.md_saved_msr);
panic("ints disabled in idleproc!");
}
#endif
+ if (powerpc_pow_enabled) {
+ __asm __volatile("sync");
+ mtmsr(msr | PSL_POW);
+ isync();
+ }
}
/*
OpenPOWER on IntegriCloud