blob: 728b023c701846258c3d38c9689f830d6981f08e [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
Kyösti Mälkki4949a3d2021-01-09 20:38:43 +02003#include <bootsplash.h>
Wim Vervoornd1371502019-12-17 14:10:16 +01004#include <cbmem.h>
Rizwan Qureshi1222a732016-08-23 14:31:23 +05305#include <fsp/api.h>
Furquan Shaikh76cedd22020-05-02 10:24:23 -07006#include <acpi/acpi.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +05307#include <console/console.h>
8#include <device/device.h>
Gaggery Tsai711fb812018-05-22 12:32:48 -07009#include <device/pci_ids.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053010#include <fsp/util.h>
Michael Niewöhner8913b782020-12-11 22:13:44 +010011#include <gpio.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>
Sumeet R Pawnikar97c54642020-05-10 01:24:11 +053017#include <intelblocks/power_limit.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>
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>
Michael Niewöhner84fde762020-11-25 16:36:18 +010030#include <soc/usb.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. */
Kyösti Mälkkicc93c6e2021-01-09 22:53:52 +020058 fsp_silicon_init();
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
Naresh G Solankia2d40622016-08-30 20:47:13 +053077static struct device_operations pci_domain_ops = {
78 .read_resources = &pci_domain_read_resources,
79 .set_resources = &pci_domain_set_resources,
80 .scan_bus = &pci_domain_scan_bus,
Julius Wernercd49cce2019-03-05 16:53:33 -080081#if CONFIG(HAVE_ACPI_TABLES)
Nico Huberc37b0e32017-09-18 20:03:46 +020082 .write_acpi_tables = &northbridge_write_acpi_tables,
83 .acpi_name = &soc_acpi_name,
Naresh G Solankia2d40622016-08-30 20:47:13 +053084#endif
85};
86
87static struct device_operations cpu_bus_ops = {
Nico Huber2f8ba692020-04-05 14:05:24 +020088 .read_resources = noop_read_resources,
89 .set_resources = noop_set_resources,
Julius Wernercd49cce2019-03-05 16:53:33 -080090#if CONFIG(HAVE_ACPI_TABLES)
Nico Huber68680dd2020-03-31 17:34:52 +020091 .acpi_fill_ssdt = generate_cpu_entries,
Naresh G Solankia2d40622016-08-30 20:47:13 +053092#endif
93};
94
Elyes HAOUAS143fb462018-05-25 12:56:45 +020095static void soc_enable(struct device *dev)
Naresh G Solankia2d40622016-08-30 20:47:13 +053096{
97 /* Set the operations if it is a special bus type */
Subrata Banik3c838c72017-12-06 18:14:01 +053098 if (dev->path.type == DEVICE_PATH_DOMAIN)
Naresh G Solankia2d40622016-08-30 20:47:13 +053099 dev->ops = &pci_domain_ops;
Subrata Banik3c838c72017-12-06 18:14:01 +0530100 else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530101 dev->ops = &cpu_bus_ops;
Michael Niewöhner8913b782020-12-11 22:13:44 +0100102 else if (dev->path.type == DEVICE_PATH_GPIO)
103 block_gpio_enable(dev);
Naresh G Solankia2d40622016-08-30 20:47:13 +0530104}
105
106struct chip_operations soc_intel_skylake_ops = {
107 CHIP_NAME("Intel 6th Gen")
108 .enable_dev = &soc_enable,
109 .init = &soc_init_pre_device,
110};
Lee Leahyb0005132015-05-12 18:19:47 -0700111
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530112/* UPD parameters to be initialized before SiliconInit */
Naresh G Solankia2d40622016-08-30 20:47:13 +0530113void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530114{
Naresh G Solankia2d40622016-08-30 20:47:13 +0530115 FSP_S_CONFIG *params = &supd->FspsConfig;
116 FSP_S_TEST_CONFIG *tconfig = &supd->FspsTestConfig;
Kyösti Mälkki4af4e7f2019-07-14 05:50:20 +0300117 struct soc_intel_skylake_config *config;
Kyösti Mälkki28dc7dc2019-07-12 13:10:19 +0300118 struct device *dev;
Patrick Georgid2990ff2018-05-03 18:06:15 +0200119 uintptr_t vbt_data = (uintptr_t)vbt_get();
Naresh G Solankia2d40622016-08-30 20:47:13 +0530120 int i;
121
Kyösti Mälkkid5f645c2019-09-28 00:20:27 +0300122 config = config_of_soc();
Naresh G Solankia2d40622016-08-30 20:47:13 +0530123
124 mainboard_silicon_init_params(params);
Sumeet R Pawnikar97c54642020-05-10 01:24:11 +0530125
126 struct soc_power_limits_config *soc_confg;
127 config_t *confg = config_of_soc();
128 soc_confg = &confg->power_limits_config;
Gaggery Tsaida6f4ae2018-01-15 15:03:01 +0800129 /* Set PsysPmax if it is available from DT */
Sumeet R Pawnikar97c54642020-05-10 01:24:11 +0530130 if (soc_confg->psys_pmax) {
Gaggery Tsaida6f4ae2018-01-15 15:03:01 +0800131 /* PsysPmax is in unit of 1/8 Watt */
Sumeet R Pawnikar97c54642020-05-10 01:24:11 +0530132 tconfig->PsysPmax = soc_confg->psys_pmax * 8;
Gaggery Tsaida6f4ae2018-01-15 15:03:01 +0800133 printk(BIOS_DEBUG, "psys_pmax = %d\n", tconfig->PsysPmax);
134 }
Naresh G Solankia2d40622016-08-30 20:47:13 +0530135
Naresh G Solankia2d40622016-08-30 20:47:13 +0530136 params->GraphicsConfigPtr = (u32) vbt_data;
137
138 for (i = 0; i < ARRAY_SIZE(config->usb2_ports); i++) {
139 params->PortUsb20Enable[i] =
140 config->usb2_ports[i].enable;
141 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;
Michael Niewöhner056d5522020-09-04 15:40:35 +0200149
150 if (config->usb2_ports[i].enable)
151 params->Usb2OverCurrentPin[i] = config->usb2_ports[i].ocpin;
152 else
Michael Niewöhner84fde762020-11-25 16:36:18 +0100153 params->Usb2OverCurrentPin[i] = OC_SKIP;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530154 }
155
156 for (i = 0; i < ARRAY_SIZE(config->usb3_ports); i++) {
157 params->PortUsb30Enable[i] = config->usb3_ports[i].enable;
Michael Niewöhner84fde762020-11-25 16:36:18 +0100158 if (config->usb3_ports[i].enable)
Michael Niewöhner056d5522020-09-04 15:40:35 +0200159 params->Usb3OverCurrentPin[i] = config->usb3_ports[i].ocpin;
Michael Niewöhner84fde762020-11-25 16:36:18 +0100160 else
161 params->Usb3OverCurrentPin[i] = OC_SKIP;
162
Naresh G Solankia2d40622016-08-30 20:47:13 +0530163 if (config->usb3_ports[i].tx_de_emp) {
164 params->Usb3HsioTxDeEmphEnable[i] = 1;
165 params->Usb3HsioTxDeEmph[i] =
166 config->usb3_ports[i].tx_de_emp;
167 }
168 if (config->usb3_ports[i].tx_downscale_amp) {
169 params->Usb3HsioTxDownscaleAmpEnable[i] = 1;
170 params->Usb3HsioTxDownscaleAmp[i] =
171 config->usb3_ports[i].tx_downscale_amp;
172 }
173 }
174
Felix Singer0901d032020-07-29 19:57:25 +0200175 dev = pcidev_path_on_root(PCH_DEVFN_SATA);
Felix Singere1049342020-08-11 06:34:15 +0200176 params->SataEnable = dev && dev->enabled;
Felix Singer0901d032020-07-29 19:57:25 +0200177 if (params->SataEnable) {
Felix Singer4e58ce12020-07-25 04:39:52 +0200178 memcpy(params->SataPortsEnable, config->SataPortsEnable,
179 sizeof(params->SataPortsEnable));
180 memcpy(params->SataPortsDevSlp, config->SataPortsDevSlp,
181 sizeof(params->SataPortsDevSlp));
182 memcpy(params->SataPortsHotPlug, config->SataPortsHotPlug,
183 sizeof(params->SataPortsHotPlug));
184 memcpy(params->SataPortsSpinUp, config->SataPortsSpinUp,
185 sizeof(params->SataPortsSpinUp));
186
187 params->SataSalpSupport = config->SataSalpSupport;
188 params->SataMode = config->SataMode;
189 params->SataSpeedLimit = config->SataSpeedLimit;
190 /*
191 * For unknown reasons FSP skips writing some essential SATA init registers
192 * (SIR) when SataPwrOptEnable=0. This results in link errors, "unaligned
193 * write" errors and others. Enabling this option solves these problems.
194 */
195 params->SataPwrOptEnable = 1;
196 tconfig->SataTestMode = config->SataTestMode;
197 }
198
Naresh G Solankia2d40622016-08-30 20:47:13 +0530199 memcpy(params->PcieRpClkReqSupport, config->PcieRpClkReqSupport,
200 sizeof(params->PcieRpClkReqSupport));
201 memcpy(params->PcieRpClkReqNumber, config->PcieRpClkReqNumber,
202 sizeof(params->PcieRpClkReqNumber));
Rizwan Qureshi6ab4ed42017-09-05 14:18:25 +0530203 memcpy(params->PcieRpAdvancedErrorReporting,
204 config->PcieRpAdvancedErrorReporting,
205 sizeof(params->PcieRpAdvancedErrorReporting));
Rizwan Qureshi03937392017-09-16 01:54:20 +0530206 memcpy(params->PcieRpLtrEnable, config->PcieRpLtrEnable,
207 sizeof(params->PcieRpLtrEnable));
Duncan Laurie74ea48e2018-01-29 12:00:47 -0800208 memcpy(params->PcieRpHotPlug, config->PcieRpHotPlug,
209 sizeof(params->PcieRpHotPlug));
Wim Vervoorn5819eab2020-05-07 13:16:32 +0200210 for (i = 0; i < CONFIG_MAX_ROOT_PORTS; i++) {
Wim Vervoornd6b682c2020-05-07 12:41:13 +0200211 params->PcieRpMaxPayload[i] = config->PcieRpMaxPayload[i];
Benjamin Doronb53858b2020-10-12 04:19:42 +0000212 if (config->pcie_rp_aspm[i])
213 params->PcieRpAspm[i] = config->pcie_rp_aspm[i] - 1;
Benjamin Doronadcb8702020-03-14 01:53:25 +0000214 if (config->pcie_rp_l1substates[i])
215 params->PcieRpL1Substates[i] = config->pcie_rp_l1substates[i] - 1;
Wim Vervoorn5819eab2020-05-07 13:16:32 +0200216 }
Naresh G Solankia2d40622016-08-30 20:47:13 +0530217
Divya Chellape7fb7ce2017-12-19 20:16:50 +0530218 /*
219 * PcieRpClkSrcNumber UPD is set to clock source number(0-6) for
220 * all the enabled PCIe root ports, invalid(0x1F) is set for
221 * disabled PCIe root ports.
222 */
223 for (i = 0; i < CONFIG_MAX_ROOT_PORTS; i++) {
224 if (config->PcieRpClkReqSupport[i])
225 params->PcieRpClkSrcNumber[i] =
226 config->PcieRpClkSrcNumber[i];
227 else
228 params->PcieRpClkSrcNumber[i] = 0x1F;
229 }
230
Naresh G Solankieedf6d82016-11-16 21:27:38 +0530231 /* disable Legacy PME */
232 memset(params->PcieRpPmSci, 0, sizeof(params->PcieRpPmSci));
233
Subrata Banik10a94322019-07-08 14:49:22 +0530234 /* Legacy 8254 timer support */
Martin Rothc25c1eb2020-07-24 12:26:21 -0600235 params->Early8254ClockGatingEnable = !CONFIG(USE_LEGACY_8254_TIMER);
Subrata Banik10a94322019-07-08 14:49:22 +0530236
Michael Niewöhnera1843d82020-10-02 18:28:22 +0200237 params->EnableTcoTimer = CONFIG(USE_PM_ACPI_TIMER);
238
Naresh G Solankia2d40622016-08-30 20:47:13 +0530239 memcpy(params->SerialIoDevMode, config->SerialIoDevMode,
240 sizeof(params->SerialIoDevMode));
241
Felix Singere2186672020-07-29 23:20:52 +0200242 dev = pcidev_path_on_root(PCH_DEVFN_CIO);
243 params->PchCio2Enable = dev && dev->enabled;
Felix Singer4d5c4e02020-07-29 22:28:37 +0200244
245 dev = pcidev_path_on_root(SA_DEVFN_IMGU);
246 params->SaImguEnable = dev && dev->enabled;
Felix Singer91dfb922020-07-25 14:01:52 +0200247
Benjamin Dorond0701c92020-12-07 22:56:47 +0000248 dev = pcidev_path_on_root(SA_DEVFN_CHAP);
249 tconfig->ChapDeviceEnable = dev && dev->enabled;
250
Felix Singer91dfb922020-07-25 14:01:52 +0200251 dev = pcidev_path_on_root(PCH_DEVFN_CSE_3);
Felix Singere1049342020-08-11 06:34:15 +0200252 params->Heci3Enabled = dev && dev->enabled;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530253
Julius Wernercd49cce2019-03-05 16:53:33 -0800254 params->CpuConfig.Bits.VmxEnable = CONFIG(ENABLE_VMX);
Naresh G Solankia2d40622016-08-30 20:47:13 +0530255
256 params->PchPmWoWlanEnable = config->PchPmWoWlanEnable;
257 params->PchPmWoWlanDeepSxEnable = config->PchPmWoWlanDeepSxEnable;
258 params->PchPmLanWakeFromDeepSx = config->WakeConfigPcieWakeFromDeepSx;
259
Felix Singer57c81432020-07-25 07:50:51 +0200260 dev = pcidev_path_on_root(PCH_DEVFN_GBE);
Felix Singere1049342020-08-11 06:34:15 +0200261 params->PchLanEnable = dev && dev->enabled;
Felix Singer57c81432020-07-25 07:50:51 +0200262 if (params->PchLanEnable) {
Duncan Laurie14485ef2017-12-13 13:58:35 -0800263 params->PchLanLtrEnable = config->EnableLanLtr;
264 params->PchLanK1OffEnable = config->EnableLanK1Off;
265 params->PchLanClkReqSupported = config->LanClkReqSupported;
266 params->PchLanClkReqNumber = config->LanClkReqNumber;
267 }
Naresh G Solankia2d40622016-08-30 20:47:13 +0530268 params->SsicPortEnable = config->SsicPortEnable;
Felix Singeraff69be2020-07-25 13:37:17 +0200269
270 dev = pcidev_path_on_root(PCH_DEVFN_EMMC);
Felix Singere1049342020-08-11 06:34:15 +0200271 params->ScsEmmcEnabled = dev && dev->enabled;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530272 params->ScsEmmcHs400Enabled = config->ScsEmmcHs400Enabled;
Felix Singer52919522020-07-29 21:44:36 +0200273
274 dev = pcidev_path_on_root(PCH_DEVFN_SDCARD);
275 params->ScsSdCardEnabled = dev && dev->enabled;
li feng21066382018-05-22 12:49:53 -0700276
Pratik Prajapatie0722472018-08-22 18:58:38 -0700277 if (!!params->ScsEmmcHs400Enabled && !!config->EmmcHs400DllNeed) {
278 params->PchScsEmmcHs400DllDataValid =
279 !!config->EmmcHs400DllNeed;
280 params->PchScsEmmcHs400RxStrobeDll1 =
281 config->ScsEmmcHs400RxStrobeDll1;
282 params->PchScsEmmcHs400TxDataDll =
283 config->ScsEmmcHs400TxDataDll;
284 }
285
li feng21066382018-05-22 12:49:53 -0700286 /* If ISH is enabled, enable ISH elements */
Kyösti Mälkki903b40a2019-07-03 07:25:59 +0300287 dev = pcidev_path_on_root(PCH_DEVFN_ISH);
Felix Singere1049342020-08-11 06:34:15 +0200288 params->PchIshEnable = dev && dev->enabled;
li feng21066382018-05-22 12:49:53 -0700289
Felix Singer048d9b52020-07-25 14:31:58 +0200290 dev = pcidev_path_on_root(PCH_DEVFN_HDA);
Felix Singere1049342020-08-11 06:34:15 +0200291 params->PchHdaEnable = dev && dev->enabled;
Felix Singer048d9b52020-07-25 14:31:58 +0200292
Michael Niewöhner62385632019-09-23 14:38:41 +0200293 params->PchHdaVcType = config->PchHdaVcType;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530294 params->PchHdaIoBufferOwnership = config->IoBufferOwnership;
295 params->PchHdaDspEnable = config->DspEnable;
Felix Singer9c1c0092020-07-29 20:48:08 +0200296
297 dev = pcidev_path_on_root(SA_DEVFN_TS);
298 params->Device4Enable = dev && dev->enabled;
Benjamin Doronac656522020-11-05 22:20:52 +0000299 dev = pcidev_path_on_root(PCH_DEVFN_THERMAL);
300 params->PchThermalDeviceEnable = dev && dev->enabled;
Matt DeVillier9e0d69b2017-10-10 14:03:36 -0500301
Naresh G Solankia2d40622016-08-30 20:47:13 +0530302 tconfig->PchLockDownGlobalSmi = config->LockDownConfigGlobalSmi;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530303 tconfig->PchLockDownRtcLock = config->LockDownConfigRtcLock;
Angel Pons950cdbc2020-12-11 17:00:42 +0100304 tconfig->PowerLimit4 = 0;
Barnali Sarkarfbf10182017-08-11 18:38:38 +0530305 /*
306 * To disable HECI, the Psf needs to be left unlocked
307 * by FSP till end of post sequence. Based on the devicetree
308 * setting, we set the appropriate PsfUnlock policy in FSP,
309 * do the changes and then lock it back in coreboot during finalize.
310 */
311 tconfig->PchSbAccessUnlock = (config->HeciEnabled == 0) ? 1 : 0;
Subrata Banikc4986eb2018-05-09 14:55:09 +0530312 if (get_lockdown_config() == CHIPSET_LOCKDOWN_COREBOOT) {
Subrata Banikc204aaa2017-08-17 15:49:58 +0530313 tconfig->PchLockDownBiosInterface = 0;
314 params->PchLockDownBiosLock = 0;
315 params->PchLockDownSpiEiss = 0;
316 /*
317 * Skip Spi Flash Lockdown from inside FSP.
318 * Making this config "0" means FSP won't set the FLOCKDN bit
319 * of SPIBAR + 0x04 (i.e., Bit 15 of BIOS_HSFSTS_CTL).
320 * So, it becomes coreboot's responsibility to set this bit
321 * before end of POST for security concerns.
322 */
323 params->SpiFlashCfgLockDown = 0;
324 }
Benjamin Dorondc667982020-10-16 18:07:13 +0000325 /* FSP should let coreboot set subsystem IDs, which are read/write-once */
326 params->DefaultSvid = 0;
327 params->PchSubSystemVendorId = 0;
328 params->DefaultSid = 0;
329 params->PchSubSystemId = 0;
Elyes HAOUASb58e99d2019-01-23 12:04:43 +0100330
Naresh G Solankia2d40622016-08-30 20:47:13 +0530331 params->PchPmWolEnableOverride = config->WakeConfigWolEnableOverride;
332 params->PchPmPcieWakeFromDeepSx = config->WakeConfigPcieWakeFromDeepSx;
333 params->PchPmDeepSxPol = config->PmConfigDeepSxPol;
Duncan Laurie25c7d932017-02-17 17:16:43 -0800334 params->PchPmSlpS0Enable = config->s0ix_enable;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530335 params->PchPmSlpS3MinAssert = config->PmConfigSlpS3MinAssert;
336 params->PchPmSlpS4MinAssert = config->PmConfigSlpS4MinAssert;
337 params->PchPmSlpSusMinAssert = config->PmConfigSlpSusMinAssert;
338 params->PchPmSlpAMinAssert = config->PmConfigSlpAMinAssert;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530339 params->PchPmSlpStrchSusUp = config->PmConfigSlpStrchSusUp;
340 params->PchPmPwrBtnOverridePeriod =
341 config->PmConfigPwrBtnOverridePeriod;
342 params->PchPmPwrCycDur = config->PmConfigPwrCycDur;
Rizwan Qureshi0da186c2017-02-23 14:43:39 +0530343
344 /* Indicate whether platform supports Voltage Margining */
345 params->PchPmSlpS0VmEnable = config->PchPmSlpS0VmEnable;
346
Nico Huber44e89af2019-02-23 19:24:51 +0100347 params->PchSirqEnable = config->serirq_mode != SERIRQ_OFF;
348 params->PchSirqMode = config->serirq_mode == SERIRQ_CONTINUOUS;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530349
Martin Rothc25c1eb2020-07-24 12:26:21 -0600350 params->CpuConfig.Bits.SkipMpInit = !CONFIG(USE_INTEL_FSP_MP_INIT);
Naresh G Solankia2d40622016-08-30 20:47:13 +0530351
Subrata Banikc4986eb2018-05-09 14:55:09 +0530352 for (i = 0; i < ARRAY_SIZE(config->i2c_voltage); i++)
Aaron Durbined14a4e2016-11-09 17:04:15 -0600353 params->SerialIoI2cVoltage[i] = config->i2c_voltage[i];
Naresh G Solankia2d40622016-08-30 20:47:13 +0530354
355 for (i = 0; i < ARRAY_SIZE(config->domain_vr_config); i++)
356 fill_vr_domain_config(params, i, &config->domain_vr_config[i]);
357
358 /* Show SPI controller if enabled in devicetree.cb */
Kyösti Mälkki903b40a2019-07-03 07:25:59 +0300359 dev = pcidev_path_on_root(PCH_DEVFN_SPI);
Felix Singere1049342020-08-11 06:34:15 +0200360 params->ShowSpiController = dev && dev->enabled;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530361
Duncan Laurief5116952018-03-26 02:24:18 -0700362 /* Enable xDCI controller if enabled in devicetree and allowed */
Kyösti Mälkki903b40a2019-07-03 07:25:59 +0300363 dev = pcidev_path_on_root(PCH_DEVFN_USBOTG);
Angel Ponsc54dcf42019-08-30 22:14:18 +0200364 if (dev) {
365 if (!xdci_can_enable())
366 dev->enabled = 0;
367 params->XdciEnable = dev->enabled;
368 } else {
369 params->XdciEnable = 0;
370 }
Duncan Laurief5116952018-03-26 02:24:18 -0700371
Maxim Polyakov03ddd192019-08-30 18:04:02 +0300372 /* Enable or disable Gaussian Mixture Model in devicetree */
373 dev = pcidev_path_on_root(SA_DEVFN_GMM);
Felix Singere1049342020-08-11 06:34:15 +0200374 params->GmmEnable = dev && dev->enabled;
Maxim Polyakov03ddd192019-08-30 18:04:02 +0300375
Rizwan Qureshi64670142016-11-23 15:25:19 +0530376 /*
377 * Send VR specific mailbox commands:
378 * 000b - no VR specific command sent
379 * 001b - VR mailbox command specifically for the MPS IMPV8 VR
Lee Leahyf4c4ab92017-03-16 17:08:03 -0700380 * will be sent
Rizwan Qureshi64670142016-11-23 15:25:19 +0530381 * 010b - VR specific command sent for PS4 exit issue
382 * 100b - VR specific command sent for MPS VR decay issue
383 */
384 params->SendVrMbxCmd1 = config->SendVrMbxCmd;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530385
Rizwan Qureshib3e18c72017-09-25 17:35:15 +0530386 /*
387 * Activates VR mailbox command for Intersil VR C-state issues.
388 * 0 - no mailbox command sent.
389 * 1 - VR mailbox command sent for IA/GT rails only.
390 * 2 - VR mailbox command sent for IA/GT/SA rails.
391 */
392 params->IslVrCmd = config->IslVrCmd;
393
Duncan Laurieb2aac852017-03-07 19:12:02 -0800394 /* Acoustic Noise Mitigation */
395 params->AcousticNoiseMitigation = config->AcousticNoiseMitigation;
396 params->SlowSlewRateForIa = config->SlowSlewRateForIa;
397 params->SlowSlewRateForGt = config->SlowSlewRateForGt;
398 params->SlowSlewRateForSa = config->SlowSlewRateForSa;
399 params->FastPkgCRampDisableIa = config->FastPkgCRampDisableIa;
400 params->FastPkgCRampDisableGt = config->FastPkgCRampDisableGt;
401 params->FastPkgCRampDisableSa = config->FastPkgCRampDisableSa;
402
Rizwan Qureshiffe58102017-02-10 15:58:24 +0530403 /* Enable PMC XRAM read */
404 tconfig->PchPmPmcReadDisable = config->PchPmPmcReadDisable;
405
Subrata Banik6b45ee42017-05-12 11:43:57 +0530406 /* Enable/Disable EIST */
407 tconfig->Eist = config->eist_enable;
408
marxwangec5a9472017-12-11 14:57:49 +0800409 /* Set TccActivationOffset */
410 tconfig->TccActivationOffset = config->tcc_offset;
411
Angel Pons4ff63d32019-08-30 20:05:33 +0200412 /* Already handled in coreboot code, so tell FSP to ignore UPDs */
413 params->PchIoApicBdfValid = 0;
414
Nico Huber2afe4dc2017-09-19 09:36:03 +0200415 /* Enable VT-d and X2APIC */
416 if (!config->ignore_vtd && soc_is_vtd_capable()) {
417 params->VtdBaseAddress[0] = GFXVT_BASE_ADDRESS;
418 params->VtdBaseAddress[1] = VTVC0_BASE_ADDRESS;
419 params->X2ApicOptOut = 0;
420 tconfig->VtdDisable = 0;
Nico Huber2afe4dc2017-09-19 09:36:03 +0200421 }
422
Michael Niewöhnerd60089b2019-10-26 10:44:33 +0200423 dev = pcidev_path_on_root(SA_DEVFN_IGD);
424 if (CONFIG(RUN_FSP_GOP) && dev && dev->enabled)
425 params->PeiGraphicsPeimInit = 1;
426 else
427 params->PeiGraphicsPeimInit = 0;
428
Benjamin Doronbbb81232020-06-28 02:43:53 +0000429 params->PavpEnable = CONFIG(PAVP);
430
Naresh G Solankia2d40622016-08-30 20:47:13 +0530431 soc_irq_settings(params);
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530432}
Lee Leahyb0005132015-05-12 18:19:47 -0700433
Felix Singer3616e9c2020-11-25 20:10:49 +0000434/* Mainboard FSP Configuration */
Aaron Durbin64031672018-04-21 14:45:32 -0600435__weak void mainboard_silicon_init_params(FSP_S_CONFIG *params)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530436{
437 printk(BIOS_DEBUG, "WEAK: %s/%s called\n", __FILE__, __func__);
438}
Wim Vervoornd1371502019-12-17 14:10:16 +0100439
440/* Handle FSP logo params */
Kyösti Mälkki4949a3d2021-01-09 20:38:43 +0200441void soc_load_logo(FSPS_UPD *supd)
Wim Vervoornd1371502019-12-17 14:10:16 +0100442{
Kyösti Mälkki4949a3d2021-01-09 20:38:43 +0200443 bmp_load_logo(&supd->FspsConfig.LogoPtr, &supd->FspsConfig.LogoSize);
Wim Vervoornd1371502019-12-17 14:10:16 +0100444}