blob: c61d74e4a006306a05e9c8872c9c989864832be7 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0 */
Simon Glass780ba482016-03-11 22:06:58 -07002/*
Simon Glassb12689d2019-09-25 08:56:38 -06003 * Common code for Intel CPUs
4 *
Simon Glass780ba482016-03-11 22:06:58 -07005 * Copyright (c) 2016 Google, Inc
Simon Glass780ba482016-03-11 22:06:58 -07006 */
7
8#ifndef __ASM_CPU_COMMON_H
9#define __ASM_CPU_COMMON_H
10
Simon Glass4347d832019-09-25 08:56:37 -060011/* Standard Intel bus clock is fixed at 100MHz */
12enum {
13 INTEL_BCLK_MHZ = 100
14};
15
Simon Glassaba3c602019-09-25 08:11:35 -060016struct cpu_info;
17
Simon Glass780ba482016-03-11 22:06:58 -070018/**
19 * cpu_common_init() - Set up common CPU init
20 *
21 * This reports BIST failure, enables the LAPIC, updates microcode, enables
22 * the upper 128-bytes of CROM RAM, probes the northbridge, PCH, LPC and SATA.
23 *
24 * @return 0 if OK, -ve on error
25 */
26int cpu_common_init(void);
27
28/**
29 * cpu_set_flex_ratio_to_tdp_nominal() - Set up the maximum non-turbo rate
30 *
31 * If a change is needed, this function will do a soft reset so it takes
32 * effect.
33 *
34 * Some details are available here:
35 * http://forum.hwbot.org/showthread.php?t=76092
36 *
37 * @return 0 if OK, -ve on error
38 */
39int cpu_set_flex_ratio_to_tdp_nominal(void);
40
Simon Glassaba3c602019-09-25 08:11:35 -060041/**
42 * cpu_intel_get_info() - Obtain CPU info for Intel CPUs
43 *
44 * Most Intel CPUs use the same MSR to obtain the clock speed, and use the same
45 * features. This function fills in these values, given the value of the base
46 * clock in MHz (typically this should be set to 100).
47 *
48 * @info: cpu_info struct to fill in
49 * @bclk_mz: the base clock in MHz
50 *
51 * @return 0 always
52 */
53int cpu_intel_get_info(struct cpu_info *info, int bclk_mz);
54
Simon Glass23a6ca92019-09-25 08:56:36 -060055/**
56 * cpu_configure_thermal_target() - Set the thermal target for a CPU
57 *
58 * This looks up the tcc-offset property and uses it to set the
59 * MSR_TEMPERATURE_TARGET value.
60 *
61 * @dev: CPU device
62 * @return 0 if OK, -ENOENT if no target is given in device tree
63 */
64int cpu_configure_thermal_target(struct udevice *dev);
65
Simon Glassb12689d2019-09-25 08:56:38 -060066/**
67 * cpu_set_perf_control() - Set the nominal CPU clock speed
68 *
69 * This sets the clock speed as a multiplier of BCLK
70 *
71 * @clk_ratio: Ratio to use
72 */
73void cpu_set_perf_control(uint clk_ratio);
74
75/**
76 * cpu_config_tdp_levels() - Check for configurable TDP option
77 *
78 * @return true if the CPU has configurable TDP (Thermal-design power)
79 */
80bool cpu_config_tdp_levels(void);
81
Simon Glass780ba482016-03-11 22:06:58 -070082#endif