blob: e0baefcdda729ecf746793394fe20508dfb356a3 [file] [log] [blame]
Angel Pons3bd1e3d2020-04-05 15:47:17 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2/* This file is part of the coreboot project. */
Lee Leahyb0005132015-05-12 18:19:47 -07003
Duncan Laurie7d484102017-01-09 22:23:39 -08004#include <bootmode.h>
Rizwan Qureshi1222a732016-08-23 14:31:23 +05305#include <bootstate.h>
Wim Vervoornd1371502019-12-17 14:10:16 +01006#include <cbmem.h>
Rizwan Qureshi1222a732016-08-23 14:31:23 +05307#include <fsp/api.h>
Furquan Shaikh76cedd22020-05-02 10:24:23 -07008#include <acpi/acpi.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +05309#include <console/console.h>
10#include <device/device.h>
Gaggery Tsai711fb812018-05-22 12:32:48 -070011#include <device/pci_ids.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053012#include <fsp/util.h>
Kyösti Mälkki32d47eb2019-09-28 00:00:30 +030013#include <intelblocks/cfg.h>
Subrata Banik46caf092018-09-28 19:54:30 +053014#include <intelblocks/itss.h>
Nico Huber44e89af2019-02-23 19:24:51 +010015#include <intelblocks/lpc_lib.h>
Subrata Banikcf32fd12018-12-19 18:02:17 +053016#include <intelblocks/mp_init.h>
Nico Huberad91b182019-10-12 15:16:33 +020017#include <intelblocks/pcie_rp.h>
Duncan Laurief5116952018-03-26 02:24:18 -070018#include <intelblocks/xdci.h>
Patrick Rudolph5199e822019-09-26 14:00:14 +020019#include <intelblocks/p2sb.h>
Subrata Banik9cd99a12018-05-28 16:12:03 +053020#include <intelpch/lockdown.h>
Brandon Breitensteinc6ec8dd2016-11-17 12:23:04 -080021#include <romstage_handoff.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053022#include <soc/acpi.h>
Patrick Georgic6a00502017-10-05 18:19:29 +020023#include <soc/intel/common/vbt.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053024#include <soc/interrupt.h>
Nico Huber2afe4dc2017-09-19 09:36:03 +020025#include <soc/iomap.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053026#include <soc/irq.h>
Subrata Banik46caf092018-09-28 19:54:30 +053027#include <soc/itss.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053028#include <soc/pci_devs.h>
29#include <soc/ramstage.h>
Nico Huber2afe4dc2017-09-19 09:36:03 +020030#include <soc/systemagent.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053031#include <string.h>
32
Elyes HAOUASc3385072019-03-21 15:38:06 +010033#include "chip.h"
34
Nico Huberad91b182019-10-12 15:16:33 +020035static const struct pcie_rp_group pch_lp_rp_groups[] = {
36 { .slot = PCH_DEV_SLOT_PCIE, .count = 8 },
37 { .slot = PCH_DEV_SLOT_PCIE_1, .count = 4 },
38 { 0 }
Gaggery Tsai711fb812018-05-22 12:32:48 -070039};
40
Nico Huberad91b182019-10-12 15:16:33 +020041static const struct pcie_rp_group pch_h_rp_groups[] = {
42 { .slot = PCH_DEV_SLOT_PCIE, .count = 8 },
43 { .slot = PCH_DEV_SLOT_PCIE_1, .count = 8 },
44 /* Sunrise Point PCH-H actually only has 4 ports in the
45 third group. But that would require a runtime check
46 and probing 4 non-existent ports shouldn't hurt. */
47 { .slot = PCH_DEV_SLOT_PCIE_2, .count = 8 },
48 { 0 }
Gaggery Tsai711fb812018-05-22 12:32:48 -070049};
50
Naresh G Solankia2d40622016-08-30 20:47:13 +053051void soc_init_pre_device(void *chip_info)
52{
Subrata Banik46caf092018-09-28 19:54:30 +053053 /* Snapshot the current GPIO IRQ polarities. FSP is setting a
54 * default policy that doesn't honor boards' requirements. */
55 itss_snapshot_irq_polarities(GPIO_IRQ_START, GPIO_IRQ_END);
56
Naresh G Solankia2d40622016-08-30 20:47:13 +053057 /* Perform silicon specific init. */
Aaron Durbin6c191d82016-11-29 21:22:42 -060058 fsp_silicon_init(romstage_handoff_is_resume());
Subrata Banik46caf092018-09-28 19:54:30 +053059
Patrick Rudolph5199e822019-09-26 14:00:14 +020060 /*
61 * Keep the P2SB device visible so it and the other devices are
62 * visible in coreboot for driver support and PCI resource allocation.
63 * There is no UPD setting for this.
64 */
65 p2sb_unhide();
66
Subrata Banik46caf092018-09-28 19:54:30 +053067 /* Restore GPIO IRQ polarities back to previous settings. */
68 itss_restore_irq_polarities(GPIO_IRQ_START, GPIO_IRQ_END);
69
Gaggery Tsai711fb812018-05-22 12:32:48 -070070 /* swap enabled PCI ports in device tree if needed */
Nico Huberad91b182019-10-12 15:16:33 +020071 if (CONFIG(SKYLAKE_SOC_PCH_H))
72 pcie_rp_update_devicetree(pch_h_rp_groups);
73 else
74 pcie_rp_update_devicetree(pch_lp_rp_groups);
Naresh G Solankia2d40622016-08-30 20:47:13 +053075}
76
Furquan Shaikhc2480442017-02-20 13:41:56 -080077void soc_fsp_load(void)
78{
79 fsps_load(romstage_handoff_is_resume());
80}
81
Elyes HAOUAS143fb462018-05-25 12:56:45 +020082static void pci_domain_set_resources(struct device *dev)
Naresh G Solankia2d40622016-08-30 20:47:13 +053083{
84 assign_resources(dev->link_list);
85}
86
87static struct device_operations pci_domain_ops = {
88 .read_resources = &pci_domain_read_resources,
89 .set_resources = &pci_domain_set_resources,
90 .scan_bus = &pci_domain_scan_bus,
Julius Wernercd49cce2019-03-05 16:53:33 -080091#if CONFIG(HAVE_ACPI_TABLES)
Nico Huberc37b0e32017-09-18 20:03:46 +020092 .write_acpi_tables = &northbridge_write_acpi_tables,
93 .acpi_name = &soc_acpi_name,
Naresh G Solankia2d40622016-08-30 20:47:13 +053094#endif
95};
96
97static struct device_operations cpu_bus_ops = {
Nico Huber2f8ba692020-04-05 14:05:24 +020098 .read_resources = noop_read_resources,
99 .set_resources = noop_set_resources,
Julius Wernercd49cce2019-03-05 16:53:33 -0800100#if CONFIG(HAVE_ACPI_TABLES)
Nico Huber68680dd2020-03-31 17:34:52 +0200101 .acpi_fill_ssdt = generate_cpu_entries,
Naresh G Solankia2d40622016-08-30 20:47:13 +0530102#endif
103};
104
Elyes HAOUAS143fb462018-05-25 12:56:45 +0200105static void soc_enable(struct device *dev)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530106{
107 /* Set the operations if it is a special bus type */
Subrata Banik3c838c72017-12-06 18:14:01 +0530108 if (dev->path.type == DEVICE_PATH_DOMAIN)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530109 dev->ops = &pci_domain_ops;
Subrata Banik3c838c72017-12-06 18:14:01 +0530110 else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530111 dev->ops = &cpu_bus_ops;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530112}
113
114struct chip_operations soc_intel_skylake_ops = {
115 CHIP_NAME("Intel 6th Gen")
116 .enable_dev = &soc_enable,
117 .init = &soc_init_pre_device,
118};
Lee Leahyb0005132015-05-12 18:19:47 -0700119
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530120/* UPD parameters to be initialized before SiliconInit */
Naresh G Solankia2d40622016-08-30 20:47:13 +0530121void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530122{
Naresh G Solankia2d40622016-08-30 20:47:13 +0530123 FSP_S_CONFIG *params = &supd->FspsConfig;
124 FSP_S_TEST_CONFIG *tconfig = &supd->FspsTestConfig;
Kyösti Mälkki4af4e7f2019-07-14 05:50:20 +0300125 struct soc_intel_skylake_config *config;
Kyösti Mälkki28dc7dc2019-07-12 13:10:19 +0300126 struct device *dev;
Patrick Georgid2990ff2018-05-03 18:06:15 +0200127 uintptr_t vbt_data = (uintptr_t)vbt_get();
Naresh G Solankia2d40622016-08-30 20:47:13 +0530128 int i;
129
Kyösti Mälkkid5f645c2019-09-28 00:20:27 +0300130 config = config_of_soc();
Naresh G Solankia2d40622016-08-30 20:47:13 +0530131
132 mainboard_silicon_init_params(params);
Gaggery Tsaida6f4ae2018-01-15 15:03:01 +0800133 /* Set PsysPmax if it is available from DT */
134 if (config->psys_pmax) {
135 /* PsysPmax is in unit of 1/8 Watt */
136 tconfig->PsysPmax = config->psys_pmax * 8;
137 printk(BIOS_DEBUG, "psys_pmax = %d\n", tconfig->PsysPmax);
138 }
Naresh G Solankia2d40622016-08-30 20:47:13 +0530139
Naresh G Solankia2d40622016-08-30 20:47:13 +0530140 params->GraphicsConfigPtr = (u32) vbt_data;
141
142 for (i = 0; i < ARRAY_SIZE(config->usb2_ports); i++) {
143 params->PortUsb20Enable[i] =
144 config->usb2_ports[i].enable;
Subrata Banik2c3054c2016-11-22 20:21:49 +0530145 params->Usb2OverCurrentPin[i] =
146 config->usb2_ports[i].ocpin;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530147 params->Usb2AfePetxiset[i] =
148 config->usb2_ports[i].pre_emp_bias;
149 params->Usb2AfeTxiset[i] =
150 config->usb2_ports[i].tx_bias;
151 params->Usb2AfePredeemp[i] =
152 config->usb2_ports[i].tx_emp_enable;
153 params->Usb2AfePehalfbit[i] =
154 config->usb2_ports[i].pre_emp_bit;
155 }
156
157 for (i = 0; i < ARRAY_SIZE(config->usb3_ports); i++) {
158 params->PortUsb30Enable[i] = config->usb3_ports[i].enable;
Subrata Banik2c3054c2016-11-22 20:21:49 +0530159 params->Usb3OverCurrentPin[i] = config->usb3_ports[i].ocpin;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530160 if (config->usb3_ports[i].tx_de_emp) {
161 params->Usb3HsioTxDeEmphEnable[i] = 1;
162 params->Usb3HsioTxDeEmph[i] =
163 config->usb3_ports[i].tx_de_emp;
164 }
165 if (config->usb3_ports[i].tx_downscale_amp) {
166 params->Usb3HsioTxDownscaleAmpEnable[i] = 1;
167 params->Usb3HsioTxDownscaleAmp[i] =
168 config->usb3_ports[i].tx_downscale_amp;
169 }
170 }
171
172 memcpy(params->SataPortsEnable, config->SataPortsEnable,
173 sizeof(params->SataPortsEnable));
174 memcpy(params->SataPortsDevSlp, config->SataPortsDevSlp,
175 sizeof(params->SataPortsDevSlp));
Michael Niewöhnera1ef94e2019-09-01 13:53:09 +0200176 memcpy(params->SataPortsHotPlug, config->SataPortsHotPlug,
177 sizeof(params->SataPortsHotPlug));
178 memcpy(params->SataPortsSpinUp, config->SataPortsSpinUp,
179 sizeof(params->SataPortsSpinUp));
Naresh G Solankia2d40622016-08-30 20:47:13 +0530180 memcpy(params->PcieRpClkReqSupport, config->PcieRpClkReqSupport,
181 sizeof(params->PcieRpClkReqSupport));
182 memcpy(params->PcieRpClkReqNumber, config->PcieRpClkReqNumber,
183 sizeof(params->PcieRpClkReqNumber));
Rizwan Qureshi6ab4ed42017-09-05 14:18:25 +0530184 memcpy(params->PcieRpAdvancedErrorReporting,
185 config->PcieRpAdvancedErrorReporting,
186 sizeof(params->PcieRpAdvancedErrorReporting));
Rizwan Qureshi03937392017-09-16 01:54:20 +0530187 memcpy(params->PcieRpLtrEnable, config->PcieRpLtrEnable,
188 sizeof(params->PcieRpLtrEnable));
Duncan Laurie74ea48e2018-01-29 12:00:47 -0800189 memcpy(params->PcieRpHotPlug, config->PcieRpHotPlug,
190 sizeof(params->PcieRpHotPlug));
Wim Vervoornd6b682c2020-05-07 12:41:13 +0200191 for (i = 0; i < CONFIG_MAX_ROOT_PORTS; i++)
192 params->PcieRpMaxPayload[i] = config->PcieRpMaxPayload[i];
Naresh G Solankia2d40622016-08-30 20:47:13 +0530193
Divya Chellape7fb7ce2017-12-19 20:16:50 +0530194 /*
195 * PcieRpClkSrcNumber UPD is set to clock source number(0-6) for
196 * all the enabled PCIe root ports, invalid(0x1F) is set for
197 * disabled PCIe root ports.
198 */
199 for (i = 0; i < CONFIG_MAX_ROOT_PORTS; i++) {
200 if (config->PcieRpClkReqSupport[i])
201 params->PcieRpClkSrcNumber[i] =
202 config->PcieRpClkSrcNumber[i];
203 else
204 params->PcieRpClkSrcNumber[i] = 0x1F;
205 }
206
Naresh G Solankieedf6d82016-11-16 21:27:38 +0530207 /* disable Legacy PME */
208 memset(params->PcieRpPmSci, 0, sizeof(params->PcieRpPmSci));
209
Subrata Banik10a94322019-07-08 14:49:22 +0530210 /* Legacy 8254 timer support */
211 params->Early8254ClockGatingEnable = !CONFIG_USE_LEGACY_8254_TIMER;
212
Naresh G Solankia2d40622016-08-30 20:47:13 +0530213 memcpy(params->SerialIoDevMode, config->SerialIoDevMode,
214 sizeof(params->SerialIoDevMode));
215
216 params->PchCio2Enable = config->Cio2Enable;
Rizwan Qureshic2c8a742017-01-13 22:04:11 +0530217 params->SaImguEnable = config->SaImguEnable;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530218 params->Heci3Enabled = config->Heci3Enabled;
219
220 params->LogoPtr = config->LogoPtr;
221 params->LogoSize = config->LogoSize;
222
Julius Wernercd49cce2019-03-05 16:53:33 -0800223 params->CpuConfig.Bits.VmxEnable = CONFIG(ENABLE_VMX);
Naresh G Solankia2d40622016-08-30 20:47:13 +0530224
225 params->PchPmWoWlanEnable = config->PchPmWoWlanEnable;
226 params->PchPmWoWlanDeepSxEnable = config->PchPmWoWlanDeepSxEnable;
227 params->PchPmLanWakeFromDeepSx = config->WakeConfigPcieWakeFromDeepSx;
228
229 params->PchLanEnable = config->EnableLan;
Duncan Laurie14485ef2017-12-13 13:58:35 -0800230 if (config->EnableLan) {
231 params->PchLanLtrEnable = config->EnableLanLtr;
232 params->PchLanK1OffEnable = config->EnableLanK1Off;
233 params->PchLanClkReqSupported = config->LanClkReqSupported;
234 params->PchLanClkReqNumber = config->LanClkReqNumber;
235 }
Naresh G Solankia2d40622016-08-30 20:47:13 +0530236 params->SataSalpSupport = config->SataSalpSupport;
237 params->SsicPortEnable = config->SsicPortEnable;
238 params->ScsEmmcEnabled = config->ScsEmmcEnabled;
239 params->ScsEmmcHs400Enabled = config->ScsEmmcHs400Enabled;
240 params->ScsSdCardEnabled = config->ScsSdCardEnabled;
li feng21066382018-05-22 12:49:53 -0700241
Pratik Prajapatie0722472018-08-22 18:58:38 -0700242 if (!!params->ScsEmmcHs400Enabled && !!config->EmmcHs400DllNeed) {
243 params->PchScsEmmcHs400DllDataValid =
244 !!config->EmmcHs400DllNeed;
245 params->PchScsEmmcHs400RxStrobeDll1 =
246 config->ScsEmmcHs400RxStrobeDll1;
247 params->PchScsEmmcHs400TxDataDll =
248 config->ScsEmmcHs400TxDataDll;
249 }
250
li feng21066382018-05-22 12:49:53 -0700251 /* If ISH is enabled, enable ISH elements */
Kyösti Mälkki903b40a2019-07-03 07:25:59 +0300252 dev = pcidev_path_on_root(PCH_DEVFN_ISH);
Angel Ponsc54dcf42019-08-30 22:14:18 +0200253 params->PchIshEnable = dev ? dev->enabled : 0;
li feng21066382018-05-22 12:49:53 -0700254
Naresh G Solankia2d40622016-08-30 20:47:13 +0530255 params->PchHdaEnable = config->EnableAzalia;
Michael Niewöhner62385632019-09-23 14:38:41 +0200256 params->PchHdaVcType = config->PchHdaVcType;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530257 params->PchHdaIoBufferOwnership = config->IoBufferOwnership;
258 params->PchHdaDspEnable = config->DspEnable;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530259 params->Device4Enable = config->Device4Enable;
260 params->SataEnable = config->EnableSata;
261 params->SataMode = config->SataMode;
Matt DeVillier9e0d69b2017-10-10 14:03:36 -0500262 params->SataSpeedLimit = config->SataSpeedLimit;
Naresh G Solanki84fbc302018-10-15 15:37:15 +0530263 params->EnableTcoTimer = !config->PmTimerDisabled;
Matt DeVillier9e0d69b2017-10-10 14:03:36 -0500264
Michael Niewöhner13dee2a2020-04-30 00:44:04 +0200265 /*
266 * For unknown reasons FSP skips writing some essential SATA init registers (SIR) when
267 * SataPwrOptEnable=0. This results in link errors, "unaligned write" errors and others.
268 * Enabling this option solves these problems.
269 */
270 params->SataPwrOptEnable = 1;
271
Naresh G Solankia2d40622016-08-30 20:47:13 +0530272 tconfig->PchLockDownGlobalSmi = config->LockDownConfigGlobalSmi;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530273 tconfig->PchLockDownRtcLock = config->LockDownConfigRtcLock;
Praveen hodagatta pranesh015b3dc2018-11-23 17:41:46 +0800274 tconfig->PowerLimit4 = config->PowerLimit4;
Michael Niewöhnera1ef94e2019-09-01 13:53:09 +0200275 tconfig->SataTestMode = config->SataTestMode;
Barnali Sarkarfbf10182017-08-11 18:38:38 +0530276 /*
277 * To disable HECI, the Psf needs to be left unlocked
278 * by FSP till end of post sequence. Based on the devicetree
279 * setting, we set the appropriate PsfUnlock policy in FSP,
280 * do the changes and then lock it back in coreboot during finalize.
281 */
282 tconfig->PchSbAccessUnlock = (config->HeciEnabled == 0) ? 1 : 0;
Subrata Banikc4986eb2018-05-09 14:55:09 +0530283 if (get_lockdown_config() == CHIPSET_LOCKDOWN_COREBOOT) {
Subrata Banikc204aaa2017-08-17 15:49:58 +0530284 tconfig->PchLockDownBiosInterface = 0;
285 params->PchLockDownBiosLock = 0;
286 params->PchLockDownSpiEiss = 0;
287 /*
288 * Skip Spi Flash Lockdown from inside FSP.
289 * Making this config "0" means FSP won't set the FLOCKDN bit
290 * of SPIBAR + 0x04 (i.e., Bit 15 of BIOS_HSFSTS_CTL).
291 * So, it becomes coreboot's responsibility to set this bit
292 * before end of POST for security concerns.
293 */
294 params->SpiFlashCfgLockDown = 0;
295 }
Matt Delcodfffcad2018-07-23 12:44:15 -0700296 /* only replacing preexisting subsys ID defaults when non-zero */
Elyes HAOUASb58e99d2019-01-23 12:04:43 +0100297 if (CONFIG_SUBSYSTEM_VENDOR_ID != 0) {
298 params->DefaultSvid = CONFIG_SUBSYSTEM_VENDOR_ID;
299 params->PchSubSystemVendorId = CONFIG_SUBSYSTEM_VENDOR_ID;
300 }
301
302 if (CONFIG_SUBSYSTEM_DEVICE_ID != 0) {
303 params->DefaultSid = CONFIG_SUBSYSTEM_DEVICE_ID;
304 params->PchSubSystemId = CONFIG_SUBSYSTEM_DEVICE_ID;
305 }
306
Naresh G Solankia2d40622016-08-30 20:47:13 +0530307 params->PchPmWolEnableOverride = config->WakeConfigWolEnableOverride;
308 params->PchPmPcieWakeFromDeepSx = config->WakeConfigPcieWakeFromDeepSx;
309 params->PchPmDeepSxPol = config->PmConfigDeepSxPol;
Duncan Laurie25c7d932017-02-17 17:16:43 -0800310 params->PchPmSlpS0Enable = config->s0ix_enable;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530311 params->PchPmSlpS3MinAssert = config->PmConfigSlpS3MinAssert;
312 params->PchPmSlpS4MinAssert = config->PmConfigSlpS4MinAssert;
313 params->PchPmSlpSusMinAssert = config->PmConfigSlpSusMinAssert;
314 params->PchPmSlpAMinAssert = config->PmConfigSlpAMinAssert;
315 params->PchPmLpcClockRun = config->PmConfigPciClockRun;
316 params->PchPmSlpStrchSusUp = config->PmConfigSlpStrchSusUp;
317 params->PchPmPwrBtnOverridePeriod =
318 config->PmConfigPwrBtnOverridePeriod;
319 params->PchPmPwrCycDur = config->PmConfigPwrCycDur;
Rizwan Qureshi0da186c2017-02-23 14:43:39 +0530320
321 /* Indicate whether platform supports Voltage Margining */
322 params->PchPmSlpS0VmEnable = config->PchPmSlpS0VmEnable;
323
Nico Huber44e89af2019-02-23 19:24:51 +0100324 params->PchSirqEnable = config->serirq_mode != SERIRQ_OFF;
325 params->PchSirqMode = config->serirq_mode == SERIRQ_CONTINUOUS;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530326
Subrata Banikcf32fd12018-12-19 18:02:17 +0530327 params->CpuConfig.Bits.SkipMpInit = !CONFIG_USE_INTEL_FSP_MP_INIT;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530328
Subrata Banikc4986eb2018-05-09 14:55:09 +0530329 for (i = 0; i < ARRAY_SIZE(config->i2c_voltage); i++)
Aaron Durbined14a4e2016-11-09 17:04:15 -0600330 params->SerialIoI2cVoltage[i] = config->i2c_voltage[i];
Naresh G Solankia2d40622016-08-30 20:47:13 +0530331
332 for (i = 0; i < ARRAY_SIZE(config->domain_vr_config); i++)
333 fill_vr_domain_config(params, i, &config->domain_vr_config[i]);
334
335 /* Show SPI controller if enabled in devicetree.cb */
Kyösti Mälkki903b40a2019-07-03 07:25:59 +0300336 dev = pcidev_path_on_root(PCH_DEVFN_SPI);
Angel Ponsc54dcf42019-08-30 22:14:18 +0200337 params->ShowSpiController = dev ? dev->enabled : 0;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530338
Duncan Laurief5116952018-03-26 02:24:18 -0700339 /* Enable xDCI controller if enabled in devicetree and allowed */
Kyösti Mälkki903b40a2019-07-03 07:25:59 +0300340 dev = pcidev_path_on_root(PCH_DEVFN_USBOTG);
Angel Ponsc54dcf42019-08-30 22:14:18 +0200341 if (dev) {
342 if (!xdci_can_enable())
343 dev->enabled = 0;
344 params->XdciEnable = dev->enabled;
345 } else {
346 params->XdciEnable = 0;
347 }
Duncan Laurief5116952018-03-26 02:24:18 -0700348
Maxim Polyakov03ddd192019-08-30 18:04:02 +0300349 /* Enable or disable Gaussian Mixture Model in devicetree */
350 dev = pcidev_path_on_root(SA_DEVFN_GMM);
351 params->GmmEnable = dev ? dev->enabled : 0;
352
Rizwan Qureshi64670142016-11-23 15:25:19 +0530353 /*
354 * Send VR specific mailbox commands:
355 * 000b - no VR specific command sent
356 * 001b - VR mailbox command specifically for the MPS IMPV8 VR
Lee Leahyf4c4ab92017-03-16 17:08:03 -0700357 * will be sent
Rizwan Qureshi64670142016-11-23 15:25:19 +0530358 * 010b - VR specific command sent for PS4 exit issue
359 * 100b - VR specific command sent for MPS VR decay issue
360 */
361 params->SendVrMbxCmd1 = config->SendVrMbxCmd;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530362
Rizwan Qureshib3e18c72017-09-25 17:35:15 +0530363 /*
364 * Activates VR mailbox command for Intersil VR C-state issues.
365 * 0 - no mailbox command sent.
366 * 1 - VR mailbox command sent for IA/GT rails only.
367 * 2 - VR mailbox command sent for IA/GT/SA rails.
368 */
369 params->IslVrCmd = config->IslVrCmd;
370
Duncan Laurieb2aac852017-03-07 19:12:02 -0800371 /* Acoustic Noise Mitigation */
372 params->AcousticNoiseMitigation = config->AcousticNoiseMitigation;
373 params->SlowSlewRateForIa = config->SlowSlewRateForIa;
374 params->SlowSlewRateForGt = config->SlowSlewRateForGt;
375 params->SlowSlewRateForSa = config->SlowSlewRateForSa;
376 params->FastPkgCRampDisableIa = config->FastPkgCRampDisableIa;
377 params->FastPkgCRampDisableGt = config->FastPkgCRampDisableGt;
378 params->FastPkgCRampDisableSa = config->FastPkgCRampDisableSa;
379
Rizwan Qureshiffe58102017-02-10 15:58:24 +0530380 /* Enable PMC XRAM read */
381 tconfig->PchPmPmcReadDisable = config->PchPmPmcReadDisable;
382
Subrata Banik6b45ee42017-05-12 11:43:57 +0530383 /* Enable/Disable EIST */
384 tconfig->Eist = config->eist_enable;
385
marxwangec5a9472017-12-11 14:57:49 +0800386 /* Set TccActivationOffset */
387 tconfig->TccActivationOffset = config->tcc_offset;
388
Angel Pons4ff63d32019-08-30 20:05:33 +0200389 /* Already handled in coreboot code, so tell FSP to ignore UPDs */
390 params->PchIoApicBdfValid = 0;
391
Nico Huber2afe4dc2017-09-19 09:36:03 +0200392 /* Enable VT-d and X2APIC */
393 if (!config->ignore_vtd && soc_is_vtd_capable()) {
394 params->VtdBaseAddress[0] = GFXVT_BASE_ADDRESS;
395 params->VtdBaseAddress[1] = VTVC0_BASE_ADDRESS;
396 params->X2ApicOptOut = 0;
397 tconfig->VtdDisable = 0;
Nico Huber2afe4dc2017-09-19 09:36:03 +0200398 }
399
Michael Niewöhnerd60089b2019-10-26 10:44:33 +0200400 dev = pcidev_path_on_root(SA_DEVFN_IGD);
401 if (CONFIG(RUN_FSP_GOP) && dev && dev->enabled)
402 params->PeiGraphicsPeimInit = 1;
403 else
404 params->PeiGraphicsPeimInit = 0;
405
Naresh G Solankia2d40622016-08-30 20:47:13 +0530406 soc_irq_settings(params);
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530407}
Lee Leahyb0005132015-05-12 18:19:47 -0700408
Naresh G Solankia2d40622016-08-30 20:47:13 +0530409/* Mainboard GPIO Configuration */
Aaron Durbin64031672018-04-21 14:45:32 -0600410__weak void mainboard_silicon_init_params(FSP_S_CONFIG *params)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530411{
412 printk(BIOS_DEBUG, "WEAK: %s/%s called\n", __FILE__, __func__);
413}
Wim Vervoornd1371502019-12-17 14:10:16 +0100414
415/* Handle FSP logo params */
416const struct cbmem_entry *soc_load_logo(FSPS_UPD *supd)
417{
418 return fsp_load_logo(&supd->FspsConfig.LogoPtr, &supd->FspsConfig.LogoSize);
419}