hwmon: (k8temp) Warn about fam F rev F errata

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, January 15, 2009 - 7:02 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=bb9a35...
Commit:     bb9a35f293a3c8b5d57253cdfe2f29fa2627e1b9
Parent:     5393f780277165f282a37ed82dd878159ec9dad5
Author:     Andreas Herrmann <andreas.herrmann3@amd.com>
AuthorDate: Thu Jan 15 22:27:46 2009 +0100
Committer:  Jean Delvare <khali@linux-fr.org>
CommitDate: Thu Jan 15 22:27:46 2009 +0100

    hwmon: (k8temp) Warn about fam F rev F errata
    
    Add warning about wrong CPU temperature readouts on all fam F rev F.
    
    The allowed combinations of processors ensure that all processors
    in a multisocket system have similar characteristics, e.g.
    
    (1) provide temperature sensor interface (>=RevC && <RevF)
    (2) are affected by erratum #141 (>=RevF)
    
    Thus it is sufficient to check the revision of the boot CPU.
    
    For "mixed silicon support" refer to
    "Revision Guide for AMD Athlon 64 and AMD Opteron Processors" (RevA-E) and
    "Revision Guide for AMD NPT Family 0Fh Processors" (RefF-G).
    
    Cc: Rudolf Marek <r.marek@assembler.cz>
    Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
    Signed-off-by: Jean Delvare <khali@linux-fr.org>
---
 drivers/hwmon/k8temp.c |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/drivers/hwmon/k8temp.c b/drivers/hwmon/k8temp.c
index bd2bde0..ca56f2e 100644
--- a/drivers/hwmon/k8temp.c
+++ b/drivers/hwmon/k8temp.c
@@ -31,6 +31,7 @@
 #include <linux/hwmon-sysfs.h>
 #include <linux/err.h>
 #include <linux/mutex.h>
+#include <asm/processor.h>
 
 #define TEMP_FROM_REG(val)	(((((val) >> 16) & 0xff) - 49) * 1000)
 #define REG_TEMP	0xe4
@@ -141,20 +142,34 @@ static int __devinit k8temp_probe(struct pci_dev *pdev,
 	int err;
 	u8 scfg;
 	u32 temp;
+	u8 model, stepping;
 	struct k8temp_data *data;
-	u32 cpuid = cpuid_eax(1);
-
-	/* this feature should be available since SH-C0 core */
-	if ((cpuid == 0xf40) || (cpuid == 0xf50) || (cpuid == 0xf51)) {
-		err = -ENODEV;
-		goto exit;
-	}
 
 	if (!(data = kzalloc(sizeof(struct k8temp_data), GFP_KERNEL))) {
 		err = -ENOMEM;
 		goto exit;
 	}
 
+	model = boot_cpu_data.x86_model;
+	stepping = boot_cpu_data.x86_mask;
+
+	switch (boot_cpu_data.x86) {
+	case 0xf:
+		/* feature available since SH-C0, exclude older revisions */
+		if (((model == 4) && (stepping == 0)) ||
+		    ((model == 5) && (stepping <= 1))) {
+			err = -ENODEV;
+			goto exit_free;
+		}
+
+		if (model >= 0x40) {
+			dev_warn(&pdev->dev, "Temperature readouts might be "
+				 "wrong - check erratum #141\n");
+		}
+
+		break;
+	}
+
 	pci_read_config_byte(pdev, REG_TEMP, &scfg);
 	scfg &= ~(SEL_PLACE | SEL_CORE);		/* Select sensor 0, core0 */
 	pci_write_config_byte(pdev, REG_TEMP, scfg);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
hwmon: (k8temp) Warn about fam F rev F errata, Linux Kernel Mailing ..., (Thu Jan 15, 7:02 pm)