summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgwk <gwk@openbsd.org>2006-06-13 00:36:39 +0000
committergwk <gwk@openbsd.org>2006-06-13 00:36:39 +0000
commitbfd0cd7198eb8d6fb41a830fa3b2eebaba7d52b1 (patch)
treeca8490cadeeeda0520ff3c942adf21fe6108c4fa
parentChange the value returned if the CPU fails to honor a request to (diff)
downloadwireguard-openbsd-bfd0cd7198eb8d6fb41a830fa3b2eebaba7d52b1.tar.xz
wireguard-openbsd-bfd0cd7198eb8d6fb41a830fa3b2eebaba7d52b1.zip
When adjusting the performance of the processor using p4tcc, the CPUs
frequency remains unaltered. Remove the unecessary call to update_cpuspeed(), and add check the sucess of the operation, returing EIO in the event of failure. ok tedu@
-rw-r--r--sys/arch/i386/i386/p4tcc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/arch/i386/i386/p4tcc.c b/sys/arch/i386/i386/p4tcc.c
index 5e3aff1adab..bb97531642f 100644
--- a/sys/arch/i386/i386/p4tcc.c
+++ b/sys/arch/i386/i386/p4tcc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: p4tcc.c,v 1.5 2004/06/06 17:34:37 grange Exp $ */
+/* $OpenBSD: p4tcc.c,v 1.6 2006/06/13 00:36:39 gwk Exp $ */
/*
* Copyright (c) 2003 Ted Unangst
* All rights reserved.
@@ -96,7 +96,7 @@ int
p4tcc_setperf(int level)
{
int i;
- uint64_t msreg;
+ uint64_t msreg, vet;
for (i = 0; i < TCC_LEVELS; i++) {
if (level >= tcc[i].level)
@@ -108,9 +108,12 @@ p4tcc_setperf(int level)
if (tcc[i].reg != 0) /* enable it */
msreg |= tcc[i].reg << 1 | 1 << 4;
wrmsr(MSR_THERM_CONTROL, msreg);
+ vet = rdmsr(MSR_THERM_CONTROL);
+ vet &= ~0x1e;
- if (update_cpuspeed != NULL)
- update_cpuspeed();
-
+ if (vet != msreg) {
+ printf("p4_tcc: cpu did not honor request\n");
+ return (EIO);
+ }
return (0);
}