Thu Mar 8 17:38:03 2012 UTC ()
Pull up following revision(s) (requested by nonaka):
	share/man/man4/amdtemp.4: revision 1.6
	share/man/man4/amdtemp.4: revision 1.7
	sys/arch/x86/pci/amdtemp.c: revision 1.13
Added Family 12h support.
Mention AMD Fusion.
Bump date for previous.


(riz)
diff -r1.5 -r1.5.4.1 src/share/man/man4/amdtemp.4
diff -r1.12 -r1.12.8.1 src/sys/arch/x86/pci/amdtemp.c

cvs diff -r1.5 -r1.5.4.1 src/share/man/man4/amdtemp.4 (expand / switch to unified diff)

--- src/share/man/man4/amdtemp.4 2011/08/18 20:55:21 1.5
+++ src/share/man/man4/amdtemp.4 2012/03/08 17:38:03 1.5.4.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: amdtemp.4,v 1.5 2011/08/18 20:55:21 jakllsch Exp $ 1.\" $NetBSD: amdtemp.4,v 1.5.4.1 2012/03/08 17:38:03 riz Exp $
2.\"- 2.\"-
3.\" Copyright (c) 2008 Christoph Egger 3.\" Copyright (c) 2008 Christoph Egger
4.\" All rights reserved. 4.\" All rights reserved.
5.\" 5.\"
6.\" Redistribution and use in source and binary forms, with or without 6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions 7.\" modification, are permitted provided that the following conditions
8.\" are met: 8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright 9.\" 1. Redistributions of source code must retain the above copyright
10.\" notice, this list of conditions and the following disclaimer. 10.\" notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\" notice, this list of conditions and the following disclaimer in the 12.\" notice, this list of conditions and the following disclaimer in the
13.\" documentation and/or other materials provided with the distribution. 13.\" documentation and/or other materials provided with the distribution.
14.\" 14.\"
@@ -16,49 +16,49 @@ @@ -16,49 +16,49 @@
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE. 25.\" SUCH DAMAGE.
26.\" 26.\"
27.\" $FreeBSD: src/share/man/man4/coretemp.4,v 1.4 2007/10/15 20:00:19 netchild Exp $ 27.\" $FreeBSD: src/share/man/man4/coretemp.4,v 1.4 2007/10/15 20:00:19 netchild Exp $
28.\" 28.\"
29.Dd August 18, 2011 29.Dd March 2, 2012
30.Dt AMDTEMP 4 30.Dt AMDTEMP 4
31.Os 31.Os
32.Sh NAME 32.Sh NAME
33.Nm amdtemp 33.Nm amdtemp
34.Nd AMD CPU on-die digital thermal sensor 34.Nd AMD CPU on-die digital thermal sensor
35.Sh SYNOPSIS 35.Sh SYNOPSIS
36.Cd "amdtemp* at pchb?" 36.Cd "amdtemp* at pchb?"
37.Sh DESCRIPTION 37.Sh DESCRIPTION
38The 38The
39.Nm 39.Nm
40driver provides support for the on-die digital thermal sensor present 40driver provides support for the on-die digital thermal sensor present
41on AMD K8, AMD Barcelona, AMD Phenoms, and AMD Griffin CPUs. 41on AMD K8, AMD Barcelona, AMD Phenom, AMD Griffin, and AMD Fusion CPUs.
42.Pp 42.Pp
43These sensors were officially introduced in AMD K8 Revision F processors, 43These sensors were officially introduced in AMD K8 Revision F processors,
44and provide 0.5 degC accuracy. 44and provide 0.5 degC accuracy.
45Precision was improved in Revision 45Precision was improved in Revision
46G chips, which provide two more bits for 0.25 degC steppings. 46G chips, which provide two more bits for 0.25 degC steppings.
47Each core 47Each core
48has two temperature sensors, and there are up to two cores per CPU socket. 48has two temperature sensors, and there are up to two cores per CPU socket.
49.Pp 49.Pp
50AMD Barcelona, AMD Phenom, and AMD Griffin provide 0.125 degC accuracy 50AMD Barcelona, AMD Phenom, AMD Griffin, and AMD Fusion provide 0.125 degC
51and provide one temperature sensor for each CPU socket. 51accuracy and provide one temperature sensor for each CPU socket.
52.Pp 52.Pp
53The 53The
54.Nm 54.Nm
55driver reports temperatures through the 55driver reports temperatures through the
56.Xr envsys 4 56.Xr envsys 4
57API. 57API.
58.Bl -column "Sensor " "Units" "Typical" -offset indent 58.Bl -column "Sensor " "Units" "Typical" -offset indent
59.It Sy "Sensor " Ta Sy "Units" Ta Sy "Typical Use" 59.It Sy "Sensor " Ta Sy "Units" Ta Sy "Typical Use"
60.It Li "CPUN sensor0" Ta "uK" Ta "cpuN temperature" 60.It Li "CPUN sensor0" Ta "uK" Ta "cpuN temperature"
61.El 61.El
62.Sh SEE ALSO 62.Sh SEE ALSO
63.Xr envsys 4 , 63.Xr envsys 4 ,
64.Xr envstat 8 , 64.Xr envstat 8 ,

cvs diff -r1.12 -r1.12.8.1 src/sys/arch/x86/pci/amdtemp.c (expand / switch to unified diff)

--- src/sys/arch/x86/pci/amdtemp.c 2011/07/31 22:04:07 1.12
+++ src/sys/arch/x86/pci/amdtemp.c 2012/03/08 17:38:03 1.12.8.1
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: amdtemp.c,v 1.12 2011/07/31 22:04:07 jmcneill Exp $ */ 1/* $NetBSD: amdtemp.c,v 1.12.8.1 2012/03/08 17:38:03 riz Exp $ */
2/* $OpenBSD: kate.c,v 1.2 2008/03/27 04:52:03 cnst Exp $ */ 2/* $OpenBSD: kate.c,v 1.2 2008/03/27 04:52:03 cnst Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 2008 The NetBSD Foundation, Inc. 5 * Copyright (c) 2008 The NetBSD Foundation, Inc.
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code is derived from software contributed to The NetBSD Foundation 8 * This code is derived from software contributed to The NetBSD Foundation
9 * by Christoph Egger. 9 * by Christoph Egger.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -38,27 +38,27 @@ @@ -38,27 +38,27 @@
38 * copyright notice and this permission notice appear in all copies. 38 * copyright notice and this permission notice appear in all copies.
39 * 39 *
40 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 40 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
41 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 41 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
42 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 42 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
43 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 43 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
44 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 44 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
45 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 45 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
46 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 46 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
47 */ 47 */
48 48
49 49
50#include <sys/cdefs.h> 50#include <sys/cdefs.h>
51__KERNEL_RCSID(0, "$NetBSD: amdtemp.c,v 1.12 2011/07/31 22:04:07 jmcneill Exp $ "); 51__KERNEL_RCSID(0, "$NetBSD: amdtemp.c,v 1.12.8.1 2012/03/08 17:38:03 riz Exp $ ");
52 52
53#include <sys/param.h> 53#include <sys/param.h>
54#include <sys/bus.h> 54#include <sys/bus.h>
55#include <sys/cpu.h> 55#include <sys/cpu.h>
56#include <sys/systm.h> 56#include <sys/systm.h>
57#include <sys/device.h> 57#include <sys/device.h>
58#include <sys/kmem.h> 58#include <sys/kmem.h>
59#include <sys/module.h> 59#include <sys/module.h>
60 60
61#include <machine/specialreg.h> 61#include <machine/specialreg.h>
62 62
63#include <dev/pci/pcireg.h> 63#include <dev/pci/pcireg.h>
64#include <dev/pci/pcivar.h> 64#include <dev/pci/pcivar.h>
@@ -186,27 +186,27 @@ static int @@ -186,27 +186,27 @@ static int
186amdtemp_match(device_t parent, cfdata_t match, void *aux) 186amdtemp_match(device_t parent, cfdata_t match, void *aux)
187{ 187{
188 struct pci_attach_args *pa = aux; 188 struct pci_attach_args *pa = aux;
189 pcireg_t cpu_signature; 189 pcireg_t cpu_signature;
190 uint32_t family; 190 uint32_t family;
191 191
192 if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_AMD) 192 if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_AMD)
193 return 0; 193 return 0;
194 194
195 switch (PCI_PRODUCT(pa->pa_id)) { 195 switch (PCI_PRODUCT(pa->pa_id)) {
196 case PCI_PRODUCT_AMD_AMD64_MISC: 196 case PCI_PRODUCT_AMD_AMD64_MISC:
197 case PCI_PRODUCT_AMD_AMD64_F10_MISC: 197 case PCI_PRODUCT_AMD_AMD64_F10_MISC:
198 case PCI_PRODUCT_AMD_AMD64_F11_MISC: 198 case PCI_PRODUCT_AMD_AMD64_F11_MISC:
199 case PCI_PRODUCT_AMD_F14_NB: 199 case PCI_PRODUCT_AMD_F14_NB: /* Family12h too */
200 break; 200 break;
201 default: 201 default:
202 return 0; 202 return 0;
203 } 203 }
204 204
205 cpu_signature = pci_conf_read(pa->pa_pc, 205 cpu_signature = pci_conf_read(pa->pa_pc,
206 pa->pa_tag, CPUID_FAMILY_MODEL_R); 206 pa->pa_tag, CPUID_FAMILY_MODEL_R);
207 207
208 /* This CPUID northbridge register has been introduced 208 /* This CPUID northbridge register has been introduced
209 * in Revision F */ 209 * in Revision F */
210 if (cpu_signature == 0x0) 210 if (cpu_signature == 0x0)
211 return 0; 211 return 0;
212 212
@@ -258,27 +258,28 @@ amdtemp_attach(device_t parent, device_t @@ -258,27 +258,28 @@ amdtemp_attach(device_t parent, device_t
258 sc->sc_sensor = NULL; 258 sc->sc_sensor = NULL;
259 259
260 sc->sc_pc = pa->pa_pc; 260 sc->sc_pc = pa->pa_pc;
261 sc->sc_pcitag = pa->pa_tag; 261 sc->sc_pcitag = pa->pa_tag;
262 sc->sc_adjustment = 0; 262 sc->sc_adjustment = 0;
263 263
264 switch (sc->sc_family) { 264 switch (sc->sc_family) {
265 case 0xf: /* AMD K8 NPT */ 265 case 0xf: /* AMD K8 NPT */
266 amdtemp_k8_init(sc, cpu_signature); 266 amdtemp_k8_init(sc, cpu_signature);
267 break; 267 break;
268 268
269 case 0x10: /* AMD Barcelona/Phenom */ 269 case 0x10: /* AMD Barcelona/Phenom */
270 case 0x11: /* AMD Griffin */ 270 case 0x11: /* AMD Griffin */
271 case 0x14: /* AMD Fusion */ 271 case 0x12: /* AMD Lynx/Sabine (Llano) */
 272 case 0x14: /* AMD Brazos (Ontario/Zacate/Desna) */
272 amdtemp_family10_init(sc); 273 amdtemp_family10_init(sc);
273 break; 274 break;
274 275
275 default: 276 default:
276 aprint_normal(", family 0x%x not supported\n", 277 aprint_normal(", family 0x%x not supported\n",
277 sc->sc_family); 278 sc->sc_family);
278 return; 279 return;
279 } 280 }
280 281
281 aprint_normal("\n"); 282 aprint_normal("\n");
282 283
283 if (sc->sc_adjustment != 0) 284 if (sc->sc_adjustment != 0)
284 aprint_debug_dev(self, "Workaround enabled\n"); 285 aprint_debug_dev(self, "Workaround enabled\n");
@@ -286,52 +287,54 @@ amdtemp_attach(device_t parent, device_t @@ -286,52 +287,54 @@ amdtemp_attach(device_t parent, device_t
286 sc->sc_sme = sysmon_envsys_create(); 287 sc->sc_sme = sysmon_envsys_create();
287 sc->sc_sensor_len = sizeof(envsys_data_t) * sc->sc_numsensors; 288 sc->sc_sensor_len = sizeof(envsys_data_t) * sc->sc_numsensors;
288 sc->sc_sensor = kmem_zalloc(sc->sc_sensor_len, KM_SLEEP); 289 sc->sc_sensor = kmem_zalloc(sc->sc_sensor_len, KM_SLEEP);
289 290
290 if (sc->sc_sensor == NULL) 291 if (sc->sc_sensor == NULL)
291 goto bad; 292 goto bad;
292 293
293 switch (sc->sc_family) { 294 switch (sc->sc_family) {
294 case 0xf: 295 case 0xf:
295 amdtemp_k8_setup_sensors(sc, device_unit(self)); 296 amdtemp_k8_setup_sensors(sc, device_unit(self));
296 break; 297 break;
297 case 0x10: 298 case 0x10:
298 case 0x11: 299 case 0x11:
 300 case 0x12:
299 case 0x14: 301 case 0x14:
300 amdtemp_family10_setup_sensors(sc, device_unit(self)); 302 amdtemp_family10_setup_sensors(sc, device_unit(self));
301 break; 303 break;
302 } 304 }
303 305
304 /* 306 /*
305 * Set properties in sensors. 307 * Set properties in sensors.
306 */ 308 */
307 for (i = 0; i < sc->sc_numsensors; i++) { 309 for (i = 0; i < sc->sc_numsensors; i++) {
308 if (sysmon_envsys_sensor_attach(sc->sc_sme, 310 if (sysmon_envsys_sensor_attach(sc->sc_sme,
309 &sc->sc_sensor[i])) 311 &sc->sc_sensor[i]))
310 goto bad; 312 goto bad;
311 } 313 }
312 314
313 /* 315 /*
314 * Register the sysmon_envsys device. 316 * Register the sysmon_envsys device.
315 */ 317 */
316 sc->sc_sme->sme_name = device_xname(self); 318 sc->sc_sme->sme_name = device_xname(self);
317 sc->sc_sme->sme_cookie = sc; 319 sc->sc_sme->sme_cookie = sc;
318 320
319 switch (sc->sc_family) { 321 switch (sc->sc_family) {
320 case 0xf: 322 case 0xf:
321 sc->sc_sme->sme_refresh = amdtemp_k8_refresh; 323 sc->sc_sme->sme_refresh = amdtemp_k8_refresh;
322 break; 324 break;
323 case 0x10: 325 case 0x10:
324 case 0x11: 326 case 0x11:
 327 case 0x12:
325 case 0x14: 328 case 0x14:
326 sc->sc_sme->sme_refresh = amdtemp_family10_refresh; 329 sc->sc_sme->sme_refresh = amdtemp_family10_refresh;
327 break; 330 break;
328 } 331 }
329 332
330 error = sysmon_envsys_register(sc->sc_sme); 333 error = sysmon_envsys_register(sc->sc_sme);
331 if (error) { 334 if (error) {
332 aprint_error_dev(self, "unable to register with sysmon " 335 aprint_error_dev(self, "unable to register with sysmon "
333 "(error=%d)\n", error); 336 "(error=%d)\n", error);
334 goto bad; 337 goto bad;
335 } 338 }
336 339
337 (void)pmf_device_register(self, NULL, NULL); 340 (void)pmf_device_register(self, NULL, NULL);