| 1 |
|
| 2 |
|
| 3 |
#include <cpu/intel/model_206ax/model_206ax.h> |
| 4 |
#include <cpu/x86/msr.h> |
| 5 |
#include <device/device.h> |
| 6 |
#include <static_devices.h> |
| 7 |
#include <superio/ite/it8772f/chip.h> |
| 8 |
|
| 9 |
static u8 cpu_get_temp_offset(void) |
| 10 |
{ |
| 11 |
msr_t msr = rdmsr(MSR_TEMPERATURE_TARGET); |
| 12 |
u8 tj_max = (msr.lo >> 16) & 0xFF; |
| 13 |
u8 tcc_offset = (msr.lo >> 24) & 0xf; |
| 14 |
|
| 15 |
msr = rdmsr(MSR_PLATFORM_INFO); |
| 16 |
if (msr.lo & (1 << 30)) { |
| 17 |
return tj_max - tcc_offset; |
| 18 |
} else { |
| 19 |
return tj_max; |
| 20 |
} |
| 21 |
} |
| 22 |
|
| 23 |
static void mainboard_enable(struct device *dev) |
| 24 |
{ |
| 25 |
|
| 26 |
struct superio_ite_it8772f_config *const config = __pnp_002e_04->chip_info; |
| 27 |
if (config) |
| 28 |
config->ec.tmpin[2].offset = cpu_get_temp_offset(); |
| 29 |
} |
| 30 |
|
| 31 |
struct chip_operations mainboard_ops = { |
| 32 |
.enable_dev = mainboard_enable, |
| 33 |
}; |