Lines Matching +full:low +full:- +full:to +full:- +full:high
1 // SPDX-License-Identifier: GPL-2.0-only
3 * intel_tcc.c - Library for Intel TCC (thermal control circuitry) MSR access
12 * intel_tcc_get_tjmax() - returns the default TCC activation Temperature
22 u32 low, high; in intel_tcc_get_tjmax() local
26 err = rdmsr_safe(MSR_IA32_TEMPERATURE_TARGET, &low, &high); in intel_tcc_get_tjmax()
28 err = rdmsr_safe_on_cpu(cpu, MSR_IA32_TEMPERATURE_TARGET, &low, &high); in intel_tcc_get_tjmax()
32 val = (low >> 16) & 0xff; in intel_tcc_get_tjmax()
34 return val ? val : -ENODATA; in intel_tcc_get_tjmax()
39 * intel_tcc_get_offset() - returns the TCC Offset value to Tjmax
42 * Get the TCC offset value to Tjmax. The effective thermal throttling or TCC
43 * activation temperature equals "Tjmax" - "TCC Offset", in degrees C.
49 u32 low, high; in intel_tcc_get_offset() local
53 err = rdmsr_safe(MSR_IA32_TEMPERATURE_TARGET, &low, &high); in intel_tcc_get_offset()
55 err = rdmsr_safe_on_cpu(cpu, MSR_IA32_TEMPERATURE_TARGET, &low, &high); in intel_tcc_get_offset()
59 return (low >> 24) & 0x3f; in intel_tcc_get_offset()
64 * intel_tcc_set_offset() - set the TCC offset value to Tjmax
68 * Set the TCC Offset value to Tjmax. The effective thermal throttling or TCC
69 * activation temperature equals "Tjmax" - "TCC Offset", in degree C.
76 u32 low, high; in intel_tcc_set_offset() local
80 return -EINVAL; in intel_tcc_set_offset()
83 err = rdmsr_safe(MSR_IA32_TEMPERATURE_TARGET, &low, &high); in intel_tcc_set_offset()
85 err = rdmsr_safe_on_cpu(cpu, MSR_IA32_TEMPERATURE_TARGET, &low, &high); in intel_tcc_set_offset()
90 if (low & BIT(31)) in intel_tcc_set_offset()
91 return -EPERM; in intel_tcc_set_offset()
93 low &= ~(0x3f << 24); in intel_tcc_set_offset()
94 low |= offset << 24; in intel_tcc_set_offset()
97 return wrmsr_safe(MSR_IA32_TEMPERATURE_TARGET, low, high); in intel_tcc_set_offset()
99 return wrmsr_safe_on_cpu(cpu, MSR_IA32_TEMPERATURE_TARGET, low, high); in intel_tcc_set_offset()
104 * intel_tcc_get_temp() - returns the current temperature
106 * @temp: pointer to the memory for saving cpu temperature.
116 u32 low, high; in intel_tcc_get_temp() local
125 err = rdmsr_safe(msr, &low, &high); in intel_tcc_get_temp()
127 err = rdmsr_safe_on_cpu(cpu, msr, &low, &high); in intel_tcc_get_temp()
132 if (!(low & BIT(31))) in intel_tcc_get_temp()
133 return -ENODATA; in intel_tcc_get_temp()
135 *temp = tjmax - ((low >> 16) & 0x7f); in intel_tcc_get_temp()