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