1# Intel DPTF implementations in coreboot 2 3## Introduction 4 5Intel Dynamic Platform and Thermal Framework is a framework that can be used to 6help regulate the thermal properties (i.e., temperature) of an Intel-based 7computer. It does this by allowing the system designer to specify the different 8components that can generate heat, and/or dissipate heat. Under DPTF, the 9different components are referred to as `participants`. The different types of 10functionality available in DPTF are specified in terms of different `policies`. 11 12## Components ("Participants") 13 14The 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 20 21## Policies 22 23In the current implementation, there are 3 different policies available: 24 25### Passive Policy 26 27The purpose of this policy is to monitor participant temperatures and is capable 28of controlling performance and throttling available on platform devices in order 29to regulate the temperatures of each participant. The temperature threshold 30points are defined by a `_PSV` ACPI object within each participant. 31 32### Critical Policy 33 34The Critical Policy is used for gracefully suspending or powering off the system 35when the temperature of participants exceeds critical threshold 36temperatures. Suspend is effected by specifying temperatures in a `_CRT` object 37for a participant, and poweroff is effected by specifying a temperature 38threshold in a `_HOT` ACPI object. 39 40### Active Policy 41 42This policy monitors the temperature of participants and controls fans to spin 43at varying speeds. These speeds are defined by the platform, and will be enabled 44depending on the various temperatures reported by participants. 45 46## Note about units 47 48ACPI uses unusual units for specifying various physical measurements. For 49example, temperatures are specified in 10ths of a degree K, and time is measured 50in tenths of a second. Those oddities are abstracted away in the DPTF library, 51by using degrees C for temperature, milliseconds for time, mW for power, and mA 52for current. 53 54## Differences from the static ASL files (soc/intel/common/acpi/dptf/*.asl) 55 561) TCPU had many redundant methods. The many references to \_SB.CP00._* are not 57created anymore in recent SoCs and the ACPI spec says these are optional objects 58anyway. The defaults that were returned by these methods were redundant (all 59data was a 0). The following Methods were removed: 60 61* _TSS 62* _TPC 63* _PTC 64* _TSD 65* _TDL 66* _PSS 67* _PDL 68 692) 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). 71 72## ACPI Tables 73 74DPTF relies on an assortment of ACPI tables to provide parameters to the DPTF 75application. We will discuss the more important ones here. 76 771) _TRT - Thermal Relationship Table 78 79This table is used when the Passive Policy is enabled, and is used to represent 80the thermal relationships in the system that can be controlled passively (i.e., 81by throttling participants). A passive policy is defined by a Source (which 82generates heat), a Target (typically a temperature sensor), a Sampling Period 83(how often to check the temperature), an activation temperature threshold (for 84when to begin throttling), and a relative priority. 85 862) _ART - Active Relationship Table 87 88This table is used when the Active Policy is enabled, and is used to represent 89active cooling relationships (i.e., which TSRs the fan can cool). An active 90policy contains a Target (the device the fan can cool), a Weight to control 91which participant needs more attention than others, and a list of temperature / 92fan percentage pairs. The list of pairs defines the fan control percentage that 93should be applied when the TSR reaches each successive threshold (_AC0 is the 94highest threshold, and represents the highest fan control percentage). 95 963) PPCC - Participant Power Control Capabilities 97 98This table is used to describe parameters for controlling the SoC's Running 99Average Power Limits (RAPL, see below). 100 1014) _FPS - Fan Performance States 102 103This table describes the various fan speeds available for DPTF to use, along with 104various informational properties. 105 1065) PPSS - Participant Performance Supported States 107 108This table describes performance states supported by a participant (typically 109the battery charger). 110 111## ACPI Methods 112 113The Active and Passive policies also provide for short Methods to define 114different kinds of temperature thresholds. 115 1161) _AC0, _AC1, _AC2, _AC3, ..., _AC9 117 118These Methods can provide up to 10 temperature thresholds. What these do is set 119temperatures which act as the thresholds to active rows (fan speeds) in the 120ART. _AC0 is intended to be the highest temperature thresholds, and the lowest 121one can be any of them; leave the rest defined as 0 and they will be omitted 122from the output. 123 124These are optional and are enabled by selecting the Active Policy. 125 1262) _PSV 127 128_PSV is a temperature threshold that is used to indicate to DPTF that it should 129begin taking passive measures (i.e., throttling of the Source) in order to 130reduce the temperature of the Target in question. It will check on the 131temperature according to the given sampling period. 132 133This is optional and is enabled by selecting the Passive Policy. 134 1353) _CRT and _HOT 136 137When the temperature of the Source reaches the threshold specified in _CRT, then 138the system is supposed to execute a "graceful suspend". Similarly, when the Source 139reaches the temperature specified in _HOT, then the system is supposed to execute 140a "graceful shutdown". 141 142These are optional, and are enabled by selecting the Critical Policy. 143 144## How to use the devicetree entries 145 146The `drivers/intel/dptf` chip driver is organized into several sections: 147- Policies 148- Controls 149- Options 150 151The Policies section (`policies.active`, `policies.passive`, and 152`policies.critical`) is where the components of each policy are defined. 153 154### Active Policy 155 156Each Active Policy is defined in terms of 4 parts: 1571) A Source (this is implicitly defined as TFN1, the system fan) 1582) 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) 1603) 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). 1624) 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. 165 166An example definition in the devicetree: 167```C 168register "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),}}" 176``` 177 178This example sets up a policy wherein the CPU temperature sensor can be cooled 179by the fan. The 'weight' of this policy is 100% (this policy contributes 100% of 180the CPU's active cooling capability). When the CPU temperature first crosses 18165C, the fan is defined to spin at 36% of its duty cycle, and so forth up the 182rest of the table (note that it *must* be defined from highest temperature/ 183percentage on down to the lowest). 184 185### Passive Policy 186 187Each Passive Policy is defined in terms of 5 parts: 1881) Source - The device that can be throttled 1892) Target - The device that controls the amount of throttling 1903) Period - How often to check the temperature of the Target 1914) Trip point - What temperature threshold to start throttling 1925) Priority - A number indicating the relative priority between different 193 Policies 194 195An example definition in the devicetree: 196```C 197register "policies.passive[0]" = "DPTF_PASSIVE(CHARGER, TEMP_SENSOR_1, 65, 60000)" 198``` 199 200This example sets up a policy to begin throttling the charger performance when 201temperature sensor 1 reaches 65C. The sampling period here is 60000 ms (60 s). 202The Priority is defaulted to 100 in this case. 203 204### Critical Policy 205 206Each Critical Policy is defined in terms of 3 parts: 2071) Source - A device that can trigger a critical event 2082) Type - What type of critical event to trigger (S4-entry or shutdown) 2093) Temperature - The temperature threshold that will cause the entry into S4 or 210 to shutdown the system. 211 212An example definition in the devicetree: 213 214```C 215register "policies.critical[1]" = "DPTF_CRITICAL(CPU, 75, SHUTDOWN)" 216``` 217 218This example sets up a policy wherein ACPI will cause the system to shutdown 219(in a "graceful" manner) when the CPU temperature reaches 75C. 220 221### Power Limits 222 223Control over the SoC's Running Average Power Limits (RAPL) is one of the tools 224that DPTF uses to enact Passive policies. DPTF can control both PL1 and PL2, if 225the PPCC table is provided for the TCPU object. Each power limit is given the 226following options: 2271) Minimum power (in mW) 2282) Maximum power (in mW) 2293) Minimum time window (in ms) 2304) Maximum time window (in ms) 2315) Granularity, or minimum step size to control limits (in mW) 232 233An example: 234```C 235register "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,}" 241``` 242 243This example allow DPTF to control the SoC's PL1 level to between 3W and 15W, 244over a time interval ranging from 28 to 32 seconds, and it can move PL1 in 245increments of 200 mW. 246 247### Charger Performance 248 249The battery charger can be a large contributor of unwanted heat in a system that 250has one. Controlling the rate of charging is another tool that DPTF uses to enact 251Passive Policies. Each entry in the PPSS table consists of: 2521) 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. 2562) The intended charging rate (in mA). 257 258Example: 259```C 260register "controls.charger_perf[0]" = "{ 255, 1700 }" 261register "controls.charger_perf[1]" = "{ 24, 1500 }" 262register "controls.charger_perf[2]" = "{ 16, 1000 }" 263register "controls.charger_perf[3]" = "{ 8, 500 }" 264``` 265 266In this example, when DPTF decides to throttle the charger, it has four different 267performance states to choose from. 268 269### Fan Performance 270 271When using DPTF, the system fan (`TFN1`) is the device responsible for actively 272cooling the other temperature sensors on the mainboard. A fan speed table can be 273provided to DPTF to assist with fan control. Each entry holds the following: 2741) Percentage of full duty to spin the fan at 2752) Speed - Speed of the fan at that percentage; informational only, but given in 276 RPM 2773) Noise - Amount of noise created by the fan at that percentage; informational 278 only, but given in tenths of a decibel (centibel). 2794) Power - Amount of power consumed by the fan at that percentage; informational 280 only, but given in mA. 281 282Example: 283```C 284register "controls.fan_perf[0]" = "{ 90, 6700, 220, 2200, }" 285register "controls.fan_perf[1]" = "{ 80, 5800, 180, 1800, }" 286register "controls.fan_perf[2]" = "{ 70, 5000, 145, 1450, }" 287register "controls.fan_perf[3]" = "{ 60, 4900, 115, 1150, }" 288register "controls.fan_perf[4]" = "{ 50, 3838, 90, 900, }" 289register "controls.fan_perf[5]" = "{ 40, 2904, 55, 550, }" 290register "controls.fan_perf[6]" = "{ 30, 2337, 30, 300, }" 291register "controls.fan_perf[7]" = "{ 20, 1608, 15, 150, }" 292register "controls.fan_perf[8]" = "{ 10, 800, 10, 100, }" 293register "controls.fan_perf[9]" = "{ 0, 0, 0, 50, }" 294``` 295 296In this example, the fan has 10 different performance states, each in an even 297increment of 10 percentage points. This is common when specifying fine-grained 298control of the fan, wherein DPTF will interpolate between the percentages in the 299table for a given temperature threshold. 300 301### Options 302 303#### Fan 3041) Fine-grained control - a boolean (see Fan Performance section above) 3052) Step-size - Recommended minimum step size (in percentage points) to adjust 306 the fan speed when using fine-grained control (ranges from 1 - 9). 3073) Low-speed notify - If true, the platform will issue a `Notify (0x80)` to the 308 fan device if a low fan speed is detected. 309 310#### Temperature sensors 3111) Hysteresis - The amount of hysteresis implemented in either circuitry or 312 the firmware that reads the temperature sensor (in degrees C). 3132) Name - This name is applied to the _STR property of the sensor 314 315### OEM Variables 316Platform vendors can define an array of OEM-specific values as OEM variables 317to be used under DPTF policy. There are total six OEM variables available. 318These can be used in AP policy for more specific actions. These OEM variables 319can 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 321by defining OEM variables macro under board variant. 322 323Example: 324```C 325register "oem_data.oem_variables" = "{ 326 [1] = 0x6, 327 [3] = 0x1 328}" 329``` 330