View | Details | Raw Unified | Return to bug 152792
Collapse All | Expand All

(-)b/sys/dev/acpica/acpi_thermal.c (-3 lines)
Lines 54-62 __FBSDID("$FreeBSD: src/sys/dev/acpica/acpi_thermal.c,v 1.74 2010/06/11 19:27:21 Link Here
54
#define _COMPONENT	ACPI_THERMAL
54
#define _COMPONENT	ACPI_THERMAL
55
ACPI_MODULE_NAME("THERMAL")
55
ACPI_MODULE_NAME("THERMAL")
56
56
57
#define TZ_ZEROC	2732
58
#define TZ_KELVTOC(x)	(((x) - TZ_ZEROC) / 10), abs(((x) - TZ_ZEROC) % 10)
59
60
#define TZ_NOTIFY_TEMPERATURE	0x80 /* Temperature changed. */
57
#define TZ_NOTIFY_TEMPERATURE	0x80 /* Temperature changed. */
61
#define TZ_NOTIFY_LEVELS	0x81 /* Cooling levels changed. */
58
#define TZ_NOTIFY_LEVELS	0x81 /* Cooling levels changed. */
62
#define TZ_NOTIFY_DEVICES	0x82 /* Device lists changed. */
59
#define TZ_NOTIFY_DEVICES	0x82 /* Device lists changed. */
(-)b/sys/dev/amdtemp/amdtemp.c (-4 / +2 lines)
Lines 433-440 amdtemp_sysctl(SYSCTL_HANDLER_ARGS) Link Here
433
	return (error);
433
	return (error);
434
}
434
}
435
435
436
#define	AMDTEMP_ZERO_C_TO_K	2732
437
438
static int32_t
436
static int32_t
439
amdtemp_gettemp0f(device_t dev, amdsensor_t sensor)
437
amdtemp_gettemp0f(device_t dev, amdsensor_t sensor)
440
{
438
{
Lines 468-474 amdtemp_gettemp0f(device_t dev, amdsensor_t sensor) Link Here
468
	pci_write_config(dev, AMDTEMP_THERMTP_STAT, cfg | sel, 1);
466
	pci_write_config(dev, AMDTEMP_THERMTP_STAT, cfg | sel, 1);
469
467
470
	/* CurTmp starts from -49C. */
468
	/* CurTmp starts from -49C. */
471
	offset = AMDTEMP_ZERO_C_TO_K - 490;
469
	offset = TZ_ZEROC - 490;
472
470
473
	/* Adjust offset if DiodeOffset is set and valid. */
471
	/* Adjust offset if DiodeOffset is set and valid. */
474
	temp = pci_read_config(dev, AMDTEMP_THERMTP_STAT, 4);
472
	temp = pci_read_config(dev, AMDTEMP_THERMTP_STAT, 4);
Lines 497-503 amdtemp_gettemp(device_t dev, amdsensor_t sensor) Link Here
497
	int32_t diode_offset, offset;
495
	int32_t diode_offset, offset;
498
496
499
	/* CurTmp starts from 0C. */
497
	/* CurTmp starts from 0C. */
500
	offset = AMDTEMP_ZERO_C_TO_K;
498
	offset = TZ_ZEROC;
501
499
502
	/* Adjust offset if DiodeOffset is set and valid. */
500
	/* Adjust offset if DiodeOffset is set and valid. */
503
	temp = pci_read_config(dev, AMDTEMP_THERMTP_STAT, 4);
501
	temp = pci_read_config(dev, AMDTEMP_THERMTP_STAT, 4);
(-)b/sys/dev/coretemp/coretemp.c (-3 / +1 lines)
Lines 48-55 __FBSDID("$FreeBSD: src/sys/dev/coretemp/coretemp.c,v 1.12 2010/08/04 00:25:13 d Link Here
48
#include <machine/cputypes.h>
48
#include <machine/cputypes.h>
49
#include <machine/md_var.h>
49
#include <machine/md_var.h>
50
50
51
#define	TZ_ZEROC	2732
52
53
struct coretemp_softc {
51
struct coretemp_softc {
54
	device_t	sc_dev;
52
	device_t	sc_dev;
55
	int		sc_tjmax;
53
	int		sc_tjmax;
Lines 331-337 coretemp_get_temp_sysctl(SYSCTL_HANDLER_ARGS) Link Here
331
	device_t dev = (device_t) arg1;
329
	device_t dev = (device_t) arg1;
332
	int temp;
330
	int temp;
333
331
334
	temp = coretemp_get_temp(dev) * 10 + TZ_ZEROC;
332
	temp = TZ_CEL_TO_KEL(coretemp_get_temp(dev));
335
333
336
	return (sysctl_handle_int(oidp, &temp, 0, req));
334
	return (sysctl_handle_int(oidp, &temp, 0, req));
337
}
335
}
(-)b/sys/sys/sysctl.h (+13 lines)
Lines 114-119 struct ctlname { Link Here
114
 */
114
 */
115
#define CTL_AUTO_START	0x100
115
#define CTL_AUTO_START	0x100
116
116
117
/*
118
 * Conversion between Celsius and Kelvin, for drivers that want to
119
 * display a temperature reading through a sysctl. The IK sysctl format
120
 * expects a value that's converted into multiples of 0.1 degrees Kelvin,
121
 * so one multiplies a celsius reading by 10 and adds TZ_ZEROC to get the
122
 * correct value.
123
 */
124
#define TZ_ZEROC		2732
125
#define TZ_CTOKELV(x)		((x) * 10 + TZ_ZEROC)
126
#define TZ_KELVTOC_INT(x)	(((x) - TZ_ZEROC) / 10)
127
#define TZ_KELVTOC_FRAC(x)	abs(((x) - TZ_ZEROC) % 10)
128
#define TZ_KELVTOC(x)		TZ_KELVTOC_INT(x), TZ_KELVTOC_FRAC(x)
129
117
#ifdef _KERNEL
130
#ifdef _KERNEL
118
#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \
131
#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, int arg2, \
119
	struct sysctl_req *req
132
	struct sysctl_req *req

Return to bug 152792