blob: ce566cf7b5e650445623c15f4b904948bae8b324 [file] [log] [blame]
Angel Pons3bd1e3d2020-04-05 15:47:17 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Lee Leahyb0005132015-05-12 18:19:47 -07002
Duncan Laurie7d484102017-01-09 22:23:39 -08003#include <bootmode.h>
Rizwan Qureshi1222a732016-08-23 14:31:23 +05304#include <bootstate.h>
Wim Vervoornd1371502019-12-17 14:10:16 +01005#include <cbmem.h>
Rizwan Qureshi1222a732016-08-23 14:31:23 +05306#include <fsp/api.h>
Furquan Shaikh76cedd22020-05-02 10:24:23 -07007#include <acpi/acpi.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +05308#include <console/console.h>
9#include <device/device.h>
Gaggery Tsai711fb812018-05-22 12:32:48 -070010#include <device/pci_ids.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053011#include <fsp/util.h>
Kyösti Mälkki32d47eb2019-09-28 00:00:30 +030012#include <intelblocks/cfg.h>
Subrata Banik46caf092018-09-28 19:54:30 +053013#include <intelblocks/itss.h>
Nico Huber44e89af2019-02-23 19:24:51 +010014#include <intelblocks/lpc_lib.h>
Subrata Banikcf32fd12018-12-19 18:02:17 +053015#include <intelblocks/mp_init.h>
Nico Huberad91b182019-10-12 15:16:33 +020016#include <intelblocks/pcie_rp.h>
Duncan Laurief5116952018-03-26 02:24:18 -070017#include <intelblocks/xdci.h>
Patrick Rudolph5199e822019-09-26 14:00:14 +020018#include <intelblocks/p2sb.h>
Subrata Banik9cd99a12018-05-28 16:12:03 +053019#include <intelpch/lockdown.h>
Brandon Breitensteinc6ec8dd2016-11-17 12:23:04 -080020#include <romstage_handoff.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053021#include <soc/acpi.h>
Patrick Georgic6a00502017-10-05 18:19:29 +020022#include <soc/intel/common/vbt.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053023#include <soc/interrupt.h>
Nico Huber2afe4dc2017-09-19 09:36:03 +020024#include <soc/iomap.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053025#include <soc/irq.h>
Subrata Banik46caf092018-09-28 19:54:30 +053026#include <soc/itss.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053027#include <soc/pci_devs.h>
28#include <soc/ramstage.h>
Nico Huber2afe4dc2017-09-19 09:36:03 +020029#include <soc/systemagent.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053030#include <string.h>
31
Elyes HAOUASc3385072019-03-21 15:38:06 +010032#include "chip.h"
33
Nico Huberad91b182019-10-12 15:16:33 +020034static const struct pcie_rp_group pch_lp_rp_groups[] = {
35 { .slot = PCH_DEV_SLOT_PCIE, .count = 8 },
36 { .slot = PCH_DEV_SLOT_PCIE_1, .count = 4 },
37 { 0 }
Gaggery Tsai711fb812018-05-22 12:32:48 -070038};
39
Nico Huberad91b182019-10-12 15:16:33 +020040static const struct pcie_rp_group pch_h_rp_groups[] = {
41 { .slot = PCH_DEV_SLOT_PCIE, .count = 8 },
42 { .slot = PCH_DEV_SLOT_PCIE_1, .count = 8 },
43 /* Sunrise Point PCH-H actually only has 4 ports in the
44 third group. But that would require a runtime check
45 and probing 4 non-existent ports shouldn't hurt. */
46 { .slot = PCH_DEV_SLOT_PCIE_2, .count = 8 },
47 { 0 }
Gaggery Tsai711fb812018-05-22 12:32:48 -070048};
49
Naresh G Solankia2d40622016-08-30 20:47:13 +053050void soc_init_pre_device(void *chip_info)
51{
Subrata Banik46caf092018-09-28 19:54:30 +053052 /* Snapshot the current GPIO IRQ polarities. FSP is setting a
53 * default policy that doesn't honor boards' requirements. */
54 itss_snapshot_irq_polarities(GPIO_IRQ_START, GPIO_IRQ_END);
55
Naresh G Solankia2d40622016-08-30 20:47:13 +053056 /* Perform silicon specific init. */
Aaron Durbin6c191d82016-11-29 21:22:42 -060057 fsp_silicon_init(romstage_handoff_is_resume());
Subrata Banik46caf092018-09-28 19:54:30 +053058
Patrick Rudolph5199e822019-09-26 14:00:14 +020059 /*
60 * Keep the P2SB device visible so it and the other devices are
61 * visible in coreboot for driver support and PCI resource allocation.
62 * There is no UPD setting for this.
63 */
64 p2sb_unhide();
65
Subrata Banik46caf092018-09-28 19:54:30 +053066 /* Restore GPIO IRQ polarities back to previous settings. */
67 itss_restore_irq_polarities(GPIO_IRQ_START, GPIO_IRQ_END);
68
Gaggery Tsai711fb812018-05-22 12:32:48 -070069 /* swap enabled PCI ports in device tree if needed */
Nico Huberad91b182019-10-12 15:16:33 +020070 if (CONFIG(SKYLAKE_SOC_PCH_H))
71 pcie_rp_update_devicetree(pch_h_rp_groups);
72 else
73 pcie_rp_update_devicetree(pch_lp_rp_groups);
Naresh G Solankia2d40622016-08-30 20:47:13 +053074}
75
Furquan Shaikhc2480442017-02-20 13:41:56 -080076void soc_fsp_load(void)
77{
78 fsps_load(romstage_handoff_is_resume());
79}
80
Naresh G Solankia2d40622016-08-30 20:47:13 +053081static struct device_operations pci_domain_ops = {
82 .read_resources = &pci_domain_read_resources,
83 .set_resources = &pci_domain_set_resources,
84 .scan_bus = &pci_domain_scan_bus,
Julius Wernercd49cce2019-03-05 16:53:33 -080085#if CONFIG(HAVE_ACPI_TABLES)
Nico Huberc37b0e32017-09-18 20:03:46 +020086 .write_acpi_tables = &northbridge_write_acpi_tables,
87 .acpi_name = &soc_acpi_name,
Naresh G Solankia2d40622016-08-30 20:47:13 +053088#endif
89};
90
91static struct device_operations cpu_bus_ops = {
Nico Huber2f8ba692020-04-05 14:05:24 +020092 .read_resources = noop_read_resources,
93 .set_resources = noop_set_resources,
Julius Wernercd49cce2019-03-05 16:53:33 -080094#if CONFIG(HAVE_ACPI_TABLES)
Nico Huber68680dd2020-03-31 17:34:52 +020095 .acpi_fill_ssdt = generate_cpu_entries,
Naresh G Solankia2d40622016-08-30 20:47:13 +053096#endif
97};
98
Elyes HAOUAS143fb462018-05-25 12:56:45 +020099static void soc_enable(struct device *dev)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530100{
101 /* Set the operations if it is a special bus type */
Subrata Banik3c838c72017-12-06 18:14:01 +0530102 if (dev->path.type == DEVICE_PATH_DOMAIN)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530103 dev->ops = &pci_domain_ops;
Subrata Banik3c838c72017-12-06 18:14:01 +0530104 else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530105 dev->ops = &cpu_bus_ops;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530106}
107
108struct chip_operations soc_intel_skylake_ops = {
109 CHIP_NAME("Intel 6th Gen")
110 .enable_dev = &soc_enable,
111 .init = &soc_init_pre_device,
112};
Lee Leahyb0005132015-05-12 18:19:47 -0700113
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530114/* UPD parameters to be initialized before SiliconInit */
Naresh G Solankia2d40622016-08-30 20:47:13 +0530115void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530116{
Naresh G Solankia2d40622016-08-30 20:47:13 +0530117 FSP_S_CONFIG *params = &supd->FspsConfig;
118 FSP_S_TEST_CONFIG *tconfig = &supd->FspsTestConfig;
Kyösti Mälkki4af4e7f2019-07-14 05:50:20 +0300119 struct soc_intel_skylake_config *config;
Kyösti Mälkki28dc7dc2019-07-12 13:10:19 +0300120 struct device *dev;
Patrick Georgid2990ff2018-05-03 18:06:15 +0200121 uintptr_t vbt_data = (uintptr_t)vbt_get();
Naresh G Solankia2d40622016-08-30 20:47:13 +0530122 int i;
123
Kyösti Mälkkid5f645c2019-09-28 00:20:27 +0300124 config = config_of_soc();
Naresh G Solankia2d40622016-08-30 20:47:13 +0530125
126 mainboard_silicon_init_params(params);
Gaggery Tsaida6f4ae2018-01-15 15:03:01 +0800127 /* Set PsysPmax if it is available from DT */
128 if (config->psys_pmax) {
129 /* PsysPmax is in unit of 1/8 Watt */
130 tconfig->PsysPmax = config->psys_pmax * 8;
131 printk(BIOS_DEBUG, "psys_pmax = %d\n", tconfig->PsysPmax);
132 }
Naresh G Solankia2d40622016-08-30 20:47:13 +0530133
Naresh G Solankia2d40622016-08-30 20:47:13 +0530134 params->GraphicsConfigPtr = (u32) vbt_data;
135
136 for (i = 0; i < ARRAY_SIZE(config->usb2_ports); i++) {
137 params->PortUsb20Enable[i] =
138 config->usb2_ports[i].enable;
Subrata Banik2c3054c2016-11-22 20:21:49 +0530139 params->Usb2OverCurrentPin[i] =
140 config->usb2_ports[i].ocpin;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530141 params->Usb2AfePetxiset[i] =
142 config->usb2_ports[i].pre_emp_bias;
143 params->Usb2AfeTxiset[i] =
144 config->usb2_ports[i].tx_bias;
145 params->Usb2AfePredeemp[i] =
146 config->usb2_ports[i].tx_emp_enable;
147 params->Usb2AfePehalfbit[i] =
148 config->usb2_ports[i].pre_emp_bit;
149 }
150
151 for (i = 0; i < ARRAY_SIZE(config->usb3_ports); i++) {
152 params->PortUsb30Enable[i] = config->usb3_ports[i].enable;
Subrata Banik2c3054c2016-11-22 20:21:49 +0530153 params->Usb3OverCurrentPin[i] = config->usb3_ports[i].ocpin;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530154 if (config->usb3_ports[i].tx_de_emp) {
155 params->Usb3HsioTxDeEmphEnable[i] = 1;
156 params->Usb3HsioTxDeEmph[i] =
157 config->usb3_ports[i].tx_de_emp;
158 }
159 if (config->usb3_ports[i].tx_downscale_amp) {
160 params->Usb3HsioTxDownscaleAmpEnable[i] = 1;
161 params->Usb3HsioTxDownscaleAmp[i] =
162 config->usb3_ports[i].tx_downscale_amp;
163 }
164 }
165
166 memcpy(params->SataPortsEnable, config->SataPortsEnable,
167 sizeof(params->SataPortsEnable));
168 memcpy(params->SataPortsDevSlp, config->SataPortsDevSlp,
169 sizeof(params->SataPortsDevSlp));
Michael Niewöhnera1ef94e2019-09-01 13:53:09 +0200170 memcpy(params->SataPortsHotPlug, config->SataPortsHotPlug,
171 sizeof(params->SataPortsHotPlug));
172 memcpy(params->SataPortsSpinUp, config->SataPortsSpinUp,
173 sizeof(params->SataPortsSpinUp));
Naresh G Solankia2d40622016-08-30 20:47:13 +0530174 memcpy(params->PcieRpClkReqSupport, config->PcieRpClkReqSupport,
175 sizeof(params->PcieRpClkReqSupport));
176 memcpy(params->PcieRpClkReqNumber, config->PcieRpClkReqNumber,
177 sizeof(params->PcieRpClkReqNumber));
Rizwan Qureshi6ab4ed42017-09-05 14:18:25 +0530178 memcpy(params->PcieRpAdvancedErrorReporting,
179 config->PcieRpAdvancedErrorReporting,
180 sizeof(params->PcieRpAdvancedErrorReporting));
Rizwan Qureshi03937392017-09-16 01:54:20 +0530181 memcpy(params->PcieRpLtrEnable, config->PcieRpLtrEnable,
182 sizeof(params->PcieRpLtrEnable));
Duncan Laurie74ea48e2018-01-29 12:00:47 -0800183 memcpy(params->PcieRpHotPlug, config->PcieRpHotPlug,
184 sizeof(params->PcieRpHotPlug));
Wim Vervoorn5819eab2020-05-07 13:16:32 +0200185 for (i = 0; i < CONFIG_MAX_ROOT_PORTS; i++) {
Wim Vervoornd6b682c2020-05-07 12:41:13 +0200186 params->PcieRpMaxPayload[i] = config->PcieRpMaxPayload[i];
Wim Vervoorn5819eab2020-05-07 13:16:32 +0200187 if (config->PcieRpAspm[i])
188 params->PcieRpAspm[i] = config->PcieRpAspm[i] - 1;
189 }
Naresh G Solankia2d40622016-08-30 20:47:13 +0530190
Divya Chellape7fb7ce2017-12-19 20:16:50 +0530191 /*
192 * PcieRpClkSrcNumber UPD is set to clock source number(0-6) for
193 * all the enabled PCIe root ports, invalid(0x1F) is set for
194 * disabled PCIe root ports.
195 */
196 for (i = 0; i < CONFIG_MAX_ROOT_PORTS; i++) {
197 if (config->PcieRpClkReqSupport[i])
198 params->PcieRpClkSrcNumber[i] =
199 config->PcieRpClkSrcNumber[i];
200 else
201 params->PcieRpClkSrcNumber[i] = 0x1F;
202 }
203
Naresh G Solankieedf6d82016-11-16 21:27:38 +0530204 /* disable Legacy PME */
205 memset(params->PcieRpPmSci, 0, sizeof(params->PcieRpPmSci));
206
Subrata Banik10a94322019-07-08 14:49:22 +0530207 /* Legacy 8254 timer support */
208 params->Early8254ClockGatingEnable = !CONFIG_USE_LEGACY_8254_TIMER;
209
Naresh G Solankia2d40622016-08-30 20:47:13 +0530210 memcpy(params->SerialIoDevMode, config->SerialIoDevMode,
211 sizeof(params->SerialIoDevMode));
212
213 params->PchCio2Enable = config->Cio2Enable;
Rizwan Qureshic2c8a742017-01-13 22:04:11 +0530214 params->SaImguEnable = config->SaImguEnable;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530215 params->Heci3Enabled = config->Heci3Enabled;
216
217 params->LogoPtr = config->LogoPtr;
218 params->LogoSize = config->LogoSize;
219
Julius Wernercd49cce2019-03-05 16:53:33 -0800220 params->CpuConfig.Bits.VmxEnable = CONFIG(ENABLE_VMX);
Naresh G Solankia2d40622016-08-30 20:47:13 +0530221
222 params->PchPmWoWlanEnable = config->PchPmWoWlanEnable;
223 params->PchPmWoWlanDeepSxEnable = config->PchPmWoWlanDeepSxEnable;
224 params->PchPmLanWakeFromDeepSx = config->WakeConfigPcieWakeFromDeepSx;
225
226 params->PchLanEnable = config->EnableLan;
Duncan Laurie14485ef2017-12-13 13:58:35 -0800227 if (config->EnableLan) {
228 params->PchLanLtrEnable = config->EnableLanLtr;
229 params->PchLanK1OffEnable = config->EnableLanK1Off;
230 params->PchLanClkReqSupported = config->LanClkReqSupported;
231 params->PchLanClkReqNumber = config->LanClkReqNumber;
232 }
Naresh G Solankia2d40622016-08-30 20:47:13 +0530233 params->SataSalpSupport = config->SataSalpSupport;
234 params->SsicPortEnable = config->SsicPortEnable;
235 params->ScsEmmcEnabled = config->ScsEmmcEnabled;
236 params->ScsEmmcHs400Enabled = config->ScsEmmcHs400Enabled;
237 params->ScsSdCardEnabled = config->ScsSdCardEnabled;
li feng21066382018-05-22 12:49:53 -0700238
Pratik Prajapatie0722472018-08-22 18:58:38 -0700239 if (!!params->ScsEmmcHs400Enabled && !!config->EmmcHs400DllNeed) {
240 params->PchScsEmmcHs400DllDataValid =
241 !!config->EmmcHs400DllNeed;
242 params->PchScsEmmcHs400RxStrobeDll1 =
243 config->ScsEmmcHs400RxStrobeDll1;
244 params->PchScsEmmcHs400TxDataDll =
245 config->ScsEmmcHs400TxDataDll;
246 }
247
li feng21066382018-05-22 12:49:53 -0700248 /* If ISH is enabled, enable ISH elements */
Kyösti Mälkki903b40a2019-07-03 07:25:59 +0300249 dev = pcidev_path_on_root(PCH_DEVFN_ISH);
Angel Ponsc54dcf42019-08-30 22:14:18 +0200250 params->PchIshEnable = dev ? dev->enabled : 0;
li feng21066382018-05-22 12:49:53 -0700251
Naresh G Solankia2d40622016-08-30 20:47:13 +0530252 params->PchHdaEnable = config->EnableAzalia;
Michael Niewöhner62385632019-09-23 14:38:41 +0200253 params->PchHdaVcType = config->PchHdaVcType;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530254 params->PchHdaIoBufferOwnership = config->IoBufferOwnership;
255 params->PchHdaDspEnable = config->DspEnable;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530256 params->Device4Enable = config->Device4Enable;
257 params->SataEnable = config->EnableSata;
258 params->SataMode = config->SataMode;
Matt DeVillier9e0d69b2017-10-10 14:03:36 -0500259 params->SataSpeedLimit = config->SataSpeedLimit;
Naresh G Solanki84fbc302018-10-15 15:37:15 +0530260 params->EnableTcoTimer = !config->PmTimerDisabled;
Matt DeVillier9e0d69b2017-10-10 14:03:36 -0500261
Michael Niewöhner13dee2a2020-04-30 00:44:04 +0200262 /*
263 * For unknown reasons FSP skips writing some essential SATA init registers (SIR) when
264 * SataPwrOptEnable=0. This results in link errors, "unaligned write" errors and others.
265 * Enabling this option solves these problems.
266 */
267 params->SataPwrOptEnable = 1;
268
Naresh G Solankia2d40622016-08-30 20:47:13 +0530269 tconfig->PchLockDownGlobalSmi = config->LockDownConfigGlobalSmi;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530270 tconfig->PchLockDownRtcLock = config->LockDownConfigRtcLock;
Praveen hodagatta pranesh015b3dc2018-11-23 17:41:46 +0800271 tconfig->PowerLimit4 = config->PowerLimit4;
Michael Niewöhnera1ef94e2019-09-01 13:53:09 +0200272 tconfig->SataTestMode = config->SataTestMode;
Barnali Sarkarfbf10182017-08-11 18:38:38 +0530273 /*
274 * To disable HECI, the Psf needs to be left unlocked
275 * by FSP till end of post sequence. Based on the devicetree
276 * setting, we set the appropriate PsfUnlock policy in FSP,
277 * do the changes and then lock it back in coreboot during finalize.
278 */
279 tconfig->PchSbAccessUnlock = (config->HeciEnabled == 0) ? 1 : 0;
Subrata Banikc4986eb2018-05-09 14:55:09 +0530280 if (get_lockdown_config() == CHIPSET_LOCKDOWN_COREBOOT) {
Subrata Banikc204aaa2017-08-17 15:49:58 +0530281 tconfig->PchLockDownBiosInterface = 0;
282 params->PchLockDownBiosLock = 0;
283 params->PchLockDownSpiEiss = 0;
284 /*
285 * Skip Spi Flash Lockdown from inside FSP.
286 * Making this config "0" means FSP won't set the FLOCKDN bit
287 * of SPIBAR + 0x04 (i.e., Bit 15 of BIOS_HSFSTS_CTL).
288 * So, it becomes coreboot's responsibility to set this bit
289 * before end of POST for security concerns.
290 */
291 params->SpiFlashCfgLockDown = 0;
292 }
Matt Delcodfffcad2018-07-23 12:44:15 -0700293 /* only replacing preexisting subsys ID defaults when non-zero */
Elyes HAOUASb58e99d2019-01-23 12:04:43 +0100294 if (CONFIG_SUBSYSTEM_VENDOR_ID != 0) {
295 params->DefaultSvid = CONFIG_SUBSYSTEM_VENDOR_ID;
296 params->PchSubSystemVendorId = CONFIG_SUBSYSTEM_VENDOR_ID;
297 }
298
299 if (CONFIG_SUBSYSTEM_DEVICE_ID != 0) {
300 params->DefaultSid = CONFIG_SUBSYSTEM_DEVICE_ID;
301 params->PchSubSystemId = CONFIG_SUBSYSTEM_DEVICE_ID;
302 }
303
Naresh G Solankia2d40622016-08-30 20:47:13 +0530304 params->PchPmWolEnableOverride = config->WakeConfigWolEnableOverride;
305 params->PchPmPcieWakeFromDeepSx = config->WakeConfigPcieWakeFromDeepSx;
306 params->PchPmDeepSxPol = config->PmConfigDeepSxPol;
Duncan Laurie25c7d932017-02-17 17:16:43 -0800307 params->PchPmSlpS0Enable = config->s0ix_enable;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530308 params->PchPmSlpS3MinAssert = config->PmConfigSlpS3MinAssert;
309 params->PchPmSlpS4MinAssert = config->PmConfigSlpS4MinAssert;
310 params->PchPmSlpSusMinAssert = config->PmConfigSlpSusMinAssert;
311 params->PchPmSlpAMinAssert = config->PmConfigSlpAMinAssert;
312 params->PchPmLpcClockRun = config->PmConfigPciClockRun;
313 params->PchPmSlpStrchSusUp = config->PmConfigSlpStrchSusUp;
314 params->PchPmPwrBtnOverridePeriod =
315 config->PmConfigPwrBtnOverridePeriod;
316 params->PchPmPwrCycDur = config->PmConfigPwrCycDur;
Rizwan Qureshi0da186c2017-02-23 14:43:39 +0530317
318 /* Indicate whether platform supports Voltage Margining */
319 params->PchPmSlpS0VmEnable = config->PchPmSlpS0VmEnable;
320
Nico Huber44e89af2019-02-23 19:24:51 +0100321 params->PchSirqEnable = config->serirq_mode != SERIRQ_OFF;
322 params->PchSirqMode = config->serirq_mode == SERIRQ_CONTINUOUS;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530323
Subrata Banikcf32fd12018-12-19 18:02:17 +0530324 params->CpuConfig.Bits.SkipMpInit = !CONFIG_USE_INTEL_FSP_MP_INIT;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530325
Subrata Banikc4986eb2018-05-09 14:55:09 +0530326 for (i = 0; i < ARRAY_SIZE(config->i2c_voltage); i++)
Aaron Durbined14a4e2016-11-09 17:04:15 -0600327 params->SerialIoI2cVoltage[i] = config->i2c_voltage[i];
Naresh G Solankia2d40622016-08-30 20:47:13 +0530328
329 for (i = 0; i < ARRAY_SIZE(config->domain_vr_config); i++)
330 fill_vr_domain_config(params, i, &config->domain_vr_config[i]);
331
332 /* Show SPI controller if enabled in devicetree.cb */
Kyösti Mälkki903b40a2019-07-03 07:25:59 +0300333 dev = pcidev_path_on_root(PCH_DEVFN_SPI);
Angel Ponsc54dcf42019-08-30 22:14:18 +0200334 params->ShowSpiController = dev ? dev->enabled : 0;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530335
Duncan Laurief5116952018-03-26 02:24:18 -0700336 /* Enable xDCI controller if enabled in devicetree and allowed */
Kyösti Mälkki903b40a2019-07-03 07:25:59 +0300337 dev = pcidev_path_on_root(PCH_DEVFN_USBOTG);
Angel Ponsc54dcf42019-08-30 22:14:18 +0200338 if (dev) {
339 if (!xdci_can_enable())
340 dev->enabled = 0;
341 params->XdciEnable = dev->enabled;
342 } else {
343 params->XdciEnable = 0;
344 }
Duncan Laurief5116952018-03-26 02:24:18 -0700345
Maxim Polyakov03ddd192019-08-30 18:04:02 +0300346 /* Enable or disable Gaussian Mixture Model in devicetree */
347 dev = pcidev_path_on_root(SA_DEVFN_GMM);
348 params->GmmEnable = dev ? dev->enabled : 0;
349
Rizwan Qureshi64670142016-11-23 15:25:19 +0530350 /*
351 * Send VR specific mailbox commands:
352 * 000b - no VR specific command sent
353 * 001b - VR mailbox command specifically for the MPS IMPV8 VR
Lee Leahyf4c4ab92017-03-16 17:08:03 -0700354 * will be sent
Rizwan Qureshi64670142016-11-23 15:25:19 +0530355 * 010b - VR specific command sent for PS4 exit issue
356 * 100b - VR specific command sent for MPS VR decay issue
357 */
358 params->SendVrMbxCmd1 = config->SendVrMbxCmd;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530359
Rizwan Qureshib3e18c72017-09-25 17:35:15 +0530360 /*
361 * Activates VR mailbox command for Intersil VR C-state issues.
362 * 0 - no mailbox command sent.
363 * 1 - VR mailbox command sent for IA/GT rails only.
364 * 2 - VR mailbox command sent for IA/GT/SA rails.
365 */
366 params->IslVrCmd = config->IslVrCmd;
367
Duncan Laurieb2aac852017-03-07 19:12:02 -0800368 /* Acoustic Noise Mitigation */
369 params->AcousticNoiseMitigation = config->AcousticNoiseMitigation;
370 params->SlowSlewRateForIa = config->SlowSlewRateForIa;
371 params->SlowSlewRateForGt = config->SlowSlewRateForGt;
372 params->SlowSlewRateForSa = config->SlowSlewRateForSa;
373 params->FastPkgCRampDisableIa = config->FastPkgCRampDisableIa;
374 params->FastPkgCRampDisableGt = config->FastPkgCRampDisableGt;
375 params->FastPkgCRampDisableSa = config->FastPkgCRampDisableSa;
376
Rizwan Qureshiffe58102017-02-10 15:58:24 +0530377 /* Enable PMC XRAM read */
378 tconfig->PchPmPmcReadDisable = config->PchPmPmcReadDisable;
379
Subrata Banik6b45ee42017-05-12 11:43:57 +0530380 /* Enable/Disable EIST */
381 tconfig->Eist = config->eist_enable;
382
marxwangec5a9472017-12-11 14:57:49 +0800383 /* Set TccActivationOffset */
384 tconfig->TccActivationOffset = config->tcc_offset;
385
Angel Pons4ff63d32019-08-30 20:05:33 +0200386 /* Already handled in coreboot code, so tell FSP to ignore UPDs */
387 params->PchIoApicBdfValid = 0;
388
Nico Huber2afe4dc2017-09-19 09:36:03 +0200389 /* Enable VT-d and X2APIC */
390 if (!config->ignore_vtd && soc_is_vtd_capable()) {
391 params->VtdBaseAddress[0] = GFXVT_BASE_ADDRESS;
392 params->VtdBaseAddress[1] = VTVC0_BASE_ADDRESS;
393 params->X2ApicOptOut = 0;
394 tconfig->VtdDisable = 0;
Nico Huber2afe4dc2017-09-19 09:36:03 +0200395 }
396
Michael Niewöhnerd60089b2019-10-26 10:44:33 +0200397 dev = pcidev_path_on_root(SA_DEVFN_IGD);
398 if (CONFIG(RUN_FSP_GOP) && dev && dev->enabled)
399 params->PeiGraphicsPeimInit = 1;
400 else
401 params->PeiGraphicsPeimInit = 0;
402
Naresh G Solankia2d40622016-08-30 20:47:13 +0530403 soc_irq_settings(params);
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530404}
Lee Leahyb0005132015-05-12 18:19:47 -0700405
Naresh G Solankia2d40622016-08-30 20:47:13 +0530406/* Mainboard GPIO Configuration */
Aaron Durbin64031672018-04-21 14:45:32 -0600407__weak void mainboard_silicon_init_params(FSP_S_CONFIG *params)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530408{
409 printk(BIOS_DEBUG, "WEAK: %s/%s called\n", __FILE__, __func__);
410}
Wim Vervoornd1371502019-12-17 14:10:16 +0100411
412/* Handle FSP logo params */
413const struct cbmem_entry *soc_load_logo(FSPS_UPD *supd)
414{
415 return fsp_load_logo(&supd->FspsConfig.LogoPtr, &supd->FspsConfig.LogoSize);
416}