Angel Pons | 3bd1e3d | 2020-04-05 15:47:17 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Aaron Durbin | df21440 | 2015-12-14 16:44:26 -0600 | [diff] [blame] | 2 | |
Gaggery Tsai | e1a75d4 | 2018-01-02 12:13:40 +0800 | [diff] [blame] | 3 | #include <device/pci_ids.h> |
Patrick Rudolph | e56189c | 2018-04-18 10:11:59 +0200 | [diff] [blame] | 4 | #include <device/pci_ops.h> |
Rizwan Qureshi | 1222a73 | 2016-08-23 14:31:23 +0530 | [diff] [blame] | 5 | #include <fsp/api.h> |
| 6 | #include <soc/ramstage.h> |
Aaron Durbin | df21440 | 2015-12-14 16:44:26 -0600 | [diff] [blame] | 7 | #include <soc/vr_config.h> |
Patrick Rudolph | 50aebaf8 | 2019-08-14 10:07:38 +0200 | [diff] [blame] | 8 | #include <console/console.h> |
Patrick Rudolph | 69e826d | 2019-08-14 10:23:30 +0200 | [diff] [blame] | 9 | #include <intelblocks/cpulib.h> |
Gaggery Tsai | e1a75d4 | 2018-01-02 12:13:40 +0800 | [diff] [blame] | 10 | |
Michael Niewöhner | e4c784b | 2020-03-31 00:28:57 +0200 | [diff] [blame] | 11 | /* Default values for domain configuration. */ |
Aaron Durbin | df21440 | 2015-12-14 16:44:26 -0600 | [diff] [blame] | 12 | static const struct vr_config default_configs[NUM_VR_DOMAINS] = { |
| 13 | [VR_SYSTEM_AGENT] = { |
| 14 | .vr_config_enable = 1, |
| 15 | .psi1threshold = VR_CFG_AMP(20), |
| 16 | .psi2threshold = VR_CFG_AMP(4), |
| 17 | .psi3threshold = VR_CFG_AMP(1), |
Michael Niewöhner | e4c784b | 2020-03-31 00:28:57 +0200 | [diff] [blame] | 18 | .psi3enable = 1, |
| 19 | .psi4enable = 1, |
Patrick Rudolph | b824f7d | 2019-12-09 08:56:39 +0100 | [diff] [blame] | 20 | .imon_slope = 0, |
| 21 | .imon_offset = 0, |
| 22 | .icc_max = 0, |
Aaron Durbin | df21440 | 2015-12-14 16:44:26 -0600 | [diff] [blame] | 23 | .voltage_limit = 1520, |
| 24 | }, |
| 25 | [VR_IA_CORE] = { |
| 26 | .vr_config_enable = 1, |
| 27 | .psi1threshold = VR_CFG_AMP(20), |
| 28 | .psi2threshold = VR_CFG_AMP(5), |
| 29 | .psi3threshold = VR_CFG_AMP(1), |
Michael Niewöhner | e4c784b | 2020-03-31 00:28:57 +0200 | [diff] [blame] | 30 | .psi3enable = 1, |
| 31 | .psi4enable = 1, |
Patrick Rudolph | b824f7d | 2019-12-09 08:56:39 +0100 | [diff] [blame] | 32 | .imon_slope = 0, |
| 33 | .imon_offset = 0, |
| 34 | .icc_max = 0, |
Aaron Durbin | df21440 | 2015-12-14 16:44:26 -0600 | [diff] [blame] | 35 | .voltage_limit = 1520, |
| 36 | }, |
Aaron Durbin | df21440 | 2015-12-14 16:44:26 -0600 | [diff] [blame] | 37 | [VR_GT_UNSLICED] = { |
| 38 | .vr_config_enable = 1, |
| 39 | .psi1threshold = VR_CFG_AMP(20), |
| 40 | .psi2threshold = VR_CFG_AMP(5), |
| 41 | .psi3threshold = VR_CFG_AMP(1), |
Michael Niewöhner | e4c784b | 2020-03-31 00:28:57 +0200 | [diff] [blame] | 42 | .psi3enable = 1, |
| 43 | .psi4enable = 1, |
Patrick Rudolph | b824f7d | 2019-12-09 08:56:39 +0100 | [diff] [blame] | 44 | .imon_slope = 0, |
| 45 | .imon_offset = 0, |
| 46 | .icc_max = 0, |
Aaron Durbin | df21440 | 2015-12-14 16:44:26 -0600 | [diff] [blame] | 47 | .voltage_limit = 1520, |
| 48 | }, |
| 49 | [VR_GT_SLICED] = { |
| 50 | .vr_config_enable = 1, |
| 51 | .psi1threshold = VR_CFG_AMP(20), |
| 52 | .psi2threshold = VR_CFG_AMP(5), |
| 53 | .psi3threshold = VR_CFG_AMP(1), |
Michael Niewöhner | e4c784b | 2020-03-31 00:28:57 +0200 | [diff] [blame] | 54 | .psi3enable = 1, |
| 55 | .psi4enable = 1, |
Patrick Rudolph | b824f7d | 2019-12-09 08:56:39 +0100 | [diff] [blame] | 56 | .imon_slope = 0, |
| 57 | .imon_offset = 0, |
| 58 | .icc_max = 0, |
Aaron Durbin | df21440 | 2015-12-14 16:44:26 -0600 | [diff] [blame] | 59 | .voltage_limit = 1520, |
| 60 | }, |
| 61 | }; |
| 62 | |
Patrick Rudolph | 50aebaf8 | 2019-08-14 10:07:38 +0200 | [diff] [blame] | 63 | static uint16_t get_sku_icc_max(int domain) |
Gaggery Tsai | e1a75d4 | 2018-01-02 12:13:40 +0800 | [diff] [blame] | 64 | { |
Patrick Rudolph | 69e826d | 2019-08-14 10:23:30 +0200 | [diff] [blame] | 65 | const uint16_t tdp = cpu_get_power_max(); |
| 66 | |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 67 | static uint16_t mch_id = 0, igd_id = 0; |
Patrick Rudolph | 50aebaf8 | 2019-08-14 10:07:38 +0200 | [diff] [blame] | 68 | if (!mch_id) { |
| 69 | struct device *dev = pcidev_path_on_root(SA_DEVFN_ROOT); |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 70 | mch_id = dev ? pci_read_config16(dev, PCI_DEVICE_ID) : 0xffff; |
Patrick Rudolph | 50aebaf8 | 2019-08-14 10:07:38 +0200 | [diff] [blame] | 71 | } |
| 72 | if (!igd_id) { |
| 73 | struct device *dev = pcidev_path_on_root(SA_DEVFN_IGD); |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 74 | igd_id = dev ? pci_read_config16(dev, PCI_DEVICE_ID) : 0xffff; |
Patrick Rudolph | 50aebaf8 | 2019-08-14 10:07:38 +0200 | [diff] [blame] | 75 | } |
Gaggery Tsai | e1a75d4 | 2018-01-02 12:13:40 +0800 | [diff] [blame] | 76 | |
Patrick Rudolph | 50aebaf8 | 2019-08-14 10:07:38 +0200 | [diff] [blame] | 77 | /* |
Patrick Rudolph | 69e826d | 2019-08-14 10:23:30 +0200 | [diff] [blame] | 78 | * Iccmax table from Doc #559100 Section 7.2 DC Specifications, the |
| 79 | * Iccmax is the same among KBL-Y but KBL-U/R. |
| 80 | * Addendum for AML-Y #594883, IccMax for IA core is 28A. |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 81 | * KBL-S #335195, KBL-H #335190, SKL-S #332687, SKL-H #332986, |
| 82 | * SKL-U/Y #332990 |
| 83 | * |
| 84 | * Platform Segment SA IA GT (GT/GTx) |
| 85 | * --------------------------------------------------------------------- |
| 86 | * KBL/SKL-S (95W) quad 11.1 100 45 |
| 87 | * SKL-S (80W) quad 11.1 82 45 |
| 88 | * KBL/SKL-S (65W) quad 11.1 79 45 |
| 89 | * SKL-S (45W) quad 11.1 70 0 |
| 90 | * KBL/SKL-S (35W) quad 11.1 66 35 |
| 91 | * SKL-S (25W) quad 11.1 55 35 |
| 92 | * |
| 93 | * KBL/SKL-S (54W) dual 11.1 58 48 |
| 94 | * KBL/SKL-S (51W) dual 11.1 45 48 |
| 95 | * KBL/SKL-S (35W) dual 11.1 40 48 |
| 96 | * |
| 97 | * SKL-H + OPC (65W) GT4 quad 8 74 105/24 |
| 98 | * SKL-H + OPC (45W) GT4 quad 8 74 94/20 |
| 99 | * SKL-H + OPC (35W) GT4 quad 8 66 94/20 |
| 100 | * |
| 101 | * SKL-H (35W) GT2 dual 11.1 60 55 |
| 102 | * |
| 103 | * KBL/SKL-H (45W) GT2 quad 11.1 68 55 |
| 104 | * KBL-H (18W) GT2 quad 6.6 60 55 |
| 105 | * |
| 106 | * SKL-U + OPC (28W) GT3 dual 5.1 32 57/19 |
| 107 | * SKL-U + OPC (15W) GT3 dual 5.1 29 57/19 |
| 108 | * SKL-U (15W) GT2 dual 4.5 29 31 |
| 109 | * |
Maxim Polyakov | c56ca6b | 2019-10-15 14:13:28 +0300 | [diff] [blame] | 110 | * KBL-U + OPC (28W) GT3 dual 5.1 32 57/19 |
| 111 | * KBL-U + OPC (15W) GT3 dual 5.1 32 57/19 |
| 112 | * KBL-U (15W) GT1/2 dual 4.5 32 31 |
| 113 | * KBL-U [*] (15W) GT1 quad 4.5 29 31 |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 114 | * |
| 115 | * KBL-U/R (15W) GT2 quad 6 64 31 |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 116 | * |
| 117 | * SKL/KBL-Y (6W) 4.1 24 24 |
| 118 | * SKL/KBL-Y (4.5W) 4.1 24 24 |
Maxim Polyakov | c56ca6b | 2019-10-15 14:13:28 +0300 | [diff] [blame] | 119 | * |
| 120 | * [*] Pentium/Celeron CPUs with HD Graphics 610 |
Patrick Rudolph | 69e826d | 2019-08-14 10:23:30 +0200 | [diff] [blame] | 121 | */ |
Gaggery Tsai | e1a75d4 | 2018-01-02 12:13:40 +0800 | [diff] [blame] | 122 | |
Patrick Rudolph | 50aebaf8 | 2019-08-14 10:07:38 +0200 | [diff] [blame] | 123 | switch (mch_id) { |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 124 | case PCI_DEVICE_ID_INTEL_SKL_ID_S_2: /* fallthrough */ |
Patrick Rudolph | 69e826d | 2019-08-14 10:23:30 +0200 | [diff] [blame] | 125 | case PCI_DEVICE_ID_INTEL_KBL_ID_S: { |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 126 | uint16_t icc_max[NUM_VR_DOMAINS] = VR_CFG_ALL_DOMAINS_ICC(11.1, 40, 48, 48); |
Patrick Rudolph | 69e826d | 2019-08-14 10:23:30 +0200 | [diff] [blame] | 127 | if (tdp >= 54) |
| 128 | icc_max[VR_IA_CORE] = VR_CFG_AMP(58); |
| 129 | else if (tdp >= 51) |
| 130 | icc_max[VR_IA_CORE] = VR_CFG_AMP(45); |
| 131 | |
| 132 | return icc_max[domain]; |
Patrick Rudolph | 69e826d | 2019-08-14 10:23:30 +0200 | [diff] [blame] | 133 | } |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 134 | case PCI_DEVICE_ID_INTEL_SKL_ID_S_4: /* fallthrough */ |
Patrick Rudolph | 69e826d | 2019-08-14 10:23:30 +0200 | [diff] [blame] | 135 | case PCI_DEVICE_ID_INTEL_KBL_ID_DT_2: /* fallthrough */ |
| 136 | case PCI_DEVICE_ID_INTEL_KBL_ID_DT: { |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 137 | uint16_t icc_max[NUM_VR_DOMAINS] = VR_CFG_ALL_DOMAINS_ICC(11.1, 55, 45, 45); |
Patrick Rudolph | 69e826d | 2019-08-14 10:23:30 +0200 | [diff] [blame] | 138 | if (tdp >= 91) |
| 139 | icc_max[VR_IA_CORE] = VR_CFG_AMP(100); |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 140 | else if (tdp >= 80) |
| 141 | icc_max[VR_IA_CORE] = VR_CFG_AMP(82); |
Patrick Rudolph | 69e826d | 2019-08-14 10:23:30 +0200 | [diff] [blame] | 142 | else if (tdp >= 65) |
| 143 | icc_max[VR_IA_CORE] = VR_CFG_AMP(79); |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 144 | else if (tdp >= 45) { |
| 145 | icc_max[VR_IA_CORE] = VR_CFG_AMP(70); |
| 146 | icc_max[VR_GT_SLICED] = 0; |
| 147 | icc_max[VR_GT_UNSLICED] = 0; |
| 148 | } else if (tdp >= 25) { |
| 149 | if (tdp >= 35) |
| 150 | icc_max[VR_IA_CORE] = VR_CFG_AMP(66); |
| 151 | |
Maxim Polyakov | b4383fc | 2019-08-29 16:51:37 +0300 | [diff] [blame] | 152 | icc_max[VR_GT_SLICED] = VR_CFG_AMP(35); |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 153 | icc_max[VR_GT_UNSLICED] = VR_CFG_AMP(35); |
Maxim Polyakov | b4383fc | 2019-08-29 16:51:37 +0300 | [diff] [blame] | 154 | } |
Patrick Rudolph | 69e826d | 2019-08-14 10:23:30 +0200 | [diff] [blame] | 155 | |
| 156 | return icc_max[domain]; |
| 157 | } |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 158 | case PCI_DEVICE_ID_INTEL_SKL_ID_H_4: { |
| 159 | uint16_t icc_max[NUM_VR_DOMAINS] = VR_CFG_ALL_DOMAINS_ICC(11.1, 60, 94, 20); |
Patrick Rudolph | 69e826d | 2019-08-14 10:23:30 +0200 | [diff] [blame] | 160 | if (tdp >= 45) { |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 161 | icc_max[VR_IA_CORE] = VR_CFG_AMP(74); |
| 162 | if (tdp >= 65) { |
| 163 | icc_max[VR_GT_SLICED] = VR_CFG_AMP(105); |
| 164 | icc_max[VR_GT_UNSLICED] = VR_CFG_AMP(24); |
| 165 | } |
| 166 | } |
| 167 | return icc_max[domain]; |
| 168 | } |
| 169 | case PCI_DEVICE_ID_INTEL_SKL_ID_H_2: /* fallthrough */ |
| 170 | case PCI_DEVICE_ID_INTEL_SKL_ID_H_EM: /* fallthrough */ |
| 171 | case PCI_DEVICE_ID_INTEL_KBL_ID_H: { |
| 172 | uint16_t icc_max[NUM_VR_DOMAINS] = VR_CFG_ALL_DOMAINS_ICC(6.6, 60, 55, 55); |
| 173 | if (tdp >= 35) { |
| 174 | if (tdp >= 45) |
| 175 | icc_max[VR_IA_CORE] = VR_CFG_AMP(68); |
| 176 | |
Patrick Rudolph | 69e826d | 2019-08-14 10:23:30 +0200 | [diff] [blame] | 177 | icc_max[VR_SYSTEM_AGENT] = VR_CFG_AMP(11.1); |
Patrick Rudolph | 69e826d | 2019-08-14 10:23:30 +0200 | [diff] [blame] | 178 | } |
| 179 | |
| 180 | return icc_max[domain]; |
| 181 | } |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 182 | case PCI_DEVICE_ID_INTEL_SKL_ID_U: { |
| 183 | uint16_t icc_max[NUM_VR_DOMAINS] = VR_CFG_ALL_DOMAINS_ICC(5.1, 29, 57, 19); |
| 184 | if (tdp >= 28) |
| 185 | icc_max[VR_IA_CORE] = VR_CFG_AMP(32); |
| 186 | else if (igd_id != PCI_DEVICE_ID_INTEL_SKL_GT3E_SULTM_1) { |
| 187 | const uint16_t icc_max_gt2[NUM_VR_DOMAINS] = |
| 188 | VR_CFG_ALL_DOMAINS_ICC(4.5, 29, 31, 31); |
| 189 | |
| 190 | return icc_max_gt2[domain]; |
| 191 | } |
| 192 | return icc_max[domain]; |
| 193 | } |
Patrick Rudolph | 50aebaf8 | 2019-08-14 10:07:38 +0200 | [diff] [blame] | 194 | case PCI_DEVICE_ID_INTEL_KBL_U_R: { |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 195 | const uint16_t icc_max[NUM_VR_DOMAINS] = |
| 196 | VR_CFG_ALL_DOMAINS_ICC(6, 64, 31, 31); |
Patrick Rudolph | 50aebaf8 | 2019-08-14 10:07:38 +0200 | [diff] [blame] | 197 | return icc_max[domain]; |
| 198 | } |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 199 | case PCI_DEVICE_ID_INTEL_SKL_ID_Y: /* fallthrough */ |
Patrick Rudolph | 50aebaf8 | 2019-08-14 10:07:38 +0200 | [diff] [blame] | 200 | case PCI_DEVICE_ID_INTEL_KBL_ID_Y: { |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 201 | uint16_t icc_max[NUM_VR_DOMAINS] = VR_CFG_ALL_DOMAINS_ICC(4.1, 24, 24, 24); |
Gaggery Tsai | e1a75d4 | 2018-01-02 12:13:40 +0800 | [diff] [blame] | 202 | |
Patrick Rudolph | 50aebaf8 | 2019-08-14 10:07:38 +0200 | [diff] [blame] | 203 | if (igd_id == PCI_DEVICE_ID_INTEL_AML_GT2_ULX) |
| 204 | icc_max[VR_IA_CORE] = VR_CFG_AMP(28); |
Gaggery Tsai | e1a75d4 | 2018-01-02 12:13:40 +0800 | [diff] [blame] | 205 | |
Patrick Rudolph | 50aebaf8 | 2019-08-14 10:07:38 +0200 | [diff] [blame] | 206 | return icc_max[domain]; |
| 207 | } |
| 208 | case PCI_DEVICE_ID_INTEL_KBL_ID_U: { |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 209 | uint16_t icc_max[NUM_VR_DOMAINS] = VR_CFG_ALL_DOMAINS_ICC(4.5, 32, 31, 31); |
Gaggery Tsai | e1a75d4 | 2018-01-02 12:13:40 +0800 | [diff] [blame] | 210 | |
Maxim Polyakov | c56ca6b | 2019-10-15 14:13:28 +0300 | [diff] [blame] | 211 | if (igd_id == PCI_DEVICE_ID_INTEL_KBL_GT1_SULTM) |
Patrick Rudolph | 50aebaf8 | 2019-08-14 10:07:38 +0200 | [diff] [blame] | 212 | icc_max[VR_IA_CORE] = VR_CFG_AMP(29); |
| 213 | |
Maxim Polyakov | c56ca6b | 2019-10-15 14:13:28 +0300 | [diff] [blame] | 214 | else if ((igd_id == PCI_DEVICE_ID_INTEL_KBL_GT3E_SULTM_1) || |
| 215 | (igd_id == PCI_DEVICE_ID_INTEL_KBL_GT3E_SULTM_2)) { |
| 216 | const uint16_t icc_max_gt3[NUM_VR_DOMAINS] = |
| 217 | VR_CFG_ALL_DOMAINS_ICC(5.1, 32, 57, 19); |
| 218 | |
| 219 | return icc_max_gt3[domain]; |
| 220 | } |
| 221 | |
Patrick Rudolph | 50aebaf8 | 2019-08-14 10:07:38 +0200 | [diff] [blame] | 222 | return icc_max[domain]; |
| 223 | } |
| 224 | default: |
Angel Pons | 0e2d515 | 2020-04-16 23:52:55 +0200 | [diff] [blame] | 225 | printk(BIOS_ERR, "ERROR: Unknown MCH (0x%x) in %s\n", mch_id, __func__); |
Patrick Rudolph | 50aebaf8 | 2019-08-14 10:07:38 +0200 | [diff] [blame] | 226 | } |
| 227 | return 0; |
Gaggery Tsai | e1a75d4 | 2018-01-02 12:13:40 +0800 | [diff] [blame] | 228 | } |
| 229 | |
Patrick Rudolph | 9a01623 | 2019-08-14 12:10:48 +0200 | [diff] [blame] | 230 | static uint16_t get_sku_ac_dc_loadline(const int domain) |
| 231 | { |
| 232 | static uint16_t mch_id = 0, igd_id = 0; |
| 233 | if (!mch_id) { |
| 234 | struct device *dev = pcidev_path_on_root(SA_DEVFN_ROOT); |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 235 | mch_id = dev ? pci_read_config16(dev, PCI_DEVICE_ID) : 0xffff; |
Patrick Rudolph | 9a01623 | 2019-08-14 12:10:48 +0200 | [diff] [blame] | 236 | } |
| 237 | if (!igd_id) { |
| 238 | struct device *dev = pcidev_path_on_root(SA_DEVFN_IGD); |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 239 | igd_id = dev ? pci_read_config16(dev, PCI_DEVICE_ID) : 0xffff; |
Patrick Rudolph | 9a01623 | 2019-08-14 12:10:48 +0200 | [diff] [blame] | 240 | } |
| 241 | |
| 242 | switch (mch_id) { |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 243 | case PCI_DEVICE_ID_INTEL_SKL_ID_S_2: /* fallthrough */ |
| 244 | case PCI_DEVICE_ID_INTEL_SKL_ID_S_4: /* fallthrough */ |
| 245 | case PCI_DEVICE_ID_INTEL_KBL_ID_S: /* fallthrough */ |
| 246 | case PCI_DEVICE_ID_INTEL_KBL_ID_DT: /* fallthrough */ |
Patrick Rudolph | 9a01623 | 2019-08-14 12:10:48 +0200 | [diff] [blame] | 247 | case PCI_DEVICE_ID_INTEL_KBL_ID_DT_2: { |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 248 | /* SA Loadline is not specified */ |
| 249 | const uint16_t loadline[NUM_VR_DOMAINS] = |
| 250 | VR_CFG_ALL_DOMAINS_LOADLINE(0, 2.1, 3.1, 3.1); |
Patrick Rudolph | 9a01623 | 2019-08-14 12:10:48 +0200 | [diff] [blame] | 251 | return loadline[domain]; |
| 252 | } |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 253 | case PCI_DEVICE_ID_INTEL_SKL_ID_H_2: /* fallthrough */ |
| 254 | case PCI_DEVICE_ID_INTEL_SKL_ID_H_EM: /* fallthrough */ |
| 255 | case PCI_DEVICE_ID_INTEL_SKL_ID_H_4: /* fallthrough */ |
Patrick Rudolph | 9a01623 | 2019-08-14 12:10:48 +0200 | [diff] [blame] | 256 | case PCI_DEVICE_ID_INTEL_KBL_ID_H: { |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 257 | const uint16_t loadline[NUM_VR_DOMAINS] = |
| 258 | VR_CFG_ALL_DOMAINS_LOADLINE(10, 1.8, 2.65, 2.65); |
| 259 | |
| 260 | if (igd_id == PCI_DEVICE_ID_INTEL_SKL_GT4_SHALM) { |
| 261 | const uint16_t loadline_gt4[NUM_VR_DOMAINS] = |
| 262 | VR_CFG_ALL_DOMAINS_LOADLINE(6, 1.6, 1.4, 6); |
| 263 | return loadline_gt4[domain]; |
| 264 | } |
Patrick Rudolph | 9a01623 | 2019-08-14 12:10:48 +0200 | [diff] [blame] | 265 | |
| 266 | return loadline[domain]; |
| 267 | } |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 268 | case PCI_DEVICE_ID_INTEL_SKL_ID_Y: /* fallthrough */ |
Patrick Rudolph | 9a01623 | 2019-08-14 12:10:48 +0200 | [diff] [blame] | 269 | case PCI_DEVICE_ID_INTEL_KBL_ID_Y: { |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 270 | uint16_t loadline[NUM_VR_DOMAINS] = |
| 271 | VR_CFG_ALL_DOMAINS_LOADLINE(18, 5.9, 5.7, 5.7); |
Patrick Rudolph | 9a01623 | 2019-08-14 12:10:48 +0200 | [diff] [blame] | 272 | |
| 273 | if (igd_id == PCI_DEVICE_ID_INTEL_AML_GT2_ULX) |
| 274 | loadline[VR_IA_CORE] = VR_CFG_MOHMS(4); |
| 275 | |
| 276 | return loadline[domain]; |
| 277 | } |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 278 | case PCI_DEVICE_ID_INTEL_SKL_ID_U: /* fallthrough */ |
| 279 | case PCI_DEVICE_ID_INTEL_KBL_U_R: /* fallthrough */ |
Patrick Rudolph | 9a01623 | 2019-08-14 12:10:48 +0200 | [diff] [blame] | 280 | case PCI_DEVICE_ID_INTEL_KBL_ID_U: { |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 281 | uint16_t loadline[NUM_VR_DOMAINS] = |
| 282 | VR_CFG_ALL_DOMAINS_LOADLINE(10.3, 2.4, 3.1, 3.1); |
Patrick Rudolph | 9a01623 | 2019-08-14 12:10:48 +0200 | [diff] [blame] | 283 | |
Maxim Polyakov | 24ba850 | 2019-08-29 18:40:19 +0300 | [diff] [blame] | 284 | if ((igd_id == PCI_DEVICE_ID_INTEL_SKL_GT3E_SULTM_1) || |
| 285 | (igd_id == PCI_DEVICE_ID_INTEL_SKL_GT3E_SULTM_2) || |
| 286 | (igd_id == PCI_DEVICE_ID_INTEL_KBL_GT3E_SULTM_1) || |
Maxim Polyakov | 9d68cb2 | 2019-10-03 17:07:21 +0300 | [diff] [blame] | 287 | (igd_id == PCI_DEVICE_ID_INTEL_KBL_GT3E_SULTM_2)) { |
Maxim Polyakov | 7235913 | 2019-10-03 16:50:04 +0300 | [diff] [blame] | 288 | loadline[VR_GT_UNSLICED] = VR_CFG_MOHMS(2); |
Patrick Rudolph | 9a01623 | 2019-08-14 12:10:48 +0200 | [diff] [blame] | 289 | loadline[VR_GT_SLICED] = VR_CFG_MOHMS(6); |
| 290 | } |
| 291 | |
| 292 | return loadline[domain]; |
| 293 | } |
| 294 | default: |
Angel Pons | 0e2d515 | 2020-04-16 23:52:55 +0200 | [diff] [blame] | 295 | printk(BIOS_ERR, "ERROR: Unknown MCH (0x%x) in %s\n", mch_id, __func__); |
Patrick Rudolph | 9a01623 | 2019-08-14 12:10:48 +0200 | [diff] [blame] | 296 | } |
| 297 | return 0; |
| 298 | } |
Patrick Rudolph | 9a01623 | 2019-08-14 12:10:48 +0200 | [diff] [blame] | 299 | |
Rizwan Qureshi | 1222a73 | 2016-08-23 14:31:23 +0530 | [diff] [blame] | 300 | void fill_vr_domain_config(void *params, |
| 301 | int domain, const struct vr_config *chip_cfg) |
Aaron Durbin | df21440 | 2015-12-14 16:44:26 -0600 | [diff] [blame] | 302 | { |
Rizwan Qureshi | 1222a73 | 2016-08-23 14:31:23 +0530 | [diff] [blame] | 303 | FSP_SIL_UPD *vr_params = (FSP_SIL_UPD *)params; |
Aaron Durbin | df21440 | 2015-12-14 16:44:26 -0600 | [diff] [blame] | 304 | const struct vr_config *cfg; |
| 305 | |
| 306 | if (domain < 0 || domain >= NUM_VR_DOMAINS) |
| 307 | return; |
| 308 | |
| 309 | /* Use device tree override if requested. */ |
| 310 | if (chip_cfg->vr_config_enable) |
| 311 | cfg = chip_cfg; |
| 312 | else |
| 313 | cfg = &default_configs[domain]; |
| 314 | |
Rizwan Qureshi | 1222a73 | 2016-08-23 14:31:23 +0530 | [diff] [blame] | 315 | vr_params->VrConfigEnable[domain] = cfg->vr_config_enable; |
| 316 | vr_params->Psi1Threshold[domain] = cfg->psi1threshold; |
| 317 | vr_params->Psi2Threshold[domain] = cfg->psi2threshold; |
| 318 | vr_params->Psi3Threshold[domain] = cfg->psi3threshold; |
| 319 | vr_params->Psi3Enable[domain] = cfg->psi3enable; |
| 320 | vr_params->Psi4Enable[domain] = cfg->psi4enable; |
| 321 | vr_params->ImonSlope[domain] = cfg->imon_slope; |
| 322 | vr_params->ImonOffset[domain] = cfg->imon_offset; |
Patrick Rudolph | b824f7d | 2019-12-09 08:56:39 +0100 | [diff] [blame] | 323 | |
Patrick Rudolph | 50aebaf8 | 2019-08-14 10:07:38 +0200 | [diff] [blame] | 324 | /* If board provided non-zero value, use it. */ |
| 325 | if (cfg->icc_max) |
| 326 | vr_params->IccMax[domain] = cfg->icc_max; |
| 327 | else |
| 328 | vr_params->IccMax[domain] = get_sku_icc_max(domain); |
Rizwan Qureshi | 1222a73 | 2016-08-23 14:31:23 +0530 | [diff] [blame] | 329 | vr_params->VrVoltageLimit[domain] = cfg->voltage_limit; |
Duncan Laurie | 86db469 | 2017-03-14 16:40:06 -0700 | [diff] [blame] | 330 | |
Patrick Rudolph | 9a01623 | 2019-08-14 12:10:48 +0200 | [diff] [blame] | 331 | if (cfg->ac_loadline) |
| 332 | vr_params->AcLoadline[domain] = cfg->ac_loadline; |
| 333 | else |
| 334 | vr_params->AcLoadline[domain] = get_sku_ac_dc_loadline(domain); |
| 335 | if (cfg->dc_loadline) |
| 336 | vr_params->DcLoadline[domain] = cfg->dc_loadline; |
| 337 | else |
| 338 | vr_params->DcLoadline[domain] = get_sku_ac_dc_loadline(domain); |
Aaron Durbin | df21440 | 2015-12-14 16:44:26 -0600 | [diff] [blame] | 339 | } |