xref: /aosp_15_r20/external/coreboot/src/soc/intel/common/block/thermal/thermal_common.c (revision b9411a12aaaa7e1e6a6fb7c5e057f44ee179a49c)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
4 #include <intelblocks/cfg.h>
5 #include <intelblocks/thermal.h>
6 
7 /* Get PCH Thermal Trip from common chip config */
get_thermal_trip_temp(void)8 uint8_t get_thermal_trip_temp(void)
9 {
10 	const struct soc_intel_common_config *common_config;
11 	common_config = chip_get_common_soc_structure();
12 
13 	return common_config->pch_thermal_trip;
14 }
15 
16 /* PCH Low Temp Threshold (LTT) */
pch_get_ltt_value(void)17 uint32_t pch_get_ltt_value(void)
18 {
19 	uint8_t thermal_config;
20 
21 	thermal_config = get_thermal_trip_temp();
22 	if (!thermal_config)
23 		thermal_config = DEFAULT_TRIP_TEMP;
24 
25 	if (thermal_config > MAX_TRIP_TEMP)
26 		die("Input PCH temp trip is higher than allowed range!");
27 
28 	return GET_LTT_VALUE(thermal_config);
29 }
30