hwmon: (coretemp) Get TjMax value from MSR
Subsystems (2)
PATCH 2/2 hwmon: (coretemp) Get TjMax value from MSR
The MSR IA32_TEMPERATURE_TARGET contains the TjMax value after the i series processers.
--- drivers/hwmon/coretemp.c | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 45 insertions(+), 1 deletions(-)
drivers/hwmon/coretemp.c +45 -1
@@ -241,6 +241,50 @@ static int __devinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *return tjmax; } +static int __devinit get_tjmax (struct cpuinfo_x86 *c,u32 id,struct device *dev) +{ +/* The 100C is default for both mobile and non mobile CPUs */ +int err; +u32 eax, edx; +u32 val; + +/* A new feature in the i series processors, the +IA32_TEMPERATURE_TARGET contains the TjMax value */ + err =rdmsr_safe_on_cpu (id,0x1a2 , &eax, &edx); +if (err){ + printk_once(KERN_WARNING DRVNAME " : Unable to read TjMax from CPU, an" + " assumption value is used! \n"); + }else { + val = (eax >>16 ) &0xff ; +/* If the TjMax is not reasonable, an assumption value +will be used */ +if (( val >80 ) && (val <120 )){ + printk_once(KERN_WARNING DRVNAME " : The TjMax is %d\n C", val); +return val *1000 ; + } + } + +/* For the early CPUs, an approximation is given. +NOTE: the given value may not be correct. */ +switch (c->x86_model){ +case 0xe : +case 0xf : +case 0x16 : +case 0x1a : + printk_once(KERN_WARNING DRVNAME " : TjMax is assumed as 100 C! \n"); +return 100000 ; +break ; +case 0x17 : +case 0x1c :/* Atom CPUs */ +return adjust_tjmax (c, id, dev); +break ; +default : + printk_once(KERN_WARNING DRVNAME " : Your CPU is not support yet," + "using the default TjMax: 100 C.\n"); +return 100000 ; + } +} +static int __devinit coretemp_probe (struct platform_device *pdev) {struct coretemp_data *data;
@@ -283,7 +327,7 @@ static int __devinit coretemp_probe(struct platform_device *pdev) } } - data->tjmax =adjust_tjmax (c, data->id, &pdev->dev); + data->tjmax =get_tjmax (c, data->id, &pdev->dev);platform_set_drvdata (pdev, data);/* read the still undocumented IA32_TEMPERATURE_TARGET it exists
Signature · 7 lines
1.6.3.3.363.g725cf7 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [PATCH 2/2] hwmon: (coretemp) Get TjMax value from
Quoted 2 lines · Huaxu Wan
The MSR
IA32_TEMPERATURE_TARGETcontains the TjMax value after the i series processers.
[...]
Quoted 2 lines
+ printk_once(KERN_WARNING DRVNAME " : Unable to read TjMax from CPU, an"
+ " assumption value is used! \n");
[...]
Quoted 3 lines
+ } else {
+ val = (eax >> 16 ) &0xff;
+ /* If the TjMax is not reasonable, an assumption value
Hi,
I'm not a native speaker but "assumption value" doesn't seem correct to me. "assumed value" maybe? Or even better (IMHO) "default value"?
Luca
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [PATCH 2/2] hwmon: (coretemp) Get TjMax value from
In reply to Huaxu WanQuoted 5 lines · Luca Tettamanti
Hi,
I'm not a native speaker but "assumption value" doesn't seem correct to me. "assumed value" maybe? Or even better (IMHO) "default value"?
I meant the TjMax value may not be correct, the "default value" may mislead the user into thinking it is correct. I googled the "assumption value", and found they are used in some sentences, so I use them too :P
Hi Jean,
Do you have any comments on the two patches? I'll make another patch to update documents if they are accepted.
Thanks
Huaxu
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors