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 :-)
This commit is contained in:
parent
d6f5929710
commit
8a109fa3d8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=176919
@ -89,9 +89,6 @@ GLOBAL(esym)
|
||||
GLOBAL(ofmsr)
|
||||
.long 0, 0, 0, 0, 0 /* msr/sprg0-3 used in Open Firmware */
|
||||
|
||||
GLOBAL(powersave)
|
||||
.long 0
|
||||
|
||||
#define INTSTK 16384 /* 16K interrupt stack */
|
||||
#define INTRCNT_COUNT 256 /* max(HROWPIC_IRQMAX,OPENPIC_IRQMAX) */
|
||||
GLOBAL(intrnames)
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -44,6 +44,8 @@ extern vm_offset_t kstack0_phys;
|
||||
|
||||
extern u_long ns_per_tick;
|
||||
|
||||
extern int powerpc_pow_enabled;
|
||||
|
||||
#if defined(_KERNEL) || defined(_STANDALONE)
|
||||
#define CACHELINESIZE 32
|
||||
#endif
|
||||
|
@ -70,6 +70,8 @@
|
||||
#include <machine/md_var.h>
|
||||
#include <machine/spr.h>
|
||||
|
||||
int powerpc_pow_enabled;
|
||||
|
||||
struct cputab {
|
||||
const char *name;
|
||||
uint16_t version;
|
||||
@ -183,9 +185,7 @@ cpu_setup(u_int cpuid)
|
||||
/* Select DOZE mode. */
|
||||
hid0 &= ~(HID0_DOZE | HID0_NAP | HID0_SLEEP);
|
||||
hid0 |= HID0_DOZE | HID0_DPM;
|
||||
#ifdef notyet
|
||||
powersave = 1;
|
||||
#endif
|
||||
powerpc_pow_enabled = 1;
|
||||
break;
|
||||
|
||||
case MPC7448:
|
||||
@ -203,9 +203,7 @@ cpu_setup(u_int cpuid)
|
||||
/* Select NAP mode. */
|
||||
hid0 &= ~(HID0_DOZE | HID0_NAP | HID0_SLEEP);
|
||||
hid0 |= HID0_NAP | HID0_DPM;
|
||||
#ifdef notyet
|
||||
powersave = 0; /* but don't use it */
|
||||
#endif
|
||||
powerpc_pow_enabled = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user