blob: de11a9e1c7bc14ee9488ae2d274dd7e4d0edf626 [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
Duncan Laurie7d484102017-01-09 22:23:39 -080016#include <bootmode.h>
Rizwan Qureshi1222a732016-08-23 14:31:23 +053017#include <bootstate.h>
Rizwan Qureshi1222a732016-08-23 14:31:23 +053018#include <fsp/api.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053019#include <arch/acpi.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053020#include <console/console.h>
21#include <device/device.h>
Gaggery Tsai711fb812018-05-22 12:32:48 -070022#include <device/pci_ids.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053023#include <fsp/util.h>
Kyösti Mälkki32d47eb2019-09-28 00:00:30 +030024#include <intelblocks/cfg.h>
Subrata Banik46caf092018-09-28 19:54:30 +053025#include <intelblocks/itss.h>
Nico Huber44e89af2019-02-23 19:24:51 +010026#include <intelblocks/lpc_lib.h>
Subrata Banikcf32fd12018-12-19 18:02:17 +053027#include <intelblocks/mp_init.h>
Nico Huberad91b182019-10-12 15:16:33 +020028#include <intelblocks/pcie_rp.h>
Duncan Laurief5116952018-03-26 02:24:18 -070029#include <intelblocks/xdci.h>
Patrick Rudolph5199e822019-09-26 14:00:14 +020030#include <intelblocks/p2sb.h>
Subrata Banik9cd99a12018-05-28 16:12:03 +053031#include <intelpch/lockdown.h>
Brandon Breitensteinc6ec8dd2016-11-17 12:23:04 -080032#include <romstage_handoff.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053033#include <soc/acpi.h>
Patrick Georgic6a00502017-10-05 18:19:29 +020034#include <soc/intel/common/vbt.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053035#include <soc/interrupt.h>
Nico Huber2afe4dc2017-09-19 09:36:03 +020036#include <soc/iomap.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053037#include <soc/irq.h>
Subrata Banik46caf092018-09-28 19:54:30 +053038#include <soc/itss.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053039#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
Elyes HAOUASc3385072019-03-21 15:38:06 +010044#include "chip.h"
45
Nico Huberad91b182019-10-12 15:16:33 +020046static const struct pcie_rp_group pch_lp_rp_groups[] = {
47 { .slot = PCH_DEV_SLOT_PCIE, .count = 8 },
48 { .slot = PCH_DEV_SLOT_PCIE_1, .count = 4 },
49 { 0 }
Gaggery Tsai711fb812018-05-22 12:32:48 -070050};
51
Nico Huberad91b182019-10-12 15:16:33 +020052static const struct pcie_rp_group pch_h_rp_groups[] = {
53 { .slot = PCH_DEV_SLOT_PCIE, .count = 8 },
54 { .slot = PCH_DEV_SLOT_PCIE_1, .count = 8 },
55 /* Sunrise Point PCH-H actually only has 4 ports in the
56 third group. But that would require a runtime check
57 and probing 4 non-existent ports shouldn't hurt. */
58 { .slot = PCH_DEV_SLOT_PCIE_2, .count = 8 },
59 { 0 }
Gaggery Tsai711fb812018-05-22 12:32:48 -070060};
61
Naresh G Solankia2d40622016-08-30 20:47:13 +053062void soc_init_pre_device(void *chip_info)
63{
Subrata Banik46caf092018-09-28 19:54:30 +053064 /* Snapshot the current GPIO IRQ polarities. FSP is setting a
65 * default policy that doesn't honor boards' requirements. */
66 itss_snapshot_irq_polarities(GPIO_IRQ_START, GPIO_IRQ_END);
67
Naresh G Solankia2d40622016-08-30 20:47:13 +053068 /* Perform silicon specific init. */
Aaron Durbin6c191d82016-11-29 21:22:42 -060069 fsp_silicon_init(romstage_handoff_is_resume());
Subrata Banik46caf092018-09-28 19:54:30 +053070
Patrick Rudolph5199e822019-09-26 14:00:14 +020071 /*
72 * Keep the P2SB device visible so it and the other devices are
73 * visible in coreboot for driver support and PCI resource allocation.
74 * There is no UPD setting for this.
75 */
76 p2sb_unhide();
77
Subrata Banik46caf092018-09-28 19:54:30 +053078 /* Restore GPIO IRQ polarities back to previous settings. */
79 itss_restore_irq_polarities(GPIO_IRQ_START, GPIO_IRQ_END);
80
Gaggery Tsai711fb812018-05-22 12:32:48 -070081 /* swap enabled PCI ports in device tree if needed */
Nico Huberad91b182019-10-12 15:16:33 +020082 if (CONFIG(SKYLAKE_SOC_PCH_H))
83 pcie_rp_update_devicetree(pch_h_rp_groups);
84 else
85 pcie_rp_update_devicetree(pch_lp_rp_groups);
Naresh G Solankia2d40622016-08-30 20:47:13 +053086}
87
Furquan Shaikhc2480442017-02-20 13:41:56 -080088void soc_fsp_load(void)
89{
90 fsps_load(romstage_handoff_is_resume());
91}
92
Elyes HAOUAS143fb462018-05-25 12:56:45 +020093static void pci_domain_set_resources(struct device *dev)
Naresh G Solankia2d40622016-08-30 20:47:13 +053094{
95 assign_resources(dev->link_list);
96}
97
98static struct device_operations pci_domain_ops = {
99 .read_resources = &pci_domain_read_resources,
100 .set_resources = &pci_domain_set_resources,
101 .scan_bus = &pci_domain_scan_bus,
Julius Wernercd49cce2019-03-05 16:53:33 -0800102#if CONFIG(HAVE_ACPI_TABLES)
Nico Huberc37b0e32017-09-18 20:03:46 +0200103 .write_acpi_tables = &northbridge_write_acpi_tables,
104 .acpi_name = &soc_acpi_name,
Naresh G Solankia2d40622016-08-30 20:47:13 +0530105#endif
106};
107
108static struct device_operations cpu_bus_ops = {
109 .read_resources = DEVICE_NOOP,
110 .set_resources = DEVICE_NOOP,
111 .enable_resources = DEVICE_NOOP,
Subrata Banika4b11e5c2017-02-03 18:57:49 +0530112 .init = DEVICE_NOOP,
Julius Wernercd49cce2019-03-05 16:53:33 -0800113#if CONFIG(HAVE_ACPI_TABLES)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530114 .acpi_fill_ssdt_generator = generate_cpu_entries,
115#endif
116};
117
Elyes HAOUAS143fb462018-05-25 12:56:45 +0200118static void soc_enable(struct device *dev)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530119{
120 /* Set the operations if it is a special bus type */
Subrata Banik3c838c72017-12-06 18:14:01 +0530121 if (dev->path.type == DEVICE_PATH_DOMAIN)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530122 dev->ops = &pci_domain_ops;
Subrata Banik3c838c72017-12-06 18:14:01 +0530123 else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530124 dev->ops = &cpu_bus_ops;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530125}
126
127struct chip_operations soc_intel_skylake_ops = {
128 CHIP_NAME("Intel 6th Gen")
129 .enable_dev = &soc_enable,
130 .init = &soc_init_pre_device,
131};
Lee Leahyb0005132015-05-12 18:19:47 -0700132
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530133/* UPD parameters to be initialized before SiliconInit */
Naresh G Solankia2d40622016-08-30 20:47:13 +0530134void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530135{
Naresh G Solankia2d40622016-08-30 20:47:13 +0530136 FSP_S_CONFIG *params = &supd->FspsConfig;
137 FSP_S_TEST_CONFIG *tconfig = &supd->FspsTestConfig;
Kyösti Mälkki4af4e7f2019-07-14 05:50:20 +0300138 struct soc_intel_skylake_config *config;
Kyösti Mälkki28dc7dc2019-07-12 13:10:19 +0300139 struct device *dev;
Patrick Georgid2990ff2018-05-03 18:06:15 +0200140 uintptr_t vbt_data = (uintptr_t)vbt_get();
Naresh G Solankia2d40622016-08-30 20:47:13 +0530141 int i;
142
Kyösti Mälkkid5f645c2019-09-28 00:20:27 +0300143 config = config_of_soc();
Naresh G Solankia2d40622016-08-30 20:47:13 +0530144
145 mainboard_silicon_init_params(params);
Gaggery Tsaida6f4ae2018-01-15 15:03:01 +0800146 /* Set PsysPmax if it is available from DT */
147 if (config->psys_pmax) {
148 /* PsysPmax is in unit of 1/8 Watt */
149 tconfig->PsysPmax = config->psys_pmax * 8;
150 printk(BIOS_DEBUG, "psys_pmax = %d\n", tconfig->PsysPmax);
151 }
Naresh G Solankia2d40622016-08-30 20:47:13 +0530152
Naresh G Solankia2d40622016-08-30 20:47:13 +0530153 params->GraphicsConfigPtr = (u32) vbt_data;
154
155 for (i = 0; i < ARRAY_SIZE(config->usb2_ports); i++) {
156 params->PortUsb20Enable[i] =
157 config->usb2_ports[i].enable;
Subrata Banik2c3054c2016-11-22 20:21:49 +0530158 params->Usb2OverCurrentPin[i] =
159 config->usb2_ports[i].ocpin;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530160 params->Usb2AfePetxiset[i] =
161 config->usb2_ports[i].pre_emp_bias;
162 params->Usb2AfeTxiset[i] =
163 config->usb2_ports[i].tx_bias;
164 params->Usb2AfePredeemp[i] =
165 config->usb2_ports[i].tx_emp_enable;
166 params->Usb2AfePehalfbit[i] =
167 config->usb2_ports[i].pre_emp_bit;
168 }
169
170 for (i = 0; i < ARRAY_SIZE(config->usb3_ports); i++) {
171 params->PortUsb30Enable[i] = config->usb3_ports[i].enable;
Subrata Banik2c3054c2016-11-22 20:21:49 +0530172 params->Usb3OverCurrentPin[i] = config->usb3_ports[i].ocpin;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530173 if (config->usb3_ports[i].tx_de_emp) {
174 params->Usb3HsioTxDeEmphEnable[i] = 1;
175 params->Usb3HsioTxDeEmph[i] =
176 config->usb3_ports[i].tx_de_emp;
177 }
178 if (config->usb3_ports[i].tx_downscale_amp) {
179 params->Usb3HsioTxDownscaleAmpEnable[i] = 1;
180 params->Usb3HsioTxDownscaleAmp[i] =
181 config->usb3_ports[i].tx_downscale_amp;
182 }
183 }
184
185 memcpy(params->SataPortsEnable, config->SataPortsEnable,
186 sizeof(params->SataPortsEnable));
187 memcpy(params->SataPortsDevSlp, config->SataPortsDevSlp,
188 sizeof(params->SataPortsDevSlp));
Michael Niewöhnera1ef94e2019-09-01 13:53:09 +0200189 memcpy(params->SataPortsHotPlug, config->SataPortsHotPlug,
190 sizeof(params->SataPortsHotPlug));
191 memcpy(params->SataPortsSpinUp, config->SataPortsSpinUp,
192 sizeof(params->SataPortsSpinUp));
Naresh G Solankia2d40622016-08-30 20:47:13 +0530193 memcpy(params->PcieRpClkReqSupport, config->PcieRpClkReqSupport,
194 sizeof(params->PcieRpClkReqSupport));
195 memcpy(params->PcieRpClkReqNumber, config->PcieRpClkReqNumber,
196 sizeof(params->PcieRpClkReqNumber));
Rizwan Qureshi6ab4ed42017-09-05 14:18:25 +0530197 memcpy(params->PcieRpAdvancedErrorReporting,
198 config->PcieRpAdvancedErrorReporting,
199 sizeof(params->PcieRpAdvancedErrorReporting));
Rizwan Qureshi03937392017-09-16 01:54:20 +0530200 memcpy(params->PcieRpLtrEnable, config->PcieRpLtrEnable,
201 sizeof(params->PcieRpLtrEnable));
Duncan Laurie74ea48e2018-01-29 12:00:47 -0800202 memcpy(params->PcieRpHotPlug, config->PcieRpHotPlug,
203 sizeof(params->PcieRpHotPlug));
Naresh G Solankia2d40622016-08-30 20:47:13 +0530204
Divya Chellape7fb7ce2017-12-19 20:16:50 +0530205 /*
206 * PcieRpClkSrcNumber UPD is set to clock source number(0-6) for
207 * all the enabled PCIe root ports, invalid(0x1F) is set for
208 * disabled PCIe root ports.
209 */
210 for (i = 0; i < CONFIG_MAX_ROOT_PORTS; i++) {
211 if (config->PcieRpClkReqSupport[i])
212 params->PcieRpClkSrcNumber[i] =
213 config->PcieRpClkSrcNumber[i];
214 else
215 params->PcieRpClkSrcNumber[i] = 0x1F;
216 }
217
Naresh G Solankieedf6d82016-11-16 21:27:38 +0530218 /* disable Legacy PME */
219 memset(params->PcieRpPmSci, 0, sizeof(params->PcieRpPmSci));
220
Subrata Banik10a94322019-07-08 14:49:22 +0530221 /* Legacy 8254 timer support */
222 params->Early8254ClockGatingEnable = !CONFIG_USE_LEGACY_8254_TIMER;
223
Naresh G Solankia2d40622016-08-30 20:47:13 +0530224 memcpy(params->SerialIoDevMode, config->SerialIoDevMode,
225 sizeof(params->SerialIoDevMode));
226
227 params->PchCio2Enable = config->Cio2Enable;
Rizwan Qureshic2c8a742017-01-13 22:04:11 +0530228 params->SaImguEnable = config->SaImguEnable;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530229 params->Heci3Enabled = config->Heci3Enabled;
230
231 params->LogoPtr = config->LogoPtr;
232 params->LogoSize = config->LogoSize;
233
Julius Wernercd49cce2019-03-05 16:53:33 -0800234 params->CpuConfig.Bits.VmxEnable = CONFIG(ENABLE_VMX);
Naresh G Solankia2d40622016-08-30 20:47:13 +0530235
236 params->PchPmWoWlanEnable = config->PchPmWoWlanEnable;
237 params->PchPmWoWlanDeepSxEnable = config->PchPmWoWlanDeepSxEnable;
238 params->PchPmLanWakeFromDeepSx = config->WakeConfigPcieWakeFromDeepSx;
239
240 params->PchLanEnable = config->EnableLan;
Duncan Laurie14485ef2017-12-13 13:58:35 -0800241 if (config->EnableLan) {
242 params->PchLanLtrEnable = config->EnableLanLtr;
243 params->PchLanK1OffEnable = config->EnableLanK1Off;
244 params->PchLanClkReqSupported = config->LanClkReqSupported;
245 params->PchLanClkReqNumber = config->LanClkReqNumber;
246 }
Naresh G Solankia2d40622016-08-30 20:47:13 +0530247 params->SataSalpSupport = config->SataSalpSupport;
248 params->SsicPortEnable = config->SsicPortEnable;
249 params->ScsEmmcEnabled = config->ScsEmmcEnabled;
250 params->ScsEmmcHs400Enabled = config->ScsEmmcHs400Enabled;
251 params->ScsSdCardEnabled = config->ScsSdCardEnabled;
li feng21066382018-05-22 12:49:53 -0700252
Pratik Prajapatie0722472018-08-22 18:58:38 -0700253 if (!!params->ScsEmmcHs400Enabled && !!config->EmmcHs400DllNeed) {
254 params->PchScsEmmcHs400DllDataValid =
255 !!config->EmmcHs400DllNeed;
256 params->PchScsEmmcHs400RxStrobeDll1 =
257 config->ScsEmmcHs400RxStrobeDll1;
258 params->PchScsEmmcHs400TxDataDll =
259 config->ScsEmmcHs400TxDataDll;
260 }
261
li feng21066382018-05-22 12:49:53 -0700262 /* If ISH is enabled, enable ISH elements */
Kyösti Mälkki903b40a2019-07-03 07:25:59 +0300263 dev = pcidev_path_on_root(PCH_DEVFN_ISH);
Angel Ponsc54dcf42019-08-30 22:14:18 +0200264 params->PchIshEnable = dev ? dev->enabled : 0;
li feng21066382018-05-22 12:49:53 -0700265
Naresh G Solankia2d40622016-08-30 20:47:13 +0530266 params->PchHdaEnable = config->EnableAzalia;
Michael Niewöhner62385632019-09-23 14:38:41 +0200267 params->PchHdaVcType = config->PchHdaVcType;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530268 params->PchHdaIoBufferOwnership = config->IoBufferOwnership;
269 params->PchHdaDspEnable = config->DspEnable;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530270 params->Device4Enable = config->Device4Enable;
271 params->SataEnable = config->EnableSata;
272 params->SataMode = config->SataMode;
Matt DeVillier9e0d69b2017-10-10 14:03:36 -0500273 params->SataSpeedLimit = config->SataSpeedLimit;
Kane Chen14e0fa52017-12-27 12:11:23 +0800274 params->SataPwrOptEnable = config->SataPwrOptEnable;
Naresh G Solanki84fbc302018-10-15 15:37:15 +0530275 params->EnableTcoTimer = !config->PmTimerDisabled;
Matt DeVillier9e0d69b2017-10-10 14:03:36 -0500276
Naresh G Solankia2d40622016-08-30 20:47:13 +0530277 tconfig->PchLockDownGlobalSmi = config->LockDownConfigGlobalSmi;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530278 tconfig->PchLockDownRtcLock = config->LockDownConfigRtcLock;
Praveen hodagatta pranesh015b3dc2018-11-23 17:41:46 +0800279 tconfig->PowerLimit4 = config->PowerLimit4;
Michael Niewöhnera1ef94e2019-09-01 13:53:09 +0200280 tconfig->SataTestMode = config->SataTestMode;
Barnali Sarkarfbf10182017-08-11 18:38:38 +0530281 /*
282 * To disable HECI, the Psf needs to be left unlocked
283 * by FSP till end of post sequence. Based on the devicetree
284 * setting, we set the appropriate PsfUnlock policy in FSP,
285 * do the changes and then lock it back in coreboot during finalize.
286 */
287 tconfig->PchSbAccessUnlock = (config->HeciEnabled == 0) ? 1 : 0;
Subrata Banikc4986eb2018-05-09 14:55:09 +0530288 if (get_lockdown_config() == CHIPSET_LOCKDOWN_COREBOOT) {
Subrata Banikc204aaa2017-08-17 15:49:58 +0530289 tconfig->PchLockDownBiosInterface = 0;
290 params->PchLockDownBiosLock = 0;
291 params->PchLockDownSpiEiss = 0;
292 /*
293 * Skip Spi Flash Lockdown from inside FSP.
294 * Making this config "0" means FSP won't set the FLOCKDN bit
295 * of SPIBAR + 0x04 (i.e., Bit 15 of BIOS_HSFSTS_CTL).
296 * So, it becomes coreboot's responsibility to set this bit
297 * before end of POST for security concerns.
298 */
299 params->SpiFlashCfgLockDown = 0;
300 }
Matt Delcodfffcad2018-07-23 12:44:15 -0700301 /* only replacing preexisting subsys ID defaults when non-zero */
Elyes HAOUASb58e99d2019-01-23 12:04:43 +0100302 if (CONFIG_SUBSYSTEM_VENDOR_ID != 0) {
303 params->DefaultSvid = CONFIG_SUBSYSTEM_VENDOR_ID;
304 params->PchSubSystemVendorId = CONFIG_SUBSYSTEM_VENDOR_ID;
305 }
306
307 if (CONFIG_SUBSYSTEM_DEVICE_ID != 0) {
308 params->DefaultSid = CONFIG_SUBSYSTEM_DEVICE_ID;
309 params->PchSubSystemId = CONFIG_SUBSYSTEM_DEVICE_ID;
310 }
311
Naresh G Solankia2d40622016-08-30 20:47:13 +0530312 params->PchPmWolEnableOverride = config->WakeConfigWolEnableOverride;
313 params->PchPmPcieWakeFromDeepSx = config->WakeConfigPcieWakeFromDeepSx;
314 params->PchPmDeepSxPol = config->PmConfigDeepSxPol;
Duncan Laurie25c7d932017-02-17 17:16:43 -0800315 params->PchPmSlpS0Enable = config->s0ix_enable;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530316 params->PchPmSlpS3MinAssert = config->PmConfigSlpS3MinAssert;
317 params->PchPmSlpS4MinAssert = config->PmConfigSlpS4MinAssert;
318 params->PchPmSlpSusMinAssert = config->PmConfigSlpSusMinAssert;
319 params->PchPmSlpAMinAssert = config->PmConfigSlpAMinAssert;
320 params->PchPmLpcClockRun = config->PmConfigPciClockRun;
321 params->PchPmSlpStrchSusUp = config->PmConfigSlpStrchSusUp;
322 params->PchPmPwrBtnOverridePeriod =
323 config->PmConfigPwrBtnOverridePeriod;
324 params->PchPmPwrCycDur = config->PmConfigPwrCycDur;
Rizwan Qureshi0da186c2017-02-23 14:43:39 +0530325
326 /* Indicate whether platform supports Voltage Margining */
327 params->PchPmSlpS0VmEnable = config->PchPmSlpS0VmEnable;
328
Nico Huber44e89af2019-02-23 19:24:51 +0100329 params->PchSirqEnable = config->serirq_mode != SERIRQ_OFF;
330 params->PchSirqMode = config->serirq_mode == SERIRQ_CONTINUOUS;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530331
Subrata Banikcf32fd12018-12-19 18:02:17 +0530332 params->CpuConfig.Bits.SkipMpInit = !CONFIG_USE_INTEL_FSP_MP_INIT;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530333
Subrata Banikc4986eb2018-05-09 14:55:09 +0530334 for (i = 0; i < ARRAY_SIZE(config->i2c_voltage); i++)
Aaron Durbined14a4e2016-11-09 17:04:15 -0600335 params->SerialIoI2cVoltage[i] = config->i2c_voltage[i];
Naresh G Solankia2d40622016-08-30 20:47:13 +0530336
337 for (i = 0; i < ARRAY_SIZE(config->domain_vr_config); i++)
338 fill_vr_domain_config(params, i, &config->domain_vr_config[i]);
339
340 /* Show SPI controller if enabled in devicetree.cb */
Kyösti Mälkki903b40a2019-07-03 07:25:59 +0300341 dev = pcidev_path_on_root(PCH_DEVFN_SPI);
Angel Ponsc54dcf42019-08-30 22:14:18 +0200342 params->ShowSpiController = dev ? dev->enabled : 0;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530343
Duncan Laurief5116952018-03-26 02:24:18 -0700344 /* Enable xDCI controller if enabled in devicetree and allowed */
Kyösti Mälkki903b40a2019-07-03 07:25:59 +0300345 dev = pcidev_path_on_root(PCH_DEVFN_USBOTG);
Angel Ponsc54dcf42019-08-30 22:14:18 +0200346 if (dev) {
347 if (!xdci_can_enable())
348 dev->enabled = 0;
349 params->XdciEnable = dev->enabled;
350 } else {
351 params->XdciEnable = 0;
352 }
Duncan Laurief5116952018-03-26 02:24:18 -0700353
Maxim Polyakov03ddd192019-08-30 18:04:02 +0300354 /* Enable or disable Gaussian Mixture Model in devicetree */
355 dev = pcidev_path_on_root(SA_DEVFN_GMM);
356 params->GmmEnable = dev ? dev->enabled : 0;
357
Rizwan Qureshi64670142016-11-23 15:25:19 +0530358 /*
359 * Send VR specific mailbox commands:
360 * 000b - no VR specific command sent
361 * 001b - VR mailbox command specifically for the MPS IMPV8 VR
Lee Leahyf4c4ab92017-03-16 17:08:03 -0700362 * will be sent
Rizwan Qureshi64670142016-11-23 15:25:19 +0530363 * 010b - VR specific command sent for PS4 exit issue
364 * 100b - VR specific command sent for MPS VR decay issue
365 */
366 params->SendVrMbxCmd1 = config->SendVrMbxCmd;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530367
Rizwan Qureshib3e18c72017-09-25 17:35:15 +0530368 /*
369 * Activates VR mailbox command for Intersil VR C-state issues.
370 * 0 - no mailbox command sent.
371 * 1 - VR mailbox command sent for IA/GT rails only.
372 * 2 - VR mailbox command sent for IA/GT/SA rails.
373 */
374 params->IslVrCmd = config->IslVrCmd;
375
Duncan Laurieb2aac852017-03-07 19:12:02 -0800376 /* Acoustic Noise Mitigation */
377 params->AcousticNoiseMitigation = config->AcousticNoiseMitigation;
378 params->SlowSlewRateForIa = config->SlowSlewRateForIa;
379 params->SlowSlewRateForGt = config->SlowSlewRateForGt;
380 params->SlowSlewRateForSa = config->SlowSlewRateForSa;
381 params->FastPkgCRampDisableIa = config->FastPkgCRampDisableIa;
382 params->FastPkgCRampDisableGt = config->FastPkgCRampDisableGt;
383 params->FastPkgCRampDisableSa = config->FastPkgCRampDisableSa;
384
Rizwan Qureshiffe58102017-02-10 15:58:24 +0530385 /* Enable PMC XRAM read */
386 tconfig->PchPmPmcReadDisable = config->PchPmPmcReadDisable;
387
Subrata Banik6b45ee42017-05-12 11:43:57 +0530388 /* Enable/Disable EIST */
389 tconfig->Eist = config->eist_enable;
390
marxwangec5a9472017-12-11 14:57:49 +0800391 /* Set TccActivationOffset */
392 tconfig->TccActivationOffset = config->tcc_offset;
393
Angel Pons4ff63d32019-08-30 20:05:33 +0200394 /* Already handled in coreboot code, so tell FSP to ignore UPDs */
395 params->PchIoApicBdfValid = 0;
396
Nico Huber2afe4dc2017-09-19 09:36:03 +0200397 /* Enable VT-d and X2APIC */
398 if (!config->ignore_vtd && soc_is_vtd_capable()) {
399 params->VtdBaseAddress[0] = GFXVT_BASE_ADDRESS;
400 params->VtdBaseAddress[1] = VTVC0_BASE_ADDRESS;
401 params->X2ApicOptOut = 0;
402 tconfig->VtdDisable = 0;
Nico Huber2afe4dc2017-09-19 09:36:03 +0200403 }
404
Michael Niewöhnerd60089b2019-10-26 10:44:33 +0200405 dev = pcidev_path_on_root(SA_DEVFN_IGD);
406 if (CONFIG(RUN_FSP_GOP) && dev && dev->enabled)
407 params->PeiGraphicsPeimInit = 1;
408 else
409 params->PeiGraphicsPeimInit = 0;
410
Naresh G Solankia2d40622016-08-30 20:47:13 +0530411 soc_irq_settings(params);
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530412}
Lee Leahyb0005132015-05-12 18:19:47 -0700413
Naresh G Solankia2d40622016-08-30 20:47:13 +0530414/* Mainboard GPIO Configuration */
Aaron Durbin64031672018-04-21 14:45:32 -0600415__weak void mainboard_silicon_init_params(FSP_S_CONFIG *params)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530416{
417 printk(BIOS_DEBUG, "WEAK: %s/%s called\n", __FILE__, __func__);
418}