Add machdep.powerpc sysctl. Change the default value of powersave to -1

(< 0 mean no powersave available).  Enable powersave by default for
750/7400/7410 but leave if off for 7450/7455.
This commit is contained in:
matt 2002-07-16 23:04:20 +00:00
parent 21be11a8f8
commit ece8b74130
4 changed files with 18 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.16 2002/07/05 18:45:21 matt Exp $ */
/* $NetBSD: cpu.h,v 1.17 2002/07/16 23:04:20 matt Exp $ */
/*
* Copyright (C) 1999 Wolfgang Solfrank.
@ -214,7 +214,8 @@ void __syncicache(void *, size_t);
#define CPU_CACHEINFO 5
#define CPU_ALTIVEC 6
#define CPU_MODEL 7
#define CPU_MAXID 8
#define CPU_POWERSAVE 8
#define CPU_MAXID 9
#define CTL_MACHDEP_NAMES { \
{ 0, 0 }, \
@ -225,6 +226,7 @@ void __syncicache(void *, size_t);
{ "cacheinfo", CTLTYPE_STRUCT }, \
{ "altivec", CTLTYPE_INT }, \
{ "model", CTLTYPE_STRING }, \
{ "powersave", CTLTYPE_INT }, \
}
#endif /* _POWERPC_CPU_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu_subr.c,v 1.23 2002/07/05 18:45:22 matt Exp $ */
/* $NetBSD: cpu_subr.c,v 1.24 2002/07/16 23:04:21 matt Exp $ */
/*-
* Copyright (c) 2001 Matt Thomas.
@ -217,7 +217,7 @@ cpu_attach_common(struct device *self, int id)
/* Select NAP mode. */
hid0 &= ~(HID0_DOZE | HID0_NAP | HID0_SLEEP);
hid0 |= HID0_NAP | HID0_DPM;
powersave = 1;
powersave = 0; /* but don't use it */
break;
default:

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore_subr.S,v 1.3 2002/06/21 00:46:18 matt Exp $ */
/* $NetBSD: locore_subr.S,v 1.4 2002/07/16 23:04:21 matt Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -40,7 +40,7 @@
.data
GLOBAL(powersave)
.long 0
.long -1
.text
/*
@ -68,8 +68,8 @@ ASENTRY(Idle)
lis 8,_C_LABEL(powersave)@ha
lwz 9,_C_LABEL(powersave)@l(8)
or. 9,9,9
beq 1f
add. 9,9,9
ble 1f
sync
oris 3,3,PSL_POW@h /* enter power saving mode */

View File

@ -1,4 +1,4 @@
/* $NetBSD: powerpc_machdep.c,v 1.12 2002/07/05 18:45:22 matt Exp $ */
/* $NetBSD: powerpc_machdep.c,v 1.13 2002/07/16 23:04:21 matt Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -42,6 +42,9 @@
int cpu_timebase;
int cpu_printfataltraps;
#ifdef PPC_MPC6XX
extern int powersave;
#endif
/*
* Set set up registers on exec.
@ -127,6 +130,10 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
&curcpu()->ci_ci,
sizeof(curcpu()->ci_ci));
#ifdef PPC_MPC6XX
case CPU_POWERSAVE:
if (powersave < 0)
return sysctl_rdint(oldp, oldlenp, newp, powersave);
return sysctl_int(oldp, oldlenp, newp, newlen, &powersave);
case CPU_ALTIVEC:
return sysctl_rdint(oldp, oldlenp, newp, cpu_altivec);
#else