Module Name:    src
Committed By:   msaitoh
Date:           Wed Jul 11 03:36:32 UTC 2018

Modified Files:
        src/sys/arch/x86/x86: coretemp.c

Log Message:
- Detect and set Atom's Tj(max) to 90 if it's not the 45nm D400/D500/N400
  series (90 for Diamondville and 100 for Pineview). From FreeBSD r221509.
- Reducde diff a little against FreeBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/x86/x86/coretemp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/x86/coretemp.c
diff -u src/sys/arch/x86/x86/coretemp.c:1.35 src/sys/arch/x86/x86/coretemp.c:1.36
--- src/sys/arch/x86/x86/coretemp.c:1.35	Thu Jul  7 06:55:40 2016
+++ src/sys/arch/x86/x86/coretemp.c	Wed Jul 11 03:36:32 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: coretemp.c,v 1.35 2016/07/07 06:55:40 msaitoh Exp $ */
+/* $NetBSD: coretemp.c,v 1.36 2018/07/11 03:36:32 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.35 2016/07/07 06:55:40 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coretemp.c,v 1.36 2018/07/11 03:36:32 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -265,14 +265,12 @@ coretemp_tjmax(device_t self)
 	model = CPUID_TO_MODEL(ci->ci_signature);
 	stepping = CPUID_TO_STEPPING(ci->ci_signature);
 
-	sc->sc_tjmax = 100;
-
 	/*
-	 * On some Core 2 CPUs, there is an undocumented
-	 * MSR that tells if Tj(max) is 100 or 85. Note
-	 * that MSR_IA32_EXT_CONFIG is not safe on all CPUs.
+	 * Use 100C as the initial value.
 	 */
-	if ((model == 0x0F && stepping >= 2) || (model == 0x0E)) {
+	sc->sc_tjmax = 100;
+
+	if ((model == 0x0f && stepping >= 2) || (model == 0x0e)) {
 
 		if (rdmsr_safe(MSR_IA32_EXT_CONFIG, &msr) == EFAULT)
 			return;
@@ -285,6 +283,12 @@ coretemp_tjmax(device_t self)
 		/* The mobile Penryn family. */
 		sc->sc_tjmax = 105;
 		return;
+	} else if (model == 0x1c) {
+		if (stepping == 0x0a) {
+			/* 45nm Atom D400, N400 and D500 series */
+			sc->sc_tjmax = 100;
+		} else
+			sc->sc_tjmax = 90;
 	} else {
 		/*
 		 * Attempt to get Tj(max) from IA32_TEMPERATURE_TARGET,

Reply via email to