1 /* SPDX-License-Identifier: GPL-2.0-only */
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>
9 static u8
cpu_get_temp_offset(void)
11 msr_t msr
= rdmsr(MSR_TEMPERATURE_TARGET
);
12 u8 tj_max
= (msr
.lo
>> 16) & 0xFF;
13 u8 tcc_offset
= (msr
.lo
>> 24) & 0xf;
15 msr
= rdmsr(MSR_PLATFORM_INFO
);
16 if (msr
.lo
& (1 << 30)) {
17 return tj_max
- tcc_offset
;
23 static void mainboard_enable(struct device
*dev
)
25 /* Set PECI TMPIN 3 offset to TJ_MAX temperature */
26 struct superio_ite_it8772f_config
*const config
= __pnp_002e_04
->chip_info
;
28 config
->ec
.tmpin
[2].offset
= cpu_get_temp_offset();
31 struct chip_operations mainboard_ops
= {
32 .enable_dev
= mainboard_enable
,