blob: ebfad667bb086361460a1be05489b2b773f2c61c [file] [log] [blame]
Lee Leahyb0005132015-05-12 18:19:47 -07001/*
2 * This file is part of the coreboot project.
3 *
Subrata Banika4b11e5c2017-02-03 18:57:49 +05304 * Copyright (C) 2016-2017 Intel Corporation.
Lee Leahyb0005132015-05-12 18:19:47 -07005 *
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.
Lee Leahyb0005132015-05-12 18:19:47 -070014 */
15
Lee Leahy1d14b3e2015-05-12 18:23:27 -070016#include <chip.h>
Duncan Laurie7d484102017-01-09 22:23:39 -080017#include <bootmode.h>
Rizwan Qureshi1222a732016-08-23 14:31:23 +053018#include <bootstate.h>
19#include <device/pci.h>
20#include <fsp/api.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053021#include <arch/acpi.h>
Gaggery Tsai711fb812018-05-22 12:32:48 -070022#include <arch/io.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053023#include <chip.h>
Aaron Durbin64031672018-04-21 14:45:32 -060024#include <compiler.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053025#include <bootstate.h>
26#include <console/console.h>
27#include <device/device.h>
28#include <device/pci.h>
Gaggery Tsai711fb812018-05-22 12:32:48 -070029#include <device/pci_ids.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053030#include <fsp/api.h>
31#include <fsp/util.h>
Duncan Laurief5116952018-03-26 02:24:18 -070032#include <intelblocks/xdci.h>
Brandon Breitensteinc6ec8dd2016-11-17 12:23:04 -080033#include <romstage_handoff.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053034#include <soc/acpi.h>
Patrick Georgic6a00502017-10-05 18:19:29 +020035#include <soc/intel/common/vbt.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053036#include <soc/interrupt.h>
Nico Huber2afe4dc2017-09-19 09:36:03 +020037#include <soc/iomap.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053038#include <soc/irq.h>
39#include <soc/pci_devs.h>
40#include <soc/ramstage.h>
Nico Huber2afe4dc2017-09-19 09:36:03 +020041#include <soc/systemagent.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053042#include <string.h>
43
Gaggery Tsai711fb812018-05-22 12:32:48 -070044struct pcie_entry {
45 unsigned int devfn;
46 unsigned int func_count;
47};
48
49/*
50 * According to table 2-2 in doc#546717:
51 * PCI bus[function] ID
52 * D28:[F0 - F7] 0xA110 - 0xA117
53 * D29:[F0 - F7] 0xA118 - 0xA11F
54 * D27:[F0 - F3] 0xA167 - 0xA16A
55 */
56static const struct pcie_entry pcie_table_skl_pch_h[] = {
57 {PCH_DEVFN_PCIE1, 8},
58 {PCH_DEVFN_PCIE9, 8},
59 {PCH_DEVFN_PCIE17, 4},
60};
61
62/*
63 * According to table 2-2 in doc#564464:
64 * PCI bus[function] ID
65 * D28:[F0 - F7] 0xA290 - 0xA297
66 * D29:[F0 - F7] 0xA298 - 0xA29F
67 * D27:[F0 - F7] 0xA2E7 - 0xA2EE
68 */
69static const struct pcie_entry pcie_table_kbl_pch_h[] = {
70 {PCH_DEVFN_PCIE1, 8},
71 {PCH_DEVFN_PCIE9, 8},
72 {PCH_DEVFN_PCIE17, 8},
73};
74
75/*
76 * According to table 2-2 in doc#567995/545659:
77 * PCI bus[function] ID
78 * D28:[F0 - F7] 0x9D10 - 0x9D17
79 * D29:[F0 - F3] 0x9D18 - 0x9D1B
80 */
81static const struct pcie_entry pcie_table_skl_pch_lp[] = {
82 {PCH_DEVFN_PCIE1, 8},
83 {PCH_DEVFN_PCIE9, 4},
84};
85
86/*
87 * If the PCIe root port at function 0 is disabled,
88 * the PCIe root ports might be coalesced after FSP silicon init.
89 * The below function will swap the devfn of the first enabled device
90 * in devicetree and function 0 resides a pci device
91 * so that it won't confuse coreboot.
92 */
93static void pcie_update_device_tree(const struct pcie_entry *pcie_rp_group,
94 size_t pci_groups)
95{
96 struct device *func0;
97 unsigned int devfn, devfn0;
98 int i, group;
99 unsigned int inc = PCI_DEVFN(0, 1);
100
101 for (group = 0; group < pci_groups; group++) {
102 devfn0 = pcie_rp_group[group].devfn;
103 func0 = dev_find_slot(0, devfn0);
104 if (func0 == NULL)
105 continue;
106
107 /* No more functions if function 0 is disabled. */
108 if (pci_read_config32(func0, PCI_VENDOR_ID) == 0xffffffff)
109 continue;
110
111 devfn = devfn0 + inc;
112
113 /*
114 * Increase function by 1.
115 * Then find first enabled device to replace func0
116 * as that port was move to func0.
117 */
118 for (i = 1; i < pcie_rp_group[group].func_count;
119 i++, devfn += inc) {
120 struct device *dev = dev_find_slot(0, devfn);
121 if (dev == NULL || !dev->enabled)
122 continue;
123
124 /*
125 * Found the first enabled device in
126 * a given dev number.
127 */
128 printk(BIOS_INFO, "PCI func %d was swapped"
129 " to func 0.\n", i);
130 func0->path.pci.devfn = dev->path.pci.devfn;
131 dev->path.pci.devfn = devfn0;
132 break;
133 }
134 }
135}
136
137static void pcie_override_devicetree_after_silicon_init(void)
138{
139 uint16_t id, id_mask;
140
141 id = pci_read_config16(PCH_DEV_PCIE1, PCI_DEVICE_ID);
142 /*
143 * We may read an ID other than func 0 after FSP-S.
144 * Strip out 4 least significant bits.
145 */
146 id_mask = id & ~0xf;
147 printk(BIOS_INFO, "Override DT after FSP-S, PCH is ");
148 if (id_mask == (PCI_DEVICE_ID_INTEL_SPT_LP_PCIE_RP1 & ~0xf)) {
149 printk(BIOS_INFO, "KBL/SKL PCH-LP SKU\n");
150 pcie_update_device_tree(&pcie_table_skl_pch_lp[0],
151 ARRAY_SIZE(pcie_table_skl_pch_lp));
152 } else if (id_mask == (PCI_DEVICE_ID_INTEL_KBP_H_PCIE_RP1 & ~0xf)) {
153 printk(BIOS_INFO, "KBL PCH-H SKU\n");
154 pcie_update_device_tree(&pcie_table_kbl_pch_h[0],
155 ARRAY_SIZE(pcie_table_kbl_pch_h));
156 } else if (id_mask == (PCI_DEVICE_ID_INTEL_SPT_H_PCIE_RP1 & ~0xf)) {
157 printk(BIOS_INFO, "SKL PCH-H SKU\n");
158 pcie_update_device_tree(&pcie_table_skl_pch_h[0],
159 ARRAY_SIZE(pcie_table_skl_pch_h));
160 } else {
161 printk(BIOS_ERR, "[BUG] PCIE Root Port id 0x%x"
162 " is not found\n", id);
163 return;
164 }
165}
166
Naresh G Solankia2d40622016-08-30 20:47:13 +0530167void soc_init_pre_device(void *chip_info)
168{
169 /* Perform silicon specific init. */
Aaron Durbin6c191d82016-11-29 21:22:42 -0600170 fsp_silicon_init(romstage_handoff_is_resume());
Gaggery Tsai711fb812018-05-22 12:32:48 -0700171 /* swap enabled PCI ports in device tree if needed */
172 pcie_override_devicetree_after_silicon_init();
Naresh G Solankia2d40622016-08-30 20:47:13 +0530173}
174
Furquan Shaikhc2480442017-02-20 13:41:56 -0800175void soc_fsp_load(void)
176{
177 fsps_load(romstage_handoff_is_resume());
178}
179
Elyes HAOUAS143fb462018-05-25 12:56:45 +0200180static void pci_domain_set_resources(struct device *dev)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530181{
182 assign_resources(dev->link_list);
183}
184
185static struct device_operations pci_domain_ops = {
186 .read_resources = &pci_domain_read_resources,
187 .set_resources = &pci_domain_set_resources,
188 .scan_bus = &pci_domain_scan_bus,
Naresh G Solankia2d40622016-08-30 20:47:13 +0530189#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
Nico Huberc37b0e32017-09-18 20:03:46 +0200190 .write_acpi_tables = &northbridge_write_acpi_tables,
191 .acpi_name = &soc_acpi_name,
Naresh G Solankia2d40622016-08-30 20:47:13 +0530192#endif
193};
194
195static struct device_operations cpu_bus_ops = {
196 .read_resources = DEVICE_NOOP,
197 .set_resources = DEVICE_NOOP,
198 .enable_resources = DEVICE_NOOP,
Subrata Banika4b11e5c2017-02-03 18:57:49 +0530199 .init = DEVICE_NOOP,
Naresh G Solankia2d40622016-08-30 20:47:13 +0530200#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
201 .acpi_fill_ssdt_generator = generate_cpu_entries,
202#endif
203};
204
Elyes HAOUAS143fb462018-05-25 12:56:45 +0200205static void soc_enable(struct device *dev)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530206{
207 /* Set the operations if it is a special bus type */
Subrata Banik3c838c72017-12-06 18:14:01 +0530208 if (dev->path.type == DEVICE_PATH_DOMAIN)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530209 dev->ops = &pci_domain_ops;
Subrata Banik3c838c72017-12-06 18:14:01 +0530210 else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530211 dev->ops = &cpu_bus_ops;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530212}
213
Subrata Banikc4986eb2018-05-09 14:55:09 +0530214static int get_lockdown_config(void)
215{
216 const struct soc_intel_common_config *soc_config;
217 soc_config = chip_get_common_soc_structure();
218
219 return soc_config->chipset_lockdown;
220}
221
Naresh G Solankia2d40622016-08-30 20:47:13 +0530222struct chip_operations soc_intel_skylake_ops = {
223 CHIP_NAME("Intel 6th Gen")
224 .enable_dev = &soc_enable,
225 .init = &soc_init_pre_device,
226};
Lee Leahyb0005132015-05-12 18:19:47 -0700227
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530228/* UPD parameters to be initialized before SiliconInit */
Naresh G Solankia2d40622016-08-30 20:47:13 +0530229void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530230{
Naresh G Solankia2d40622016-08-30 20:47:13 +0530231 FSP_S_CONFIG *params = &supd->FspsConfig;
232 FSP_S_TEST_CONFIG *tconfig = &supd->FspsTestConfig;
233 static struct soc_intel_skylake_config *config;
Patrick Georgid2990ff2018-05-03 18:06:15 +0200234 uintptr_t vbt_data = (uintptr_t)vbt_get();
Naresh G Solankia2d40622016-08-30 20:47:13 +0530235 int i;
236
Naresh G Solankia2d40622016-08-30 20:47:13 +0530237 struct device *dev = SA_DEV_ROOT;
238 if (!dev || !dev->chip_info) {
239 printk(BIOS_ERR, "BUG! Could not find SOC devicetree config\n");
240 return;
241 }
242 config = dev->chip_info;
243
244 mainboard_silicon_init_params(params);
Gaggery Tsaida6f4ae2018-01-15 15:03:01 +0800245 /* Set PsysPmax if it is available from DT */
246 if (config->psys_pmax) {
247 /* PsysPmax is in unit of 1/8 Watt */
248 tconfig->PsysPmax = config->psys_pmax * 8;
249 printk(BIOS_DEBUG, "psys_pmax = %d\n", tconfig->PsysPmax);
250 }
Naresh G Solankia2d40622016-08-30 20:47:13 +0530251
Naresh G Solankia2d40622016-08-30 20:47:13 +0530252 params->GraphicsConfigPtr = (u32) vbt_data;
253
254 for (i = 0; i < ARRAY_SIZE(config->usb2_ports); i++) {
255 params->PortUsb20Enable[i] =
256 config->usb2_ports[i].enable;
Subrata Banik2c3054c2016-11-22 20:21:49 +0530257 params->Usb2OverCurrentPin[i] =
258 config->usb2_ports[i].ocpin;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530259 params->Usb2AfePetxiset[i] =
260 config->usb2_ports[i].pre_emp_bias;
261 params->Usb2AfeTxiset[i] =
262 config->usb2_ports[i].tx_bias;
263 params->Usb2AfePredeemp[i] =
264 config->usb2_ports[i].tx_emp_enable;
265 params->Usb2AfePehalfbit[i] =
266 config->usb2_ports[i].pre_emp_bit;
267 }
268
269 for (i = 0; i < ARRAY_SIZE(config->usb3_ports); i++) {
270 params->PortUsb30Enable[i] = config->usb3_ports[i].enable;
Subrata Banik2c3054c2016-11-22 20:21:49 +0530271 params->Usb3OverCurrentPin[i] = config->usb3_ports[i].ocpin;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530272 if (config->usb3_ports[i].tx_de_emp) {
273 params->Usb3HsioTxDeEmphEnable[i] = 1;
274 params->Usb3HsioTxDeEmph[i] =
275 config->usb3_ports[i].tx_de_emp;
276 }
277 if (config->usb3_ports[i].tx_downscale_amp) {
278 params->Usb3HsioTxDownscaleAmpEnable[i] = 1;
279 params->Usb3HsioTxDownscaleAmp[i] =
280 config->usb3_ports[i].tx_downscale_amp;
281 }
282 }
283
284 memcpy(params->SataPortsEnable, config->SataPortsEnable,
285 sizeof(params->SataPortsEnable));
286 memcpy(params->SataPortsDevSlp, config->SataPortsDevSlp,
287 sizeof(params->SataPortsDevSlp));
288 memcpy(params->PcieRpClkReqSupport, config->PcieRpClkReqSupport,
289 sizeof(params->PcieRpClkReqSupport));
290 memcpy(params->PcieRpClkReqNumber, config->PcieRpClkReqNumber,
291 sizeof(params->PcieRpClkReqNumber));
Rizwan Qureshi6ab4ed42017-09-05 14:18:25 +0530292 memcpy(params->PcieRpAdvancedErrorReporting,
293 config->PcieRpAdvancedErrorReporting,
294 sizeof(params->PcieRpAdvancedErrorReporting));
Rizwan Qureshi03937392017-09-16 01:54:20 +0530295 memcpy(params->PcieRpLtrEnable, config->PcieRpLtrEnable,
296 sizeof(params->PcieRpLtrEnable));
Duncan Laurie74ea48e2018-01-29 12:00:47 -0800297 memcpy(params->PcieRpHotPlug, config->PcieRpHotPlug,
298 sizeof(params->PcieRpHotPlug));
Naresh G Solankia2d40622016-08-30 20:47:13 +0530299
Divya Chellape7fb7ce2017-12-19 20:16:50 +0530300 /*
301 * PcieRpClkSrcNumber UPD is set to clock source number(0-6) for
302 * all the enabled PCIe root ports, invalid(0x1F) is set for
303 * disabled PCIe root ports.
304 */
305 for (i = 0; i < CONFIG_MAX_ROOT_PORTS; i++) {
306 if (config->PcieRpClkReqSupport[i])
307 params->PcieRpClkSrcNumber[i] =
308 config->PcieRpClkSrcNumber[i];
309 else
310 params->PcieRpClkSrcNumber[i] = 0x1F;
311 }
312
Naresh G Solankieedf6d82016-11-16 21:27:38 +0530313 /* disable Legacy PME */
314 memset(params->PcieRpPmSci, 0, sizeof(params->PcieRpPmSci));
315
Naresh G Solankia2d40622016-08-30 20:47:13 +0530316 memcpy(params->SerialIoDevMode, config->SerialIoDevMode,
317 sizeof(params->SerialIoDevMode));
318
319 params->PchCio2Enable = config->Cio2Enable;
Rizwan Qureshic2c8a742017-01-13 22:04:11 +0530320 params->SaImguEnable = config->SaImguEnable;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530321 params->Heci3Enabled = config->Heci3Enabled;
322
323 params->LogoPtr = config->LogoPtr;
324 params->LogoSize = config->LogoSize;
325
326 params->CpuConfig.Bits.VmxEnable = config->VmxEnable;
327
328 params->PchPmWoWlanEnable = config->PchPmWoWlanEnable;
329 params->PchPmWoWlanDeepSxEnable = config->PchPmWoWlanDeepSxEnable;
330 params->PchPmLanWakeFromDeepSx = config->WakeConfigPcieWakeFromDeepSx;
331
332 params->PchLanEnable = config->EnableLan;
Duncan Laurie14485ef2017-12-13 13:58:35 -0800333 if (config->EnableLan) {
334 params->PchLanLtrEnable = config->EnableLanLtr;
335 params->PchLanK1OffEnable = config->EnableLanK1Off;
336 params->PchLanClkReqSupported = config->LanClkReqSupported;
337 params->PchLanClkReqNumber = config->LanClkReqNumber;
338 }
Naresh G Solankia2d40622016-08-30 20:47:13 +0530339 params->SataSalpSupport = config->SataSalpSupport;
340 params->SsicPortEnable = config->SsicPortEnable;
341 params->ScsEmmcEnabled = config->ScsEmmcEnabled;
342 params->ScsEmmcHs400Enabled = config->ScsEmmcHs400Enabled;
343 params->ScsSdCardEnabled = config->ScsSdCardEnabled;
344 params->PchIshEnable = config->IshEnable;
345 params->PchHdaEnable = config->EnableAzalia;
346 params->PchHdaIoBufferOwnership = config->IoBufferOwnership;
347 params->PchHdaDspEnable = config->DspEnable;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530348 params->Device4Enable = config->Device4Enable;
349 params->SataEnable = config->EnableSata;
350 params->SataMode = config->SataMode;
Matt DeVillier9e0d69b2017-10-10 14:03:36 -0500351 params->SataSpeedLimit = config->SataSpeedLimit;
Kane Chen14e0fa52017-12-27 12:11:23 +0800352 params->SataPwrOptEnable = config->SataPwrOptEnable;
Matt DeVillier9e0d69b2017-10-10 14:03:36 -0500353
Naresh G Solankia2d40622016-08-30 20:47:13 +0530354 tconfig->PchLockDownGlobalSmi = config->LockDownConfigGlobalSmi;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530355 tconfig->PchLockDownRtcLock = config->LockDownConfigRtcLock;
Barnali Sarkarfbf10182017-08-11 18:38:38 +0530356 /*
357 * To disable HECI, the Psf needs to be left unlocked
358 * by FSP till end of post sequence. Based on the devicetree
359 * setting, we set the appropriate PsfUnlock policy in FSP,
360 * do the changes and then lock it back in coreboot during finalize.
361 */
362 tconfig->PchSbAccessUnlock = (config->HeciEnabled == 0) ? 1 : 0;
Subrata Banikc4986eb2018-05-09 14:55:09 +0530363 if (get_lockdown_config() == CHIPSET_LOCKDOWN_COREBOOT) {
Subrata Banikc204aaa2017-08-17 15:49:58 +0530364 tconfig->PchLockDownBiosInterface = 0;
365 params->PchLockDownBiosLock = 0;
366 params->PchLockDownSpiEiss = 0;
367 /*
368 * Skip Spi Flash Lockdown from inside FSP.
369 * Making this config "0" means FSP won't set the FLOCKDN bit
370 * of SPIBAR + 0x04 (i.e., Bit 15 of BIOS_HSFSTS_CTL).
371 * So, it becomes coreboot's responsibility to set this bit
372 * before end of POST for security concerns.
373 */
374 params->SpiFlashCfgLockDown = 0;
375 }
Naresh G Solankia2d40622016-08-30 20:47:13 +0530376 params->PchSubSystemVendorId = config->PchConfigSubSystemVendorId;
377 params->PchSubSystemId = config->PchConfigSubSystemId;
378 params->PchPmWolEnableOverride = config->WakeConfigWolEnableOverride;
379 params->PchPmPcieWakeFromDeepSx = config->WakeConfigPcieWakeFromDeepSx;
380 params->PchPmDeepSxPol = config->PmConfigDeepSxPol;
Duncan Laurie25c7d932017-02-17 17:16:43 -0800381 params->PchPmSlpS0Enable = config->s0ix_enable;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530382 params->PchPmSlpS3MinAssert = config->PmConfigSlpS3MinAssert;
383 params->PchPmSlpS4MinAssert = config->PmConfigSlpS4MinAssert;
384 params->PchPmSlpSusMinAssert = config->PmConfigSlpSusMinAssert;
385 params->PchPmSlpAMinAssert = config->PmConfigSlpAMinAssert;
386 params->PchPmLpcClockRun = config->PmConfigPciClockRun;
387 params->PchPmSlpStrchSusUp = config->PmConfigSlpStrchSusUp;
388 params->PchPmPwrBtnOverridePeriod =
389 config->PmConfigPwrBtnOverridePeriod;
390 params->PchPmPwrCycDur = config->PmConfigPwrCycDur;
Rizwan Qureshi0da186c2017-02-23 14:43:39 +0530391
392 /* Indicate whether platform supports Voltage Margining */
393 params->PchPmSlpS0VmEnable = config->PchPmSlpS0VmEnable;
394
Naresh G Solankia2d40622016-08-30 20:47:13 +0530395 params->PchSirqEnable = config->SerialIrqConfigSirqEnable;
396 params->PchSirqMode = config->SerialIrqConfigSirqMode;
397
Subrata Banikce23d4c2018-06-04 10:05:07 +0530398 params->CpuConfig.Bits.SkipMpInit = !config->use_fsp_mp_init;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530399
Subrata Banikc4986eb2018-05-09 14:55:09 +0530400 for (i = 0; i < ARRAY_SIZE(config->i2c_voltage); i++)
Aaron Durbined14a4e2016-11-09 17:04:15 -0600401 params->SerialIoI2cVoltage[i] = config->i2c_voltage[i];
Naresh G Solankia2d40622016-08-30 20:47:13 +0530402
403 for (i = 0; i < ARRAY_SIZE(config->domain_vr_config); i++)
404 fill_vr_domain_config(params, i, &config->domain_vr_config[i]);
405
406 /* Show SPI controller if enabled in devicetree.cb */
407 dev = dev_find_slot(0, PCH_DEVFN_SPI);
408 params->ShowSpiController = dev->enabled;
409
Duncan Laurief5116952018-03-26 02:24:18 -0700410 /* Enable xDCI controller if enabled in devicetree and allowed */
411 dev = dev_find_slot(0, PCH_DEVFN_USBOTG);
412 if (!xdci_can_enable())
413 dev->enabled = 0;
414 params->XdciEnable = dev->enabled;
415
Rizwan Qureshi64670142016-11-23 15:25:19 +0530416 /*
417 * Send VR specific mailbox commands:
418 * 000b - no VR specific command sent
419 * 001b - VR mailbox command specifically for the MPS IMPV8 VR
Lee Leahyf4c4ab92017-03-16 17:08:03 -0700420 * will be sent
Rizwan Qureshi64670142016-11-23 15:25:19 +0530421 * 010b - VR specific command sent for PS4 exit issue
422 * 100b - VR specific command sent for MPS VR decay issue
423 */
424 params->SendVrMbxCmd1 = config->SendVrMbxCmd;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530425
Rizwan Qureshib3e18c72017-09-25 17:35:15 +0530426 /*
427 * Activates VR mailbox command for Intersil VR C-state issues.
428 * 0 - no mailbox command sent.
429 * 1 - VR mailbox command sent for IA/GT rails only.
430 * 2 - VR mailbox command sent for IA/GT/SA rails.
431 */
432 params->IslVrCmd = config->IslVrCmd;
433
Duncan Laurieb2aac852017-03-07 19:12:02 -0800434 /* Acoustic Noise Mitigation */
435 params->AcousticNoiseMitigation = config->AcousticNoiseMitigation;
436 params->SlowSlewRateForIa = config->SlowSlewRateForIa;
437 params->SlowSlewRateForGt = config->SlowSlewRateForGt;
438 params->SlowSlewRateForSa = config->SlowSlewRateForSa;
439 params->FastPkgCRampDisableIa = config->FastPkgCRampDisableIa;
440 params->FastPkgCRampDisableGt = config->FastPkgCRampDisableGt;
441 params->FastPkgCRampDisableSa = config->FastPkgCRampDisableSa;
442
Rizwan Qureshiffe58102017-02-10 15:58:24 +0530443 /* Enable PMC XRAM read */
444 tconfig->PchPmPmcReadDisable = config->PchPmPmcReadDisable;
445
Subrata Banik6b45ee42017-05-12 11:43:57 +0530446 /* Enable/Disable EIST */
447 tconfig->Eist = config->eist_enable;
448
marxwangec5a9472017-12-11 14:57:49 +0800449 /* Set TccActivationOffset */
450 tconfig->TccActivationOffset = config->tcc_offset;
451
Nico Huber2afe4dc2017-09-19 09:36:03 +0200452 /* Enable VT-d and X2APIC */
453 if (!config->ignore_vtd && soc_is_vtd_capable()) {
454 params->VtdBaseAddress[0] = GFXVT_BASE_ADDRESS;
455 params->VtdBaseAddress[1] = VTVC0_BASE_ADDRESS;
456 params->X2ApicOptOut = 0;
457 tconfig->VtdDisable = 0;
458
459 params->PchIoApicBdfValid = 1;
460 params->PchIoApicBusNumber = 250;
461 params->PchIoApicDeviceNumber = 31;
462 params->PchIoApicFunctionNumber = 0;
463 }
464
Naresh G Solankia2d40622016-08-30 20:47:13 +0530465 soc_irq_settings(params);
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530466}
Lee Leahyb0005132015-05-12 18:19:47 -0700467
Naresh G Solankia2d40622016-08-30 20:47:13 +0530468/* Mainboard GPIO Configuration */
Aaron Durbin64031672018-04-21 14:45:32 -0600469__weak void mainboard_silicon_init_params(FSP_S_CONFIG *params)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530470{
471 printk(BIOS_DEBUG, "WEAK: %s/%s called\n", __FILE__, __func__);
472}