blob: d179598699e28f37cdaffc250a7fb508c6b78028 [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>
18#include <device/pci.h>
19#include <fsp/api.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053020#include <arch/acpi.h>
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +020021#include <device/pci_ops.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053022#include <console/console.h>
23#include <device/device.h>
Gaggery Tsai711fb812018-05-22 12:32:48 -070024#include <device/pci_ids.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053025#include <fsp/util.h>
Subrata Banikf699c142018-06-08 17:57:37 +053026#include <intelblocks/chip.h>
Subrata Banik46caf092018-09-28 19:54:30 +053027#include <intelblocks/itss.h>
Nico Huber44e89af2019-02-23 19:24:51 +010028#include <intelblocks/lpc_lib.h>
Subrata Banikcf32fd12018-12-19 18:02:17 +053029#include <intelblocks/mp_init.h>
Duncan Laurief5116952018-03-26 02:24:18 -070030#include <intelblocks/xdci.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
Gaggery Tsai711fb812018-05-22 12:32:48 -070046struct pcie_entry {
47 unsigned int devfn;
48 unsigned int func_count;
49};
50
51/*
52 * According to table 2-2 in doc#546717:
53 * PCI bus[function] ID
54 * D28:[F0 - F7] 0xA110 - 0xA117
55 * D29:[F0 - F7] 0xA118 - 0xA11F
56 * D27:[F0 - F3] 0xA167 - 0xA16A
57 */
58static const struct pcie_entry pcie_table_skl_pch_h[] = {
59 {PCH_DEVFN_PCIE1, 8},
60 {PCH_DEVFN_PCIE9, 8},
61 {PCH_DEVFN_PCIE17, 4},
62};
63
64/*
65 * According to table 2-2 in doc#564464:
66 * PCI bus[function] ID
67 * D28:[F0 - F7] 0xA290 - 0xA297
68 * D29:[F0 - F7] 0xA298 - 0xA29F
69 * D27:[F0 - F7] 0xA2E7 - 0xA2EE
70 */
71static const struct pcie_entry pcie_table_kbl_pch_h[] = {
72 {PCH_DEVFN_PCIE1, 8},
73 {PCH_DEVFN_PCIE9, 8},
74 {PCH_DEVFN_PCIE17, 8},
75};
76
77/*
78 * According to table 2-2 in doc#567995/545659:
79 * PCI bus[function] ID
80 * D28:[F0 - F7] 0x9D10 - 0x9D17
81 * D29:[F0 - F3] 0x9D18 - 0x9D1B
82 */
83static const struct pcie_entry pcie_table_skl_pch_lp[] = {
84 {PCH_DEVFN_PCIE1, 8},
85 {PCH_DEVFN_PCIE9, 4},
86};
87
88/*
89 * If the PCIe root port at function 0 is disabled,
90 * the PCIe root ports might be coalesced after FSP silicon init.
91 * The below function will swap the devfn of the first enabled device
92 * in devicetree and function 0 resides a pci device
93 * so that it won't confuse coreboot.
94 */
95static void pcie_update_device_tree(const struct pcie_entry *pcie_rp_group,
96 size_t pci_groups)
97{
98 struct device *func0;
99 unsigned int devfn, devfn0;
100 int i, group;
101 unsigned int inc = PCI_DEVFN(0, 1);
102
103 for (group = 0; group < pci_groups; group++) {
104 devfn0 = pcie_rp_group[group].devfn;
105 func0 = dev_find_slot(0, devfn0);
106 if (func0 == NULL)
107 continue;
108
109 /* No more functions if function 0 is disabled. */
110 if (pci_read_config32(func0, PCI_VENDOR_ID) == 0xffffffff)
111 continue;
112
113 devfn = devfn0 + inc;
114
115 /*
116 * Increase function by 1.
117 * Then find first enabled device to replace func0
118 * as that port was move to func0.
119 */
120 for (i = 1; i < pcie_rp_group[group].func_count;
121 i++, devfn += inc) {
122 struct device *dev = dev_find_slot(0, devfn);
123 if (dev == NULL || !dev->enabled)
124 continue;
125
126 /*
127 * Found the first enabled device in
128 * a given dev number.
129 */
130 printk(BIOS_INFO, "PCI func %d was swapped"
131 " to func 0.\n", i);
132 func0->path.pci.devfn = dev->path.pci.devfn;
133 dev->path.pci.devfn = devfn0;
134 break;
135 }
136 }
137}
138
139static void pcie_override_devicetree_after_silicon_init(void)
140{
141 uint16_t id, id_mask;
142
143 id = pci_read_config16(PCH_DEV_PCIE1, PCI_DEVICE_ID);
144 /*
145 * We may read an ID other than func 0 after FSP-S.
146 * Strip out 4 least significant bits.
147 */
148 id_mask = id & ~0xf;
149 printk(BIOS_INFO, "Override DT after FSP-S, PCH is ");
150 if (id_mask == (PCI_DEVICE_ID_INTEL_SPT_LP_PCIE_RP1 & ~0xf)) {
151 printk(BIOS_INFO, "KBL/SKL PCH-LP SKU\n");
152 pcie_update_device_tree(&pcie_table_skl_pch_lp[0],
153 ARRAY_SIZE(pcie_table_skl_pch_lp));
154 } else if (id_mask == (PCI_DEVICE_ID_INTEL_KBP_H_PCIE_RP1 & ~0xf)) {
155 printk(BIOS_INFO, "KBL PCH-H SKU\n");
156 pcie_update_device_tree(&pcie_table_kbl_pch_h[0],
157 ARRAY_SIZE(pcie_table_kbl_pch_h));
158 } else if (id_mask == (PCI_DEVICE_ID_INTEL_SPT_H_PCIE_RP1 & ~0xf)) {
159 printk(BIOS_INFO, "SKL PCH-H SKU\n");
160 pcie_update_device_tree(&pcie_table_skl_pch_h[0],
161 ARRAY_SIZE(pcie_table_skl_pch_h));
162 } else {
163 printk(BIOS_ERR, "[BUG] PCIE Root Port id 0x%x"
164 " is not found\n", id);
165 return;
166 }
167}
168
Naresh G Solankia2d40622016-08-30 20:47:13 +0530169void soc_init_pre_device(void *chip_info)
170{
Subrata Banik46caf092018-09-28 19:54:30 +0530171 /* Snapshot the current GPIO IRQ polarities. FSP is setting a
172 * default policy that doesn't honor boards' requirements. */
173 itss_snapshot_irq_polarities(GPIO_IRQ_START, GPIO_IRQ_END);
174
Naresh G Solankia2d40622016-08-30 20:47:13 +0530175 /* Perform silicon specific init. */
Aaron Durbin6c191d82016-11-29 21:22:42 -0600176 fsp_silicon_init(romstage_handoff_is_resume());
Subrata Banik46caf092018-09-28 19:54:30 +0530177
178 /* Restore GPIO IRQ polarities back to previous settings. */
179 itss_restore_irq_polarities(GPIO_IRQ_START, GPIO_IRQ_END);
180
Gaggery Tsai711fb812018-05-22 12:32:48 -0700181 /* swap enabled PCI ports in device tree if needed */
182 pcie_override_devicetree_after_silicon_init();
Naresh G Solankia2d40622016-08-30 20:47:13 +0530183}
184
Furquan Shaikhc2480442017-02-20 13:41:56 -0800185void soc_fsp_load(void)
186{
187 fsps_load(romstage_handoff_is_resume());
188}
189
Elyes HAOUAS143fb462018-05-25 12:56:45 +0200190static void pci_domain_set_resources(struct device *dev)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530191{
192 assign_resources(dev->link_list);
193}
194
195static struct device_operations pci_domain_ops = {
196 .read_resources = &pci_domain_read_resources,
197 .set_resources = &pci_domain_set_resources,
198 .scan_bus = &pci_domain_scan_bus,
Julius Wernercd49cce2019-03-05 16:53:33 -0800199#if CONFIG(HAVE_ACPI_TABLES)
Nico Huberc37b0e32017-09-18 20:03:46 +0200200 .write_acpi_tables = &northbridge_write_acpi_tables,
201 .acpi_name = &soc_acpi_name,
Naresh G Solankia2d40622016-08-30 20:47:13 +0530202#endif
203};
204
205static struct device_operations cpu_bus_ops = {
206 .read_resources = DEVICE_NOOP,
207 .set_resources = DEVICE_NOOP,
208 .enable_resources = DEVICE_NOOP,
Subrata Banika4b11e5c2017-02-03 18:57:49 +0530209 .init = DEVICE_NOOP,
Julius Wernercd49cce2019-03-05 16:53:33 -0800210#if CONFIG(HAVE_ACPI_TABLES)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530211 .acpi_fill_ssdt_generator = generate_cpu_entries,
212#endif
213};
214
Elyes HAOUAS143fb462018-05-25 12:56:45 +0200215static void soc_enable(struct device *dev)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530216{
217 /* Set the operations if it is a special bus type */
Subrata Banik3c838c72017-12-06 18:14:01 +0530218 if (dev->path.type == DEVICE_PATH_DOMAIN)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530219 dev->ops = &pci_domain_ops;
Subrata Banik3c838c72017-12-06 18:14:01 +0530220 else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530221 dev->ops = &cpu_bus_ops;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530222}
223
224struct chip_operations soc_intel_skylake_ops = {
225 CHIP_NAME("Intel 6th Gen")
226 .enable_dev = &soc_enable,
227 .init = &soc_init_pre_device,
228};
Lee Leahyb0005132015-05-12 18:19:47 -0700229
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530230/* UPD parameters to be initialized before SiliconInit */
Naresh G Solankia2d40622016-08-30 20:47:13 +0530231void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530232{
Naresh G Solankia2d40622016-08-30 20:47:13 +0530233 FSP_S_CONFIG *params = &supd->FspsConfig;
234 FSP_S_TEST_CONFIG *tconfig = &supd->FspsTestConfig;
235 static struct soc_intel_skylake_config *config;
Patrick Georgid2990ff2018-05-03 18:06:15 +0200236 uintptr_t vbt_data = (uintptr_t)vbt_get();
Naresh G Solankia2d40622016-08-30 20:47:13 +0530237 int i;
238
Naresh G Solankia2d40622016-08-30 20:47:13 +0530239 struct device *dev = SA_DEV_ROOT;
240 if (!dev || !dev->chip_info) {
241 printk(BIOS_ERR, "BUG! Could not find SOC devicetree config\n");
242 return;
243 }
244 config = dev->chip_info;
245
246 mainboard_silicon_init_params(params);
Gaggery Tsaida6f4ae2018-01-15 15:03:01 +0800247 /* Set PsysPmax if it is available from DT */
248 if (config->psys_pmax) {
249 /* PsysPmax is in unit of 1/8 Watt */
250 tconfig->PsysPmax = config->psys_pmax * 8;
251 printk(BIOS_DEBUG, "psys_pmax = %d\n", tconfig->PsysPmax);
252 }
Naresh G Solankia2d40622016-08-30 20:47:13 +0530253
Naresh G Solankia2d40622016-08-30 20:47:13 +0530254 params->GraphicsConfigPtr = (u32) vbt_data;
255
256 for (i = 0; i < ARRAY_SIZE(config->usb2_ports); i++) {
257 params->PortUsb20Enable[i] =
258 config->usb2_ports[i].enable;
Subrata Banik2c3054c2016-11-22 20:21:49 +0530259 params->Usb2OverCurrentPin[i] =
260 config->usb2_ports[i].ocpin;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530261 params->Usb2AfePetxiset[i] =
262 config->usb2_ports[i].pre_emp_bias;
263 params->Usb2AfeTxiset[i] =
264 config->usb2_ports[i].tx_bias;
265 params->Usb2AfePredeemp[i] =
266 config->usb2_ports[i].tx_emp_enable;
267 params->Usb2AfePehalfbit[i] =
268 config->usb2_ports[i].pre_emp_bit;
269 }
270
271 for (i = 0; i < ARRAY_SIZE(config->usb3_ports); i++) {
272 params->PortUsb30Enable[i] = config->usb3_ports[i].enable;
Subrata Banik2c3054c2016-11-22 20:21:49 +0530273 params->Usb3OverCurrentPin[i] = config->usb3_ports[i].ocpin;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530274 if (config->usb3_ports[i].tx_de_emp) {
275 params->Usb3HsioTxDeEmphEnable[i] = 1;
276 params->Usb3HsioTxDeEmph[i] =
277 config->usb3_ports[i].tx_de_emp;
278 }
279 if (config->usb3_ports[i].tx_downscale_amp) {
280 params->Usb3HsioTxDownscaleAmpEnable[i] = 1;
281 params->Usb3HsioTxDownscaleAmp[i] =
282 config->usb3_ports[i].tx_downscale_amp;
283 }
284 }
285
286 memcpy(params->SataPortsEnable, config->SataPortsEnable,
287 sizeof(params->SataPortsEnable));
288 memcpy(params->SataPortsDevSlp, config->SataPortsDevSlp,
289 sizeof(params->SataPortsDevSlp));
290 memcpy(params->PcieRpClkReqSupport, config->PcieRpClkReqSupport,
291 sizeof(params->PcieRpClkReqSupport));
292 memcpy(params->PcieRpClkReqNumber, config->PcieRpClkReqNumber,
293 sizeof(params->PcieRpClkReqNumber));
Rizwan Qureshi6ab4ed42017-09-05 14:18:25 +0530294 memcpy(params->PcieRpAdvancedErrorReporting,
295 config->PcieRpAdvancedErrorReporting,
296 sizeof(params->PcieRpAdvancedErrorReporting));
Rizwan Qureshi03937392017-09-16 01:54:20 +0530297 memcpy(params->PcieRpLtrEnable, config->PcieRpLtrEnable,
298 sizeof(params->PcieRpLtrEnable));
Duncan Laurie74ea48e2018-01-29 12:00:47 -0800299 memcpy(params->PcieRpHotPlug, config->PcieRpHotPlug,
300 sizeof(params->PcieRpHotPlug));
Naresh G Solankia2d40622016-08-30 20:47:13 +0530301
Divya Chellape7fb7ce2017-12-19 20:16:50 +0530302 /*
303 * PcieRpClkSrcNumber UPD is set to clock source number(0-6) for
304 * all the enabled PCIe root ports, invalid(0x1F) is set for
305 * disabled PCIe root ports.
306 */
307 for (i = 0; i < CONFIG_MAX_ROOT_PORTS; i++) {
308 if (config->PcieRpClkReqSupport[i])
309 params->PcieRpClkSrcNumber[i] =
310 config->PcieRpClkSrcNumber[i];
311 else
312 params->PcieRpClkSrcNumber[i] = 0x1F;
313 }
314
Naresh G Solankieedf6d82016-11-16 21:27:38 +0530315 /* disable Legacy PME */
316 memset(params->PcieRpPmSci, 0, sizeof(params->PcieRpPmSci));
317
Naresh G Solankia2d40622016-08-30 20:47:13 +0530318 memcpy(params->SerialIoDevMode, config->SerialIoDevMode,
319 sizeof(params->SerialIoDevMode));
320
321 params->PchCio2Enable = config->Cio2Enable;
Rizwan Qureshic2c8a742017-01-13 22:04:11 +0530322 params->SaImguEnable = config->SaImguEnable;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530323 params->Heci3Enabled = config->Heci3Enabled;
324
325 params->LogoPtr = config->LogoPtr;
326 params->LogoSize = config->LogoSize;
327
Julius Wernercd49cce2019-03-05 16:53:33 -0800328 params->CpuConfig.Bits.VmxEnable = CONFIG(ENABLE_VMX);
Naresh G Solankia2d40622016-08-30 20:47:13 +0530329
330 params->PchPmWoWlanEnable = config->PchPmWoWlanEnable;
331 params->PchPmWoWlanDeepSxEnable = config->PchPmWoWlanDeepSxEnable;
332 params->PchPmLanWakeFromDeepSx = config->WakeConfigPcieWakeFromDeepSx;
333
334 params->PchLanEnable = config->EnableLan;
Duncan Laurie14485ef2017-12-13 13:58:35 -0800335 if (config->EnableLan) {
336 params->PchLanLtrEnable = config->EnableLanLtr;
337 params->PchLanK1OffEnable = config->EnableLanK1Off;
338 params->PchLanClkReqSupported = config->LanClkReqSupported;
339 params->PchLanClkReqNumber = config->LanClkReqNumber;
340 }
Naresh G Solankia2d40622016-08-30 20:47:13 +0530341 params->SataSalpSupport = config->SataSalpSupport;
342 params->SsicPortEnable = config->SsicPortEnable;
343 params->ScsEmmcEnabled = config->ScsEmmcEnabled;
344 params->ScsEmmcHs400Enabled = config->ScsEmmcHs400Enabled;
345 params->ScsSdCardEnabled = config->ScsSdCardEnabled;
li feng21066382018-05-22 12:49:53 -0700346
Pratik Prajapatie0722472018-08-22 18:58:38 -0700347 if (!!params->ScsEmmcHs400Enabled && !!config->EmmcHs400DllNeed) {
348 params->PchScsEmmcHs400DllDataValid =
349 !!config->EmmcHs400DllNeed;
350 params->PchScsEmmcHs400RxStrobeDll1 =
351 config->ScsEmmcHs400RxStrobeDll1;
352 params->PchScsEmmcHs400TxDataDll =
353 config->ScsEmmcHs400TxDataDll;
354 }
355
li feng21066382018-05-22 12:49:53 -0700356 /* If ISH is enabled, enable ISH elements */
357 dev = dev_find_slot(0, PCH_DEVFN_ISH);
358 if (dev)
359 params->PchIshEnable = dev->enabled;
360 else
361 params->PchIshEnable = 0;
362
Naresh G Solankia2d40622016-08-30 20:47:13 +0530363 params->PchHdaEnable = config->EnableAzalia;
364 params->PchHdaIoBufferOwnership = config->IoBufferOwnership;
365 params->PchHdaDspEnable = config->DspEnable;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530366 params->Device4Enable = config->Device4Enable;
367 params->SataEnable = config->EnableSata;
368 params->SataMode = config->SataMode;
Matt DeVillier9e0d69b2017-10-10 14:03:36 -0500369 params->SataSpeedLimit = config->SataSpeedLimit;
Kane Chen14e0fa52017-12-27 12:11:23 +0800370 params->SataPwrOptEnable = config->SataPwrOptEnable;
Naresh G Solanki84fbc302018-10-15 15:37:15 +0530371 params->EnableTcoTimer = !config->PmTimerDisabled;
Matt DeVillier9e0d69b2017-10-10 14:03:36 -0500372
Naresh G Solankia2d40622016-08-30 20:47:13 +0530373 tconfig->PchLockDownGlobalSmi = config->LockDownConfigGlobalSmi;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530374 tconfig->PchLockDownRtcLock = config->LockDownConfigRtcLock;
Praveen hodagatta pranesh015b3dc2018-11-23 17:41:46 +0800375 tconfig->PowerLimit4 = config->PowerLimit4;
Barnali Sarkarfbf10182017-08-11 18:38:38 +0530376 /*
377 * To disable HECI, the Psf needs to be left unlocked
378 * by FSP till end of post sequence. Based on the devicetree
379 * setting, we set the appropriate PsfUnlock policy in FSP,
380 * do the changes and then lock it back in coreboot during finalize.
381 */
382 tconfig->PchSbAccessUnlock = (config->HeciEnabled == 0) ? 1 : 0;
Subrata Banikc4986eb2018-05-09 14:55:09 +0530383 if (get_lockdown_config() == CHIPSET_LOCKDOWN_COREBOOT) {
Subrata Banikc204aaa2017-08-17 15:49:58 +0530384 tconfig->PchLockDownBiosInterface = 0;
385 params->PchLockDownBiosLock = 0;
386 params->PchLockDownSpiEiss = 0;
387 /*
388 * Skip Spi Flash Lockdown from inside FSP.
389 * Making this config "0" means FSP won't set the FLOCKDN bit
390 * of SPIBAR + 0x04 (i.e., Bit 15 of BIOS_HSFSTS_CTL).
391 * So, it becomes coreboot's responsibility to set this bit
392 * before end of POST for security concerns.
393 */
394 params->SpiFlashCfgLockDown = 0;
395 }
Matt Delcodfffcad2018-07-23 12:44:15 -0700396 /* only replacing preexisting subsys ID defaults when non-zero */
Elyes HAOUASb58e99d2019-01-23 12:04:43 +0100397 if (CONFIG_SUBSYSTEM_VENDOR_ID != 0) {
398 params->DefaultSvid = CONFIG_SUBSYSTEM_VENDOR_ID;
399 params->PchSubSystemVendorId = CONFIG_SUBSYSTEM_VENDOR_ID;
400 }
401
402 if (CONFIG_SUBSYSTEM_DEVICE_ID != 0) {
403 params->DefaultSid = CONFIG_SUBSYSTEM_DEVICE_ID;
404 params->PchSubSystemId = CONFIG_SUBSYSTEM_DEVICE_ID;
405 }
406
Naresh G Solankia2d40622016-08-30 20:47:13 +0530407 params->PchPmWolEnableOverride = config->WakeConfigWolEnableOverride;
408 params->PchPmPcieWakeFromDeepSx = config->WakeConfigPcieWakeFromDeepSx;
409 params->PchPmDeepSxPol = config->PmConfigDeepSxPol;
Duncan Laurie25c7d932017-02-17 17:16:43 -0800410 params->PchPmSlpS0Enable = config->s0ix_enable;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530411 params->PchPmSlpS3MinAssert = config->PmConfigSlpS3MinAssert;
412 params->PchPmSlpS4MinAssert = config->PmConfigSlpS4MinAssert;
413 params->PchPmSlpSusMinAssert = config->PmConfigSlpSusMinAssert;
414 params->PchPmSlpAMinAssert = config->PmConfigSlpAMinAssert;
415 params->PchPmLpcClockRun = config->PmConfigPciClockRun;
416 params->PchPmSlpStrchSusUp = config->PmConfigSlpStrchSusUp;
417 params->PchPmPwrBtnOverridePeriod =
418 config->PmConfigPwrBtnOverridePeriod;
419 params->PchPmPwrCycDur = config->PmConfigPwrCycDur;
Rizwan Qureshi0da186c2017-02-23 14:43:39 +0530420
421 /* Indicate whether platform supports Voltage Margining */
422 params->PchPmSlpS0VmEnable = config->PchPmSlpS0VmEnable;
423
Nico Huber44e89af2019-02-23 19:24:51 +0100424 params->PchSirqEnable = config->serirq_mode != SERIRQ_OFF;
425 params->PchSirqMode = config->serirq_mode == SERIRQ_CONTINUOUS;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530426
Subrata Banikcf32fd12018-12-19 18:02:17 +0530427 params->CpuConfig.Bits.SkipMpInit = !CONFIG_USE_INTEL_FSP_MP_INIT;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530428
Subrata Banikc4986eb2018-05-09 14:55:09 +0530429 for (i = 0; i < ARRAY_SIZE(config->i2c_voltage); i++)
Aaron Durbined14a4e2016-11-09 17:04:15 -0600430 params->SerialIoI2cVoltage[i] = config->i2c_voltage[i];
Naresh G Solankia2d40622016-08-30 20:47:13 +0530431
432 for (i = 0; i < ARRAY_SIZE(config->domain_vr_config); i++)
433 fill_vr_domain_config(params, i, &config->domain_vr_config[i]);
434
435 /* Show SPI controller if enabled in devicetree.cb */
436 dev = dev_find_slot(0, PCH_DEVFN_SPI);
437 params->ShowSpiController = dev->enabled;
438
Duncan Laurief5116952018-03-26 02:24:18 -0700439 /* Enable xDCI controller if enabled in devicetree and allowed */
440 dev = dev_find_slot(0, PCH_DEVFN_USBOTG);
441 if (!xdci_can_enable())
442 dev->enabled = 0;
443 params->XdciEnable = dev->enabled;
444
Rizwan Qureshi64670142016-11-23 15:25:19 +0530445 /*
446 * Send VR specific mailbox commands:
447 * 000b - no VR specific command sent
448 * 001b - VR mailbox command specifically for the MPS IMPV8 VR
Lee Leahyf4c4ab92017-03-16 17:08:03 -0700449 * will be sent
Rizwan Qureshi64670142016-11-23 15:25:19 +0530450 * 010b - VR specific command sent for PS4 exit issue
451 * 100b - VR specific command sent for MPS VR decay issue
452 */
453 params->SendVrMbxCmd1 = config->SendVrMbxCmd;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530454
Rizwan Qureshib3e18c72017-09-25 17:35:15 +0530455 /*
456 * Activates VR mailbox command for Intersil VR C-state issues.
457 * 0 - no mailbox command sent.
458 * 1 - VR mailbox command sent for IA/GT rails only.
459 * 2 - VR mailbox command sent for IA/GT/SA rails.
460 */
461 params->IslVrCmd = config->IslVrCmd;
462
Duncan Laurieb2aac852017-03-07 19:12:02 -0800463 /* Acoustic Noise Mitigation */
464 params->AcousticNoiseMitigation = config->AcousticNoiseMitigation;
465 params->SlowSlewRateForIa = config->SlowSlewRateForIa;
466 params->SlowSlewRateForGt = config->SlowSlewRateForGt;
467 params->SlowSlewRateForSa = config->SlowSlewRateForSa;
468 params->FastPkgCRampDisableIa = config->FastPkgCRampDisableIa;
469 params->FastPkgCRampDisableGt = config->FastPkgCRampDisableGt;
470 params->FastPkgCRampDisableSa = config->FastPkgCRampDisableSa;
471
Rizwan Qureshiffe58102017-02-10 15:58:24 +0530472 /* Enable PMC XRAM read */
473 tconfig->PchPmPmcReadDisable = config->PchPmPmcReadDisable;
474
Subrata Banik6b45ee42017-05-12 11:43:57 +0530475 /* Enable/Disable EIST */
476 tconfig->Eist = config->eist_enable;
477
marxwangec5a9472017-12-11 14:57:49 +0800478 /* Set TccActivationOffset */
479 tconfig->TccActivationOffset = config->tcc_offset;
480
Nico Huber2afe4dc2017-09-19 09:36:03 +0200481 /* Enable VT-d and X2APIC */
482 if (!config->ignore_vtd && soc_is_vtd_capable()) {
483 params->VtdBaseAddress[0] = GFXVT_BASE_ADDRESS;
484 params->VtdBaseAddress[1] = VTVC0_BASE_ADDRESS;
485 params->X2ApicOptOut = 0;
486 tconfig->VtdDisable = 0;
487
488 params->PchIoApicBdfValid = 1;
489 params->PchIoApicBusNumber = 250;
490 params->PchIoApicDeviceNumber = 31;
491 params->PchIoApicFunctionNumber = 0;
492 }
493
Naresh G Solankia2d40622016-08-30 20:47:13 +0530494 soc_irq_settings(params);
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530495}
Lee Leahyb0005132015-05-12 18:19:47 -0700496
Naresh G Solankia2d40622016-08-30 20:47:13 +0530497/* Mainboard GPIO Configuration */
Aaron Durbin64031672018-04-21 14:45:32 -0600498__weak void mainboard_silicon_init_params(FSP_S_CONFIG *params)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530499{
500 printk(BIOS_DEBUG, "WEAK: %s/%s called\n", __FILE__, __func__);
501}