2 * This file is part of the coreboot project.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
15 Scope (\_SB.PCI0.MCHC)
17 Mutex (CTCM, 1) /* CTDP Switch Mutex (sync level 1) */
18 Name (CTCC, 0) /* CTDP Current Selection */
19 Name (CTCN, 0) /* CTDP Nominal Select */
20 Name (CTCD, 1) /* CTDP Down Select */
21 Name (CTCU, 2) /* CTDP Up Select */
22 Name (SPL1, 0) /* Saved PL1 value */
24 OperationRegion (MCHB, SystemMemory,
25 Add (MCH_BASE_ADDRESS, 0x5000), 0x1000)
26 Field (MCHB, DWordAcc, Lock, Preserve)
28 Offset (0x930), /* PACKAGE_POWER_SKU */
29 CTDN, 15, /* CTDP Nominal PL1 */
30 Offset (0x938), /* PACKAGE_POWER_SKU_UNIT */
31 PUNI, 4, /* Power Units */
33 EUNI, 5, /* Energy Units */
35 TUNI, 4, /* Time Units */
36 Offset (0x958), /* PLATFORM_INFO */
38 LFM_, 8, /* Maximum Efficiency Ratio (LFM) */
39 Offset (0x9a0), /* TURBO_POWER_LIMIT1 */
40 PL1V, 15, /* Power Limit 1 Value */
41 PL1E, 1, /* Power Limit 1 Enable */
42 PL1C, 1, /* Power Limit 1 Clamp */
43 PL1T, 7, /* Power Limit 1 Time */
44 Offset (0x9a4), /* TURBO_POWER_LIMIT2 */
45 PL2V, 15, /* Power Limit 2 Value */
46 PL2E, 1, /* Power Limit 2 Enable */
47 PL2C, 1, /* Power Limit 2 Clamp */
48 PL2T, 7, /* Power Limit 2 Time */
49 Offset (0xf3c), /* CONFIG_TDP_NOMINAL */
50 TARN, 8, /* CTDP Nominal Turbo Activation Ratio */
51 Offset (0xf40), /* CONFIG_TDP_LEVEL1 */
52 CTDD, 15, /* CTDP Down PL1 */
54 TARD, 8, /* CTDP Down Turbo Activation Ratio */
55 Offset (0xf48), /* MSR_CONFIG_TDP_LEVEL2 */
56 CTDU, 15, /* CTDP Up PL1 */
58 TARU, 8, /* CTDP Up Turbo Activation Ratio */
59 Offset (0xf50), /* CONFIG_TDP_CONTROL */
60 CTCS, 2, /* CTDP Select */
61 Offset (0xf54), /* TURBO_ACTIVATION_RATIO */
62 TARS, 8, /* Turbo Activation Ratio Select */
66 * Search CPU0 _PSS looking for control=arg0 and then
67 * return previous P-state entry number for new _PPC
70 * Name (_PSS, Package () {
71 * Package (6) { freq, power, tlat, blat, control, status }
74 External (\_PR.CP00._PSS)
75 Method (PSSS, 1, NotSerialized)
77 Store (One, Local0) /* Start at P1 */
78 Store (SizeOf (\_PR.CP00._PSS), Local1)
80 While (LLess (Local0, Local1)) {
81 /* Store _PSS entry Control value to Local2 */
82 ShiftRight (DeRefOf (Index (DeRefOf (Index
83 (\_PR.CP00._PSS, Local0)), 4)), 8, Local2)
84 If (LEqual (Local2, Arg0)) {
85 Return (Subtract (Local0, 1))
93 /* Calculate PL2 based on chip type */
94 Method (CPL2, 1, NotSerialized)
96 /* Haswell ULT PL2 = 25W */
97 /* FIXME: update for broadwell */
98 Return (Multiply (25, 8))
101 /* Set Config TDP Down */
102 Method (STND, 0, Serialized)
104 If (Acquire (CTCM, 100)) {
107 If (LEqual (CTCD, CTCC)) {
112 Store ("Set TDP Down", Debug)
120 /* Set PPC limit and notify OS */
121 Store (PSSS (TARD), PPCM)
125 Store (CPL2 (CTDD), PL2V)
130 /* Store the new TDP Down setting */
137 /* Set Config TDP Nominal from Down */
138 Method (STDN, 0, Serialized)
140 If (Acquire (CTCM, 100)) {
143 If (LEqual (CTCN, CTCC)) {
148 Store ("Set TDP Nominal", Debug)
154 Store (CPL2 (CTDN), PL2V)
156 /* Set PPC limit and notify OS */
157 Store (PSSS (TARN), PPCM)
166 /* Store the new TDP Nominal setting */
173 /* Calculate PL1 value based on requested TDP */
174 Method (TDPP, 1, NotSerialized)
176 Return (Multiply (ShiftLeft (Subtract (PUNI, 1), 2), Arg0))
179 /* Enable Controllable TDP to limit PL1 to requested value */
180 Method (CTLE, 1, Serialized)
182 If (Acquire (CTCM, 100)) {
186 Store ("Enable PL1 Limit", Debug)
188 /* Set _PPC to LFM */
189 Store (PSSS (LFM_), Local0)
190 Add (Local0, 1, PPCM)
193 /* Set TAR to LFM-1 */
194 Subtract (LFM_, 1, TARS)
196 /* Set PL1 to desired value */
198 Store (TDPP (Arg0), PL1V)
200 /* Set PL1 CLAMP bit */
207 /* Disable Controllable TDP */
208 Method (CTLD, 0, Serialized)
210 If (Acquire (CTCM, 100)) {
214 Store ("Disable PL1 Limit", Debug)
216 /* Clear PL1 CLAMP bit */
219 /* Set PL1 to normal value */