summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2005-12-09 22:54:16 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2005-12-09 22:54:16 +0000
commit21d517dcf1f270c0eec90f094e0cec77444e2261 (patch)
tree42b827e1850744a491d3894445f1f1d40e360e97 /sys
parent582161c9851cc826bdf0f5361247cc83de8b3e67 (diff)
Add hook for voltage slewing the G5.
"figure you should just commit" drahn@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/macppc/include/cpu.h4
-rw-r--r--sys/arch/macppc/macppc/cpu.c16
2 files changed, 16 insertions, 4 deletions
diff --git a/sys/arch/macppc/include/cpu.h b/sys/arch/macppc/include/cpu.h
index 88d10bfd766..440aa565d9d 100644
--- a/sys/arch/macppc/include/cpu.h
+++ b/sys/arch/macppc/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.8 2005/10/09 14:17:32 drahn Exp $ */
+/* $OpenBSD: cpu.h,v 1.9 2005/12/09 22:54:15 kettenis Exp $ */
/* $NetBSD: cpu.h,v 1.1 1996/09/30 16:34:21 ws Exp $ */
/*
@@ -51,4 +51,6 @@
extern int ppc_altivec;
+extern void (*ppc64_slew_voltage)(u_int);
+
#endif /* _MACHINE_CPU_H_ */
diff --git a/sys/arch/macppc/macppc/cpu.c b/sys/arch/macppc/macppc/cpu.c
index 1a0a7143db2..d660a340b0d 100644
--- a/sys/arch/macppc/macppc/cpu.c
+++ b/sys/arch/macppc/macppc/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.34 2005/11/26 22:40:31 kettenis Exp $ */
+/* $OpenBSD: cpu.c,v 1.35 2005/12/09 22:54:15 kettenis Exp $ */
/*
* Copyright (c) 1997 Per Fogelstrom
@@ -63,6 +63,11 @@
#define SCOMC_ADDR_MASK 0xffff0000
#define SCOMC_READ 0x00008000
+/* Frequency scaling */
+#define FREQ_FULL 0
+#define FREQ_HALF 1
+#define FREQ_QUARTER 2 /* Not supported on IBM 970FX */
+
/* Power (Tuning) Status Register */
#define PSR_CMD_RECEIVED 0x2000000000000000LL
#define PSR_CMD_COMPLETED 0x1000000000000000LL
@@ -85,6 +90,7 @@ struct cfdriver cpu_cd = {
};
void ppc64_scale_frequency(u_int);
+void (*ppc64_slew_voltage)(u_int);
int ppc64_setperf(int);
void config_l2cr(int);
@@ -164,13 +170,17 @@ ppc64_setperf(int speed)
if (ppc_curfreq == ppc_maxfreq / 2)
return (0);
- ppc64_scale_frequency(1);
+ ppc64_scale_frequency(FREQ_HALF);
+ if (ppc64_slew_voltage)
+ ppc64_slew_voltage(FREQ_HALF);
perflevel = 50;
} else {
if (ppc_curfreq == ppc_maxfreq)
return (0);
- ppc64_scale_frequency(0);
+ if (ppc64_slew_voltage)
+ ppc64_slew_voltage(FREQ_FULL);
+ ppc64_scale_frequency(FREQ_FULL);
perflevel = 100;
}