mb/google: Add OEM product names for various boards
[coreboot.git] / Documentation / drivers / dptf.md
blob1e5674c9d9bf54a5b51031279acfb92fdca5f9bd
1 # Intel DPTF implementations in coreboot
3 ## Introduction
5 Intel Dynamic Platform and Thermal Framework is a framework that can be used to
6 help regulate the thermal properties (i.e., temperature) of an Intel-based
7 computer. It does this by allowing the system designer to specify the different
8 components that can generate heat, and/or dissipate heat. Under DPTF, the
9 different components are referred to as `participants`. The different types of
10 functionality available in DPTF are specified in terms of different `policies`.
12 ## Components ("Participants")
14 The participants that can be involved in the current implementation are:
15 - CPU (monolithic from a DPTF point-of-view)
16   - Note that the CPU's internal temperature sensor is used here
17 - 1 fan
18 - Up to 4 temperature sensors (TSRs)
19 - Battery charger
21 ## Policies
23 In the current implementation, there are 3 different policies available:
25 ### Passive Policy
27 The purpose of this policy is to monitor participant temperatures and is capable
28 of controlling performance and throttling available on platform devices in order
29 to regulate the temperatures of each participant. The temperature threshold
30 points are defined by a `_PSV` ACPI object within each participant.
32 ### Critical Policy
34 The Critical Policy is used for gracefully suspending or powering off the system
35 when the temperature of participants exceeds critical threshold
36 temperatures. Suspend is effected by specifying temperatures in a `_CRT` object
37 for a participant, and poweroff is effected by specifying a temperature
38 threshold in a `_HOT` ACPI object.
40 ### Active Policy
42 This policy monitors the temperature of participants and controls fans to spin
43 at varying speeds. These speeds are defined by the platform, and will be enabled
44 depending on the various temperatures reported by participants.
46 # Note about units
48 ACPI uses unusual units for specifying various physical measurements. For
49 example, temperatures are specified in 10ths of a degree K, and time is measured
50 in tenths of a second. Those oddities are abstracted away in the DPTF library,
51 by using degrees C for temperature, milliseconds for time, mW for power, and mA
52 for current.
54 ## Differences from the static ASL files (soc/intel/common/acpi/dptf/*.asl)
56 1) TCPU had many redundant methods. The many references to \_SB.CP00._* are not
57 created anymore in recent SoCs and the ACPI spec says these are optional objects
58 anyway. The defaults that were returned by these methods were redundant (all
59 data was a 0). The following Methods were removed:
61 * _TSS
62 * _TPC
63 * _PTC
64 * _TSD
65 * _TDL
66 * _PSS
67 * _PDL
69 2) There is no more implicit inclusion of _ACn methods for TCPU (these must be
70    specified in the devicetree entries or by calling the DPTF acpigen API).
72 # ACPI Tables
74 DPTF relies on an assortment of ACPI tables to provide parameters to the DPTF
75 application. We will discuss the more important ones here.
77 1) _TRT - Thermal Relationship Table
79 This table is used when the Passive Policy is enabled, and is used to represent
80 the thermal relationships in the system that can be controlled passively (i.e.,
81 by throttling participants). A passive policy is defined by a Source (which
82 generates heat), a Target (typically a temperature sensor), a Sampling Period
83 (how often to check the temperature), an activation temperature threshold (for
84 when to begin throttling), and a relative priority.
86 2) _ART - Active Relationship Table
88 This table is used when the Active Policy is enabled, and is used to represent
89 active cooling relationships (i.e., which TSRs the fan can cool). An active
90 policy contains a Target (the device the fan can cool), a Weight to control
91 which participant needs more attention than others, and a list of temperature /
92 fan percentage pairs. The list of pairs defines the fan control percentage that
93 should be applied when the TSR reaches each successive threshold (_AC0 is the
94 highest threshold, and represents the highest fan control percentage).
96 3) PPCC - Participant Power Control Capabilities
98 This table is used to describe parameters for controlling the SoC's Running
99 Average Power Limits (RAPL, see below).
101 4) _FPS - Fan Performance States
103 This table describes the various fan speeds available for DPTF to use, along with
104 various informational properties.
106 5) PPSS - Participant Performance Supported States
108 This table describes performance states supported by a participant (typically
109 the battery charger).
111 # ACPI Methods
113 The Active and Passive policies also provide for short Methods to define
114 different kinds of temperature thresholds.
116 1) _AC0, _AC1, _AC2, _AC3, ..., _AC9
118 These Methods can provide up to 10 temperature thresholds. What these do is set
119 temperatures which act as the thresholds to active rows (fan speeds) in the
120 ART. _AC0 is intended to be the highest temperature thresholds, and the lowest
121 one can be any of them; leave the rest defined as 0 and they will be omitted
122 from the output.
124 These are optional and are enabled by selecting the Active Policy.
126 2) _PSV
128 _PSV is a temperature threshold that is used to indicate to DPTF that it should
129 begin taking passive measures (i.e., throttling of the Source) in order to
130 reduce the temperature of the Target in question. It will check on the
131 temperature according to the given sampling period.
133 This is optional and is enabled by selecting the Passive Policy.
135 3) _CRT and _HOT
137 When the temperature of the Source reaches the threshold specified in _CRT, then
138 the system is supposed to execute a "graceful suspend". Similarly, when the Source
139 reaches the temperature specified in _HOT, then the system is supposed to execute
140 a "graceful shutdown".
142 These are optional, and are enabled by selecting the Critical Policy.
144 # How to use the devicetree entries
146 The `drivers/intel/dptf` chip driver is organized into several sections:
147 - Policies
148 - Controls
149 - Options
151 The Policies section (`policies.active`, `policies.passive`, and
152 `policies.critical`) is where the components of each policy are defined.
154 ## Active Policy
156 Each Active Policy is defined in terms of 4 parts:
157 1) A Source (this is implicitly defined as TFN1, the system fan)
158 2) A Target (this is the device that can be affected by the policy, i.e.,
159    this is a device that can be cooled by the fan)
160 3) A 'Weight', which is defined as the Source's contribution to the Target's
161    cooling capability (as a percentage, 0-100, often just left at 100).
162 4) A list of temperature-fan percentage pairs, which define temperature
163    thresholds that, when the Target reaches, the fan is defined to spin
164    at the corresponding percentage of full duty cycle.
166 An example definition in the devicetree:
167 ```C
168 register "policies.active[0]" = "{
169     .target=DPTF_CPU,
170     .weight=100,
171     .thresholds={TEMP_PCT(85, 90),
172                  TEMP_PCT(80, 69),
173                  TEMP_PCT(75, 56),
174                  TEMP_PCT(70, 46),
175                  TEMP_PCT(65, 36),}}"
178 This example sets up a policy wherein the CPU temperature sensor can be cooled
179 by the fan. The 'weight' of this policy is 100% (this policy contributes 100% of
180 the CPU's active cooling capability). When the CPU temperature first crosses
181 65C, the fan is defined to spin at 36% of its duty cycle, and so forth up the
182 rest of the table (note that it *must* be defined from highest temperature/
183 percentage on down to the lowest).
185 ## Passive Policy
187 Each Passive Policy is defined in terms of 5 parts:
188 1) Source - The device that can be throttled
189 2) Target - The device that controls the amount of throttling
190 3) Period - How often to check the temperature of the Target
191 4) Trip point - What temperature threshold to start throttling
192 5) Priority - A number indicating the relative priority between different
193    Policies
195 An example definition in the devicetree:
196 ```C
197 register "policies.passive[0]" = "DPTF_PASSIVE(CHARGER, TEMP_SENSOR_1, 65, 60000)"
200 This example sets up a policy to begin throttling the charger performance when
201 temperature sensor 1 reaches 65C. The sampling period here is 60000 ms (60 s).
202 The Priority is defaulted to 100 in this case.
204 ## Critical Policy
206 Each Critical Policy is defined in terms of 3 parts:
207 1) Source - A device that can trigger a critical event
208 2) Type - What type of critical event to trigger (S4-entry or shutdown)
209 3) Temperature - The temperature threshold that will cause the entry into S4 or
210    to shutdown the system.
212 An example definition in the devicetree:
214 ```C
215 register "policies.critical[1]" = "DPTF_CRITICAL(CPU, 75, SHUTDOWN)"
218 This example sets up a policy wherein ACPI will cause the system to shutdown
219 (in a "graceful" manner) when the CPU temperature reaches 75C.
221 ## Power Limits
223 Control over the SoC's Running Average Power Limits (RAPL) is one of the tools
224 that DPTF uses to enact Passive policies. DPTF can control both PL1 and PL2, if
225 the PPCC table is provided for the TCPU object. Each power limit is given the
226 following options:
227 1) Minimum power (in mW)
228 2) Maximum power (in mW)
229 3) Minimum time window (in ms)
230 4) Maximum time window (in ms)
231 5) Granularity, or minimum step size to control limits (in mW)
233 An example:
234 ```C
235 register "controls.power_limits.pl1" = "{
236         .min_power = 3000,
237         .max_power = 15000,
238         .time_window_min = 28 * MSECS_PER_SEC,
239         .time_window_max = 32 * MSECS_PER_SEC,
240         .granularity = 200,}"
243 This example allow DPTF to control the SoC's PL1 level to between 3W and 15W,
244 over a time interval ranging from 28 to 32 seconds, and it can move PL1 in
245 increments of 200 mW.
247 ## Charger Performance
249 The battery charger can be a large contributor of unwanted heat in a system that
250 has one. Controlling the rate of charging is another tool that DPTF uses to enact
251 Passive Policies. Each entry in the PPSS table consists of:
252 1) A 'Control' value - an opaque value that the platform firmware uses
253    to initiate a transition to the specified performance state. DPTF will call an
254    ACPI method called `TCHG.SPPC` (Set Participant Performance Capability) if
255    applicable, and will pass this opaque control value as its argument.
256 2) The intended charging rate (in mA).
258 Example:
259 ```C
260 register "controls.charger_perf[0]" = "{ 255, 1700 }"
261 register "controls.charger_perf[1]" = "{  24, 1500 }"
262 register "controls.charger_perf[2]" = "{  16, 1000 }"
263 register "controls.charger_perf[3]" = "{   8,  500 }"
266 In this example, when DPTF decides to throttle the charger, it has four different
267 performance states to choose from.
269 ## Fan Performance
271 When using DPTF, the system fan (`TFN1`) is the device responsible for actively
272 cooling the other temperature sensors on the mainboard. A fan speed table can be
273 provided to DPTF to assist with fan control. Each entry holds the following:
274 1) Percentage of full duty to spin the fan at
275 2) Speed - Speed of the fan at that percentage; informational only, but given in
276    RPM
277 3) Noise - Amount of noise created by the fan at that percentage; informational
278    only, but given in tenths of a decibel (centibel).
279 4) Power - Amount of power consumed by the fan at that percentage; informational
280    only, but given in mA.
282 Example:
283 ```C
284 register "controls.fan_perf[0]" = "{  90, 6700, 220, 2200, }"
285 register "controls.fan_perf[1]" = "{  80, 5800, 180, 1800, }"
286 register "controls.fan_perf[2]" = "{  70, 5000, 145, 1450, }"
287 register "controls.fan_perf[3]" = "{  60, 4900, 115, 1150, }"
288 register "controls.fan_perf[4]" = "{  50, 3838,  90,  900, }"
289 register "controls.fan_perf[5]" = "{  40, 2904,  55,  550, }"
290 register "controls.fan_perf[6]" = "{  30, 2337,  30,  300, }"
291 register "controls.fan_perf[7]" = "{  20, 1608,  15,  150, }"
292 register "controls.fan_perf[8]" = "{  10,  800,  10,  100, }"
293 register "controls.fan_perf[9]" = "{   0,    0,   0,   50, }"
296 In this example, the fan has 10 different performance states, each in an even
297 increment of 10 percentage points. This is common when specifying fine-grained
298 control of the fan, wherein DPTF will interpolate between the percentages in the
299 table for a given temperature threshold.
301 ## Options
303 ### Fan
304 1) Fine-grained control - a boolean (see Fan Performance section above)
305 2) Step-size - Recommended minimum step size (in percentage points) to adjust
306    the fan speed when using fine-grained control (ranges from 1 - 9).
307 3) Low-speed notify - If true, the platform will issue a `Notify (0x80)` to the
308    fan device if a low fan speed is detected.
310 ### Temperature sensors
311 1) Hysteresis - The amount of hysteresis implemented in either circuitry or
312    the firmware that reads the temperature sensor (in degrees C).
313 2) Name - This name is applied to the _STR property of the sensor
315 ## OEM Variables
316 Platform vendors can define an array of OEM-specific values as OEM variables
317 to be used under DPTF policy. There are total six OEM variables available.
318 These can be used in AP policy for more specific actions. These OEM variables
319 can be defined as below mentioned example and can be used any variable between
320 [0], [1],...,[5]. Platform vendors can enable and use this for specific platform
321 by defining OEM variables macro under board variant.
323 Example:
324 ```C
325 register "oem_data.oem_variables" = "{
326    [1] = 0x6,
327    [3] = 0x1