Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 Use rdmsr_safe() when reading IA32_TEMPERAT...



details:   https://anonhg.NetBSD.org/src/rev/c16a9144b0c6
branches:  trunk
changeset: 769811:c16a9144b0c6
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Sat Sep 24 10:52:56 2011 +0000

description:
Use rdmsr_safe() when reading IA32_TEMPERATURE_TARGET.

diffstat:

 sys/arch/x86/x86/coretemp.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r 49dcf3e23eb5 -r c16a9144b0c6 sys/arch/x86/x86/coretemp.c
--- a/sys/arch/x86/x86/coretemp.c       Sat Sep 24 10:49:13 2011 +0000
+++ b/sys/arch/x86/x86/coretemp.c       Sat Sep 24 10:52:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: coretemp.c,v 1.26 2011/06/20 15:01:30 pgoyette Exp $ */
+/* $NetBSD: coretemp.c,v 1.27 2011/09/24 10:52:56 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.26 2011/06/20 15:01:30 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.27 2011/09/24 10:52:56 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -289,7 +289,6 @@
                }
        }
 
-#if 0
        /*
         * Attempt to get Tj(max) from IA32_TEMPERATURE_TARGET,
         * but only consider the interval [70, 100] C as valid.
@@ -297,7 +296,9 @@
         */
        if (model == 0x0E && extmodel != 0) {
 
-               msr = rdmsr(MSR_TEMPERATURE_TARGET);
+               if (rdmsr_safe(MSR_TEMPERATURE_TARGET, &msr) == EFAULT)
+                       return;
+
                msr = __SHIFTOUT(msr, MSR_TEMP_TARGET_READOUT);
 
                if (msr >= 70 && msr <= 100) {
@@ -305,7 +306,6 @@
                        return;
                }
        }
-#endif
 }
 
 static void



Home | Main Index | Thread Index | Old Index