k8temp.c (b74b953b998bcc2db91b694446f3a2619ec32de6) k8temp.c (628b4504cf69fbe262b41c16a4a3fd61b091d61c)
1/*
2 * k8temp.c - Linux kernel module for hardware monitoring
3 *
4 * Copyright (C) 2006 Rudolf Marek <r.marek@assembler.cz>
5 *
6 * Inspired from the w83785 and amd756 drivers.
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 177 unchanged lines hidden (view full) ---

186 if (!(data = kzalloc(sizeof(struct k8temp_data), GFP_KERNEL))) {
187 err = -ENOMEM;
188 goto exit;
189 }
190
191 model = boot_cpu_data.x86_model;
192 stepping = boot_cpu_data.x86_mask;
193
1/*
2 * k8temp.c - Linux kernel module for hardware monitoring
3 *
4 * Copyright (C) 2006 Rudolf Marek <r.marek@assembler.cz>
5 *
6 * Inspired from the w83785 and amd756 drivers.
7 *
8 * This program is free software; you can redistribute it and/or modify

--- 177 unchanged lines hidden (view full) ---

186 if (!(data = kzalloc(sizeof(struct k8temp_data), GFP_KERNEL))) {
187 err = -ENOMEM;
188 goto exit;
189 }
190
191 model = boot_cpu_data.x86_model;
192 stepping = boot_cpu_data.x86_mask;
193
194 switch (boot_cpu_data.x86) {
195 case 0xf:
196 /* feature available since SH-C0, exclude older revisions */
197 if (((model == 4) && (stepping == 0)) ||
198 ((model == 5) && (stepping <= 1))) {
199 err = -ENODEV;
200 goto exit_free;
201 }
194 /* feature available since SH-C0, exclude older revisions */
195 if (((model == 4) && (stepping == 0)) ||
196 ((model == 5) && (stepping <= 1))) {
197 err = -ENODEV;
198 goto exit_free;
199 }
202
200
203 /*
204 * AMD NPT family 0fh, i.e. RevF and RevG:
205 * meaning of SEL_CORE bit is inverted
206 */
207 if (model >= 0x40) {
208 data->swap_core_select = 1;
209 dev_warn(&pdev->dev, "Temperature readouts might be "
210 "wrong - check erratum #141\n");
211 }
212
213 if (is_rev_g_desktop(model)) {
214 /*
215 * RevG desktop CPUs (i.e. no socket S1G1 or
216 * ASB1 parts) need additional offset,
217 * otherwise reported temperature is below
218 * ambient temperature
219 */
220 data->temp_offset = 21000;
221 }
222
223 break;
201 /*
202 * AMD NPT family 0fh, i.e. RevF and RevG:
203 * meaning of SEL_CORE bit is inverted
204 */
205 if (model >= 0x40) {
206 data->swap_core_select = 1;
207 dev_warn(&pdev->dev, "Temperature readouts might be wrong - "
208 "check erratum #141\n");
224 }
225
209 }
210
211 /*
212 * RevG desktop CPUs (i.e. no socket S1G1 or ASB1 parts) need
213 * additional offset, otherwise reported temperature is below
214 * ambient temperature
215 */
216 if (is_rev_g_desktop(model))
217 data->temp_offset = 21000;
218
226 pci_read_config_byte(pdev, REG_TEMP, &scfg);
227 scfg &= ~(SEL_PLACE | SEL_CORE); /* Select sensor 0, core0 */
228 pci_write_config_byte(pdev, REG_TEMP, scfg);
229 pci_read_config_byte(pdev, REG_TEMP, &scfg);
230
231 if (scfg & (SEL_PLACE | SEL_CORE)) {
232 dev_err(&pdev->dev, "Configuration bit(s) stuck at 1!\n");
233 err = -ENODEV;

--- 130 unchanged lines hidden ---
219 pci_read_config_byte(pdev, REG_TEMP, &scfg);
220 scfg &= ~(SEL_PLACE | SEL_CORE); /* Select sensor 0, core0 */
221 pci_write_config_byte(pdev, REG_TEMP, scfg);
222 pci_read_config_byte(pdev, REG_TEMP, &scfg);
223
224 if (scfg & (SEL_PLACE | SEL_CORE)) {
225 dev_err(&pdev->dev, "Configuration bit(s) stuck at 1!\n");
226 err = -ENODEV;

--- 130 unchanged lines hidden ---