blob: 18c2aef676766e4919c7adc00e8249aaa1ec1bc7 [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
Lee Leahy1d14b3e2015-05-12 18:23:27 -070016#include <chip.h>
Duncan Laurie7d484102017-01-09 22:23:39 -080017#include <bootmode.h>
Rizwan Qureshi1222a732016-08-23 14:31:23 +053018#include <bootstate.h>
19#include <device/pci.h>
20#include <fsp/api.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053021#include <arch/acpi.h>
Gaggery Tsai711fb812018-05-22 12:32:48 -070022#include <arch/io.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053023#include <console/console.h>
24#include <device/device.h>
Gaggery Tsai711fb812018-05-22 12:32:48 -070025#include <device/pci_ids.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053026#include <fsp/util.h>
Subrata Banikf699c142018-06-08 17:57:37 +053027#include <intelblocks/chip.h>
Subrata Banik46caf092018-09-28 19:54:30 +053028#include <intelblocks/itss.h>
Duncan Laurief5116952018-03-26 02:24:18 -070029#include <intelblocks/xdci.h>
Subrata Banik9cd99a12018-05-28 16:12:03 +053030#include <intelpch/lockdown.h>
Brandon Breitensteinc6ec8dd2016-11-17 12:23:04 -080031#include <romstage_handoff.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053032#include <soc/acpi.h>
Patrick Georgic6a00502017-10-05 18:19:29 +020033#include <soc/intel/common/vbt.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053034#include <soc/interrupt.h>
Nico Huber2afe4dc2017-09-19 09:36:03 +020035#include <soc/iomap.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053036#include <soc/irq.h>
Subrata Banik46caf092018-09-28 19:54:30 +053037#include <soc/itss.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053038#include <soc/pci_devs.h>
39#include <soc/ramstage.h>
Nico Huber2afe4dc2017-09-19 09:36:03 +020040#include <soc/systemagent.h>
Naresh G Solankia2d40622016-08-30 20:47:13 +053041#include <string.h>
42
Gaggery Tsai711fb812018-05-22 12:32:48 -070043struct pcie_entry {
44 unsigned int devfn;
45 unsigned int func_count;
46};
47
48/*
49 * According to table 2-2 in doc#546717:
50 * PCI bus[function] ID
51 * D28:[F0 - F7] 0xA110 - 0xA117
52 * D29:[F0 - F7] 0xA118 - 0xA11F
53 * D27:[F0 - F3] 0xA167 - 0xA16A
54 */
55static const struct pcie_entry pcie_table_skl_pch_h[] = {
56 {PCH_DEVFN_PCIE1, 8},
57 {PCH_DEVFN_PCIE9, 8},
58 {PCH_DEVFN_PCIE17, 4},
59};
60
61/*
62 * According to table 2-2 in doc#564464:
63 * PCI bus[function] ID
64 * D28:[F0 - F7] 0xA290 - 0xA297
65 * D29:[F0 - F7] 0xA298 - 0xA29F
66 * D27:[F0 - F7] 0xA2E7 - 0xA2EE
67 */
68static const struct pcie_entry pcie_table_kbl_pch_h[] = {
69 {PCH_DEVFN_PCIE1, 8},
70 {PCH_DEVFN_PCIE9, 8},
71 {PCH_DEVFN_PCIE17, 8},
72};
73
74/*
75 * According to table 2-2 in doc#567995/545659:
76 * PCI bus[function] ID
77 * D28:[F0 - F7] 0x9D10 - 0x9D17
78 * D29:[F0 - F3] 0x9D18 - 0x9D1B
79 */
80static const struct pcie_entry pcie_table_skl_pch_lp[] = {
81 {PCH_DEVFN_PCIE1, 8},
82 {PCH_DEVFN_PCIE9, 4},
83};
84
85/*
86 * If the PCIe root port at function 0 is disabled,
87 * the PCIe root ports might be coalesced after FSP silicon init.
88 * The below function will swap the devfn of the first enabled device
89 * in devicetree and function 0 resides a pci device
90 * so that it won't confuse coreboot.
91 */
92static void pcie_update_device_tree(const struct pcie_entry *pcie_rp_group,
93 size_t pci_groups)
94{
95 struct device *func0;
96 unsigned int devfn, devfn0;
97 int i, group;
98 unsigned int inc = PCI_DEVFN(0, 1);
99
100 for (group = 0; group < pci_groups; group++) {
101 devfn0 = pcie_rp_group[group].devfn;
102 func0 = dev_find_slot(0, devfn0);
103 if (func0 == NULL)
104 continue;
105
106 /* No more functions if function 0 is disabled. */
107 if (pci_read_config32(func0, PCI_VENDOR_ID) == 0xffffffff)
108 continue;
109
110 devfn = devfn0 + inc;
111
112 /*
113 * Increase function by 1.
114 * Then find first enabled device to replace func0
115 * as that port was move to func0.
116 */
117 for (i = 1; i < pcie_rp_group[group].func_count;
118 i++, devfn += inc) {
119 struct device *dev = dev_find_slot(0, devfn);
120 if (dev == NULL || !dev->enabled)
121 continue;
122
123 /*
124 * Found the first enabled device in
125 * a given dev number.
126 */
127 printk(BIOS_INFO, "PCI func %d was swapped"
128 " to func 0.\n", i);
129 func0->path.pci.devfn = dev->path.pci.devfn;
130 dev->path.pci.devfn = devfn0;
131 break;
132 }
133 }
134}
135
136static void pcie_override_devicetree_after_silicon_init(void)
137{
138 uint16_t id, id_mask;
139
140 id = pci_read_config16(PCH_DEV_PCIE1, PCI_DEVICE_ID);
141 /*
142 * We may read an ID other than func 0 after FSP-S.
143 * Strip out 4 least significant bits.
144 */
145 id_mask = id & ~0xf;
146 printk(BIOS_INFO, "Override DT after FSP-S, PCH is ");
147 if (id_mask == (PCI_DEVICE_ID_INTEL_SPT_LP_PCIE_RP1 & ~0xf)) {
148 printk(BIOS_INFO, "KBL/SKL PCH-LP SKU\n");
149 pcie_update_device_tree(&pcie_table_skl_pch_lp[0],
150 ARRAY_SIZE(pcie_table_skl_pch_lp));
151 } else if (id_mask == (PCI_DEVICE_ID_INTEL_KBP_H_PCIE_RP1 & ~0xf)) {
152 printk(BIOS_INFO, "KBL PCH-H SKU\n");
153 pcie_update_device_tree(&pcie_table_kbl_pch_h[0],
154 ARRAY_SIZE(pcie_table_kbl_pch_h));
155 } else if (id_mask == (PCI_DEVICE_ID_INTEL_SPT_H_PCIE_RP1 & ~0xf)) {
156 printk(BIOS_INFO, "SKL PCH-H SKU\n");
157 pcie_update_device_tree(&pcie_table_skl_pch_h[0],
158 ARRAY_SIZE(pcie_table_skl_pch_h));
159 } else {
160 printk(BIOS_ERR, "[BUG] PCIE Root Port id 0x%x"
161 " is not found\n", id);
162 return;
163 }
164}
165
Naresh G Solankia2d40622016-08-30 20:47:13 +0530166void soc_init_pre_device(void *chip_info)
167{
Subrata Banik46caf092018-09-28 19:54:30 +0530168 /* Snapshot the current GPIO IRQ polarities. FSP is setting a
169 * default policy that doesn't honor boards' requirements. */
170 itss_snapshot_irq_polarities(GPIO_IRQ_START, GPIO_IRQ_END);
171
Naresh G Solankia2d40622016-08-30 20:47:13 +0530172 /* Perform silicon specific init. */
Aaron Durbin6c191d82016-11-29 21:22:42 -0600173 fsp_silicon_init(romstage_handoff_is_resume());
Subrata Banik46caf092018-09-28 19:54:30 +0530174
175 /* Restore GPIO IRQ polarities back to previous settings. */
176 itss_restore_irq_polarities(GPIO_IRQ_START, GPIO_IRQ_END);
177
Gaggery Tsai711fb812018-05-22 12:32:48 -0700178 /* swap enabled PCI ports in device tree if needed */
179 pcie_override_devicetree_after_silicon_init();
Naresh G Solankia2d40622016-08-30 20:47:13 +0530180}
181
Furquan Shaikhc2480442017-02-20 13:41:56 -0800182void soc_fsp_load(void)
183{
184 fsps_load(romstage_handoff_is_resume());
185}
186
Elyes HAOUAS143fb462018-05-25 12:56:45 +0200187static void pci_domain_set_resources(struct device *dev)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530188{
189 assign_resources(dev->link_list);
190}
191
192static struct device_operations pci_domain_ops = {
193 .read_resources = &pci_domain_read_resources,
194 .set_resources = &pci_domain_set_resources,
195 .scan_bus = &pci_domain_scan_bus,
Naresh G Solankia2d40622016-08-30 20:47:13 +0530196#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
Nico Huberc37b0e32017-09-18 20:03:46 +0200197 .write_acpi_tables = &northbridge_write_acpi_tables,
198 .acpi_name = &soc_acpi_name,
Naresh G Solankia2d40622016-08-30 20:47:13 +0530199#endif
200};
201
202static struct device_operations cpu_bus_ops = {
203 .read_resources = DEVICE_NOOP,
204 .set_resources = DEVICE_NOOP,
205 .enable_resources = DEVICE_NOOP,
Subrata Banika4b11e5c2017-02-03 18:57:49 +0530206 .init = DEVICE_NOOP,
Naresh G Solankia2d40622016-08-30 20:47:13 +0530207#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
208 .acpi_fill_ssdt_generator = generate_cpu_entries,
209#endif
210};
211
Elyes HAOUAS143fb462018-05-25 12:56:45 +0200212static void soc_enable(struct device *dev)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530213{
214 /* Set the operations if it is a special bus type */
Subrata Banik3c838c72017-12-06 18:14:01 +0530215 if (dev->path.type == DEVICE_PATH_DOMAIN)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530216 dev->ops = &pci_domain_ops;
Subrata Banik3c838c72017-12-06 18:14:01 +0530217 else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530218 dev->ops = &cpu_bus_ops;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530219}
220
221struct chip_operations soc_intel_skylake_ops = {
222 CHIP_NAME("Intel 6th Gen")
223 .enable_dev = &soc_enable,
224 .init = &soc_init_pre_device,
225};
Lee Leahyb0005132015-05-12 18:19:47 -0700226
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530227/* UPD parameters to be initialized before SiliconInit */
Naresh G Solankia2d40622016-08-30 20:47:13 +0530228void platform_fsp_silicon_init_params_cb(FSPS_UPD *supd)
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530229{
Naresh G Solankia2d40622016-08-30 20:47:13 +0530230 FSP_S_CONFIG *params = &supd->FspsConfig;
231 FSP_S_TEST_CONFIG *tconfig = &supd->FspsTestConfig;
232 static struct soc_intel_skylake_config *config;
Patrick Georgid2990ff2018-05-03 18:06:15 +0200233 uintptr_t vbt_data = (uintptr_t)vbt_get();
Naresh G Solankia2d40622016-08-30 20:47:13 +0530234 int i;
235
Naresh G Solankia2d40622016-08-30 20:47:13 +0530236 struct device *dev = SA_DEV_ROOT;
237 if (!dev || !dev->chip_info) {
238 printk(BIOS_ERR, "BUG! Could not find SOC devicetree config\n");
239 return;
240 }
241 config = dev->chip_info;
242
243 mainboard_silicon_init_params(params);
Gaggery Tsaida6f4ae2018-01-15 15:03:01 +0800244 /* Set PsysPmax if it is available from DT */
245 if (config->psys_pmax) {
246 /* PsysPmax is in unit of 1/8 Watt */
247 tconfig->PsysPmax = config->psys_pmax * 8;
248 printk(BIOS_DEBUG, "psys_pmax = %d\n", tconfig->PsysPmax);
249 }
Naresh G Solankia2d40622016-08-30 20:47:13 +0530250
Naresh G Solankia2d40622016-08-30 20:47:13 +0530251 params->GraphicsConfigPtr = (u32) vbt_data;
252
253 for (i = 0; i < ARRAY_SIZE(config->usb2_ports); i++) {
254 params->PortUsb20Enable[i] =
255 config->usb2_ports[i].enable;
Subrata Banik2c3054c2016-11-22 20:21:49 +0530256 params->Usb2OverCurrentPin[i] =
257 config->usb2_ports[i].ocpin;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530258 params->Usb2AfePetxiset[i] =
259 config->usb2_ports[i].pre_emp_bias;
260 params->Usb2AfeTxiset[i] =
261 config->usb2_ports[i].tx_bias;
262 params->Usb2AfePredeemp[i] =
263 config->usb2_ports[i].tx_emp_enable;
264 params->Usb2AfePehalfbit[i] =
265 config->usb2_ports[i].pre_emp_bit;
266 }
267
268 for (i = 0; i < ARRAY_SIZE(config->usb3_ports); i++) {
269 params->PortUsb30Enable[i] = config->usb3_ports[i].enable;
Subrata Banik2c3054c2016-11-22 20:21:49 +0530270 params->Usb3OverCurrentPin[i] = config->usb3_ports[i].ocpin;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530271 if (config->usb3_ports[i].tx_de_emp) {
272 params->Usb3HsioTxDeEmphEnable[i] = 1;
273 params->Usb3HsioTxDeEmph[i] =
274 config->usb3_ports[i].tx_de_emp;
275 }
276 if (config->usb3_ports[i].tx_downscale_amp) {
277 params->Usb3HsioTxDownscaleAmpEnable[i] = 1;
278 params->Usb3HsioTxDownscaleAmp[i] =
279 config->usb3_ports[i].tx_downscale_amp;
280 }
281 }
282
283 memcpy(params->SataPortsEnable, config->SataPortsEnable,
284 sizeof(params->SataPortsEnable));
285 memcpy(params->SataPortsDevSlp, config->SataPortsDevSlp,
286 sizeof(params->SataPortsDevSlp));
287 memcpy(params->PcieRpClkReqSupport, config->PcieRpClkReqSupport,
288 sizeof(params->PcieRpClkReqSupport));
289 memcpy(params->PcieRpClkReqNumber, config->PcieRpClkReqNumber,
290 sizeof(params->PcieRpClkReqNumber));
Rizwan Qureshi6ab4ed42017-09-05 14:18:25 +0530291 memcpy(params->PcieRpAdvancedErrorReporting,
292 config->PcieRpAdvancedErrorReporting,
293 sizeof(params->PcieRpAdvancedErrorReporting));
Rizwan Qureshi03937392017-09-16 01:54:20 +0530294 memcpy(params->PcieRpLtrEnable, config->PcieRpLtrEnable,
295 sizeof(params->PcieRpLtrEnable));
Duncan Laurie74ea48e2018-01-29 12:00:47 -0800296 memcpy(params->PcieRpHotPlug, config->PcieRpHotPlug,
297 sizeof(params->PcieRpHotPlug));
Naresh G Solankia2d40622016-08-30 20:47:13 +0530298
Divya Chellape7fb7ce2017-12-19 20:16:50 +0530299 /*
300 * PcieRpClkSrcNumber UPD is set to clock source number(0-6) for
301 * all the enabled PCIe root ports, invalid(0x1F) is set for
302 * disabled PCIe root ports.
303 */
304 for (i = 0; i < CONFIG_MAX_ROOT_PORTS; i++) {
305 if (config->PcieRpClkReqSupport[i])
306 params->PcieRpClkSrcNumber[i] =
307 config->PcieRpClkSrcNumber[i];
308 else
309 params->PcieRpClkSrcNumber[i] = 0x1F;
310 }
311
Naresh G Solankieedf6d82016-11-16 21:27:38 +0530312 /* disable Legacy PME */
313 memset(params->PcieRpPmSci, 0, sizeof(params->PcieRpPmSci));
314
Naresh G Solankia2d40622016-08-30 20:47:13 +0530315 memcpy(params->SerialIoDevMode, config->SerialIoDevMode,
316 sizeof(params->SerialIoDevMode));
317
318 params->PchCio2Enable = config->Cio2Enable;
Rizwan Qureshic2c8a742017-01-13 22:04:11 +0530319 params->SaImguEnable = config->SaImguEnable;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530320 params->Heci3Enabled = config->Heci3Enabled;
321
322 params->LogoPtr = config->LogoPtr;
323 params->LogoSize = config->LogoSize;
324
325 params->CpuConfig.Bits.VmxEnable = config->VmxEnable;
326
327 params->PchPmWoWlanEnable = config->PchPmWoWlanEnable;
328 params->PchPmWoWlanDeepSxEnable = config->PchPmWoWlanDeepSxEnable;
329 params->PchPmLanWakeFromDeepSx = config->WakeConfigPcieWakeFromDeepSx;
330
331 params->PchLanEnable = config->EnableLan;
Duncan Laurie14485ef2017-12-13 13:58:35 -0800332 if (config->EnableLan) {
333 params->PchLanLtrEnable = config->EnableLanLtr;
334 params->PchLanK1OffEnable = config->EnableLanK1Off;
335 params->PchLanClkReqSupported = config->LanClkReqSupported;
336 params->PchLanClkReqNumber = config->LanClkReqNumber;
337 }
Naresh G Solankia2d40622016-08-30 20:47:13 +0530338 params->SataSalpSupport = config->SataSalpSupport;
339 params->SsicPortEnable = config->SsicPortEnable;
340 params->ScsEmmcEnabled = config->ScsEmmcEnabled;
341 params->ScsEmmcHs400Enabled = config->ScsEmmcHs400Enabled;
342 params->ScsSdCardEnabled = config->ScsSdCardEnabled;
li feng21066382018-05-22 12:49:53 -0700343
Pratik Prajapatie0722472018-08-22 18:58:38 -0700344 if (!!params->ScsEmmcHs400Enabled && !!config->EmmcHs400DllNeed) {
345 params->PchScsEmmcHs400DllDataValid =
346 !!config->EmmcHs400DllNeed;
347 params->PchScsEmmcHs400RxStrobeDll1 =
348 config->ScsEmmcHs400RxStrobeDll1;
349 params->PchScsEmmcHs400TxDataDll =
350 config->ScsEmmcHs400TxDataDll;
351 }
352
li feng21066382018-05-22 12:49:53 -0700353 /* If ISH is enabled, enable ISH elements */
354 dev = dev_find_slot(0, PCH_DEVFN_ISH);
355 if (dev)
356 params->PchIshEnable = dev->enabled;
357 else
358 params->PchIshEnable = 0;
359
Naresh G Solankia2d40622016-08-30 20:47:13 +0530360 params->PchHdaEnable = config->EnableAzalia;
361 params->PchHdaIoBufferOwnership = config->IoBufferOwnership;
362 params->PchHdaDspEnable = config->DspEnable;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530363 params->Device4Enable = config->Device4Enable;
364 params->SataEnable = config->EnableSata;
365 params->SataMode = config->SataMode;
Matt DeVillier9e0d69b2017-10-10 14:03:36 -0500366 params->SataSpeedLimit = config->SataSpeedLimit;
Kane Chen14e0fa52017-12-27 12:11:23 +0800367 params->SataPwrOptEnable = config->SataPwrOptEnable;
Naresh G Solanki84fbc302018-10-15 15:37:15 +0530368 params->EnableTcoTimer = !config->PmTimerDisabled;
Matt DeVillier9e0d69b2017-10-10 14:03:36 -0500369
Naresh G Solankia2d40622016-08-30 20:47:13 +0530370 tconfig->PchLockDownGlobalSmi = config->LockDownConfigGlobalSmi;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530371 tconfig->PchLockDownRtcLock = config->LockDownConfigRtcLock;
Praveen hodagatta pranesh015b3dc2018-11-23 17:41:46 +0800372 tconfig->PowerLimit4 = config->PowerLimit4;
Barnali Sarkarfbf10182017-08-11 18:38:38 +0530373 /*
374 * To disable HECI, the Psf needs to be left unlocked
375 * by FSP till end of post sequence. Based on the devicetree
376 * setting, we set the appropriate PsfUnlock policy in FSP,
377 * do the changes and then lock it back in coreboot during finalize.
378 */
379 tconfig->PchSbAccessUnlock = (config->HeciEnabled == 0) ? 1 : 0;
Subrata Banikc4986eb2018-05-09 14:55:09 +0530380 if (get_lockdown_config() == CHIPSET_LOCKDOWN_COREBOOT) {
Subrata Banikc204aaa2017-08-17 15:49:58 +0530381 tconfig->PchLockDownBiosInterface = 0;
382 params->PchLockDownBiosLock = 0;
383 params->PchLockDownSpiEiss = 0;
384 /*
385 * Skip Spi Flash Lockdown from inside FSP.
386 * Making this config "0" means FSP won't set the FLOCKDN bit
387 * of SPIBAR + 0x04 (i.e., Bit 15 of BIOS_HSFSTS_CTL).
388 * So, it becomes coreboot's responsibility to set this bit
389 * before end of POST for security concerns.
390 */
391 params->SpiFlashCfgLockDown = 0;
392 }
Matt Delcodfffcad2018-07-23 12:44:15 -0700393 /* only replacing preexisting subsys ID defaults when non-zero */
394#if defined(CONFIG_SUBSYSTEM_VENDOR_ID) && CONFIG_SUBSYSTEM_VENDOR_ID
395 params->DefaultSvid = CONFIG_SUBSYSTEM_VENDOR_ID;
396 params->PchSubSystemVendorId = CONFIG_SUBSYSTEM_VENDOR_ID;
397#endif
398#if defined(CONFIG_SUBSYSTEM_DEVICE_ID) && CONFIG_SUBSYSTEM_DEVICE_ID
399 params->DefaultSid = CONFIG_SUBSYSTEM_DEVICE_ID;
400 params->PchSubSystemId = CONFIG_SUBSYSTEM_DEVICE_ID;
401#endif
Naresh G Solankia2d40622016-08-30 20:47:13 +0530402 params->PchPmWolEnableOverride = config->WakeConfigWolEnableOverride;
403 params->PchPmPcieWakeFromDeepSx = config->WakeConfigPcieWakeFromDeepSx;
404 params->PchPmDeepSxPol = config->PmConfigDeepSxPol;
Duncan Laurie25c7d932017-02-17 17:16:43 -0800405 params->PchPmSlpS0Enable = config->s0ix_enable;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530406 params->PchPmSlpS3MinAssert = config->PmConfigSlpS3MinAssert;
407 params->PchPmSlpS4MinAssert = config->PmConfigSlpS4MinAssert;
408 params->PchPmSlpSusMinAssert = config->PmConfigSlpSusMinAssert;
409 params->PchPmSlpAMinAssert = config->PmConfigSlpAMinAssert;
410 params->PchPmLpcClockRun = config->PmConfigPciClockRun;
411 params->PchPmSlpStrchSusUp = config->PmConfigSlpStrchSusUp;
412 params->PchPmPwrBtnOverridePeriod =
413 config->PmConfigPwrBtnOverridePeriod;
414 params->PchPmPwrCycDur = config->PmConfigPwrCycDur;
Rizwan Qureshi0da186c2017-02-23 14:43:39 +0530415
416 /* Indicate whether platform supports Voltage Margining */
417 params->PchPmSlpS0VmEnable = config->PchPmSlpS0VmEnable;
418
Naresh G Solankia2d40622016-08-30 20:47:13 +0530419 params->PchSirqEnable = config->SerialIrqConfigSirqEnable;
420 params->PchSirqMode = config->SerialIrqConfigSirqMode;
421
Subrata Banikf699c142018-06-08 17:57:37 +0530422 params->CpuConfig.Bits.SkipMpInit = !chip_get_fsp_mp_init();
Naresh G Solankia2d40622016-08-30 20:47:13 +0530423
Subrata Banikc4986eb2018-05-09 14:55:09 +0530424 for (i = 0; i < ARRAY_SIZE(config->i2c_voltage); i++)
Aaron Durbined14a4e2016-11-09 17:04:15 -0600425 params->SerialIoI2cVoltage[i] = config->i2c_voltage[i];
Naresh G Solankia2d40622016-08-30 20:47:13 +0530426
427 for (i = 0; i < ARRAY_SIZE(config->domain_vr_config); i++)
428 fill_vr_domain_config(params, i, &config->domain_vr_config[i]);
429
430 /* Show SPI controller if enabled in devicetree.cb */
431 dev = dev_find_slot(0, PCH_DEVFN_SPI);
432 params->ShowSpiController = dev->enabled;
433
Duncan Laurief5116952018-03-26 02:24:18 -0700434 /* Enable xDCI controller if enabled in devicetree and allowed */
435 dev = dev_find_slot(0, PCH_DEVFN_USBOTG);
436 if (!xdci_can_enable())
437 dev->enabled = 0;
438 params->XdciEnable = dev->enabled;
439
Rizwan Qureshi64670142016-11-23 15:25:19 +0530440 /*
441 * Send VR specific mailbox commands:
442 * 000b - no VR specific command sent
443 * 001b - VR mailbox command specifically for the MPS IMPV8 VR
Lee Leahyf4c4ab92017-03-16 17:08:03 -0700444 * will be sent
Rizwan Qureshi64670142016-11-23 15:25:19 +0530445 * 010b - VR specific command sent for PS4 exit issue
446 * 100b - VR specific command sent for MPS VR decay issue
447 */
448 params->SendVrMbxCmd1 = config->SendVrMbxCmd;
Naresh G Solankia2d40622016-08-30 20:47:13 +0530449
Rizwan Qureshib3e18c72017-09-25 17:35:15 +0530450 /*
451 * Activates VR mailbox command for Intersil VR C-state issues.
452 * 0 - no mailbox command sent.
453 * 1 - VR mailbox command sent for IA/GT rails only.
454 * 2 - VR mailbox command sent for IA/GT/SA rails.
455 */
456 params->IslVrCmd = config->IslVrCmd;
457
Duncan Laurieb2aac852017-03-07 19:12:02 -0800458 /* Acoustic Noise Mitigation */
459 params->AcousticNoiseMitigation = config->AcousticNoiseMitigation;
460 params->SlowSlewRateForIa = config->SlowSlewRateForIa;
461 params->SlowSlewRateForGt = config->SlowSlewRateForGt;
462 params->SlowSlewRateForSa = config->SlowSlewRateForSa;
463 params->FastPkgCRampDisableIa = config->FastPkgCRampDisableIa;
464 params->FastPkgCRampDisableGt = config->FastPkgCRampDisableGt;
465 params->FastPkgCRampDisableSa = config->FastPkgCRampDisableSa;
466
Rizwan Qureshiffe58102017-02-10 15:58:24 +0530467 /* Enable PMC XRAM read */
468 tconfig->PchPmPmcReadDisable = config->PchPmPmcReadDisable;
469
Subrata Banik6b45ee42017-05-12 11:43:57 +0530470 /* Enable/Disable EIST */
471 tconfig->Eist = config->eist_enable;
472
marxwangec5a9472017-12-11 14:57:49 +0800473 /* Set TccActivationOffset */
474 tconfig->TccActivationOffset = config->tcc_offset;
475
Nico Huber2afe4dc2017-09-19 09:36:03 +0200476 /* Enable VT-d and X2APIC */
477 if (!config->ignore_vtd && soc_is_vtd_capable()) {
478 params->VtdBaseAddress[0] = GFXVT_BASE_ADDRESS;
479 params->VtdBaseAddress[1] = VTVC0_BASE_ADDRESS;
480 params->X2ApicOptOut = 0;
481 tconfig->VtdDisable = 0;
482
483 params->PchIoApicBdfValid = 1;
484 params->PchIoApicBusNumber = 250;
485 params->PchIoApicDeviceNumber = 31;
486 params->PchIoApicFunctionNumber = 0;
487 }
488
Naresh G Solankia2d40622016-08-30 20:47:13 +0530489 soc_irq_settings(params);
Rizwan Qureshi1222a732016-08-23 14:31:23 +0530490}
Lee Leahyb0005132015-05-12 18:19:47 -0700491
Naresh G Solankia2d40622016-08-30 20:47:13 +0530492/* Mainboard GPIO Configuration */
Aaron Durbin64031672018-04-21 14:45:32 -0600493__weak void mainboard_silicon_init_params(FSP_S_CONFIG *params)
Naresh G Solankia2d40622016-08-30 20:47:13 +0530494{
495 printk(BIOS_DEBUG, "WEAK: %s/%s called\n", __FILE__, __func__);
496}