summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDimitry Andric <dim@cvs.openbsd.org>2006-12-22 01:34:47 +0000
committerDimitry Andric <dim@cvs.openbsd.org>2006-12-22 01:34:47 +0000
commite3a227a7693a067a3225cbd8d3344760c702b368 (patch)
tree6f87bbb80aa585460b5fb0a5e17cb6a0a8004f87 /sys
parent73759dab8545655ee7a35dfd41bcfc6eaa617b8b (diff)
A more complete fix for perf status MSR's (on e.g. Core 2 Duo X6800),
that specify equal highest and lowest clock ratios. EST is now silently disabled on these, as was already done for lowest clock ratios that are zero (on e.g. a bunch of Pentium 4's). Other weird MSR's are still reported, because we first want to know about them, before we decide how to handle them.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/i386/i386/est.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/sys/arch/i386/i386/est.c b/sys/arch/i386/i386/est.c
index 51474a989aa..3ed13d6bcf0 100644
--- a/sys/arch/i386/i386/est.c
+++ b/sys/arch/i386/i386/est.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: est.c,v 1.26 2006/12/21 22:31:07 dim Exp $ */
+/* $OpenBSD: est.c,v 1.27 2006/12/22 01:34:46 dim Exp $ */
/*
* Copyright (c) 2003 Michael Eriksson.
* All rights reserved.
@@ -961,8 +961,9 @@ void
est_init(const char *cpu_device, int vendor)
{
int i, mhz, mv, low, high;
- u_int16_t idhi, idlo, cur;
u_int64_t msr;
+ u_int16_t idhi, idlo, cur;
+ u_int8_t crhi, crlo, crcur;
const struct fqlist *fql;
if (setperf_prio > 3)
@@ -980,16 +981,25 @@ est_init(const char *cpu_device, int vendor)
idhi = (msr >> 32) & 0xffff;
idlo = (msr >> 48) & 0xffff;
cur = msr & 0xffff;
- if (idlo == 0) {
+ crhi = (idhi >> 8) & 0xff;
+ crlo = (idlo >> 8) & 0xff;
+ crcur = (cur >> 8) & 0xff;
+ if (crlo == 0 || crhi == crlo) {
/*
- * Don't complain about this case. It seems to happen
- * on all Pentium 4's that report EST.
+ * Don't complain about these cases, and silently disable EST:
+ * - A lowest clock ratio of 0, which seems to happen on all
+ * Pentium 4's that report EST.
+ * - An equal highest and lowest clock ratio, which happens on
+ * at least the Core 2 Duo X6800, maybe on newer models too.
*/
return;
}
- if (idhi == 0 || cur == 0 ||
- ((cur >> 8) & 0xff) < ((idlo >> 8) & 0xff) ||
- ((cur >> 8) & 0xff) > ((idhi >> 8) & 0xff)) {
+ if (crhi == 0 || crcur == 0 || crlo > crhi ||
+ crcur < crlo || crcur > crhi) {
+ /*
+ * Do complain about other weirdness, because we first want to
+ * know about it, before we decide what to do with it.
+ */
printf("%s: EST: strange msr value 0x%016llx\n",
cpu_device, msr);
return;
@@ -1049,10 +1059,6 @@ est_init(const char *cpu_device, int vendor)
}
low = MSR2MHZ(est_fqlist->table[est_fqlist->n - 1], bus_clock);
high = MSR2MHZ(est_fqlist->table[0], bus_clock);
- if (low == high) {
- printf(": high and low speed are the same, disabling EST\n");
- return;
- }
perflevel = (mhz - low) * 100 / (high - low);
/*