blob: 3da5763925bc01992e20fa025a86e5ffccec9870 [file] [log] [blame]
Lee Leahy77ff0b12015-05-05 15:07:29 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2013 Google Inc.
Lee Leahy32471722015-04-20 15:20:28 -07005 * Copyright (C) 2015 Intel Corp.
Lee Leahy77ff0b12015-05-05 15:07:29 -07006 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Lee Leahy77ff0b12015-05-05 15:07:29 -070015 */
16
Lee Leahy32471722015-04-20 15:20:28 -070017#include <chip.h>
Aaron Durbin64031672018-04-21 14:45:32 -060018#include <compiler.h>
Lee Leahy77ff0b12015-05-05 15:07:29 -070019#include <console/console.h>
20#include <device/device.h>
21#include <device/pci.h>
Aaron Durbin789f2b62015-09-09 17:05:06 -050022#include <fsp/util.h>
Lee Leahy77ff0b12015-05-05 15:07:29 -070023#include <soc/pci_devs.h>
24#include <soc/ramstage.h>
Lee Leahy77ff0b12015-05-05 15:07:29 -070025
26static void pci_domain_set_resources(device_t dev)
27{
Lee Leahy32471722015-04-20 15:20:28 -070028 printk(BIOS_SPEW, "%s/%s ( %s )\n",
29 __FILE__, __func__, dev_name(dev));
Lee Leahy77ff0b12015-05-05 15:07:29 -070030 assign_resources(dev->link_list);
31}
32
33static struct device_operations pci_domain_ops = {
34 .read_resources = pci_domain_read_resources,
35 .set_resources = pci_domain_set_resources,
36 .enable_resources = NULL,
37 .init = NULL,
38 .scan_bus = pci_domain_scan_bus,
39 .ops_pci_bus = pci_bus_default_ops,
40};
41
Lee Leahy32471722015-04-20 15:20:28 -070042static void cpu_bus_noop(device_t dev) { }
43
Lee Leahy77ff0b12015-05-05 15:07:29 -070044static struct device_operations cpu_bus_ops = {
Lee Leahy32471722015-04-20 15:20:28 -070045 .read_resources = cpu_bus_noop,
46 .set_resources = cpu_bus_noop,
47 .enable_resources = cpu_bus_noop,
48 .init = soc_init_cpus
Lee Leahy77ff0b12015-05-05 15:07:29 -070049};
50
51
52static void enable_dev(device_t dev)
53{
Lee Leahy32471722015-04-20 15:20:28 -070054 printk(BIOS_SPEW, "----------\n%s/%s ( %s ), type: %d\n",
55 __FILE__, __func__,
56 dev_name(dev), dev->path.type);
57 printk(BIOS_SPEW, "vendor: 0x%04x. device: 0x%04x\n",
58 pci_read_config16(dev, PCI_VENDOR_ID),
59 pci_read_config16(dev, PCI_DEVICE_ID));
60 printk(BIOS_SPEW, "class: 0x%02x %s\n"
61 "subclass: 0x%02x %s\n"
62 "prog: 0x%02x\n"
63 "revision: 0x%02x\n",
64 pci_read_config16(dev, PCI_CLASS_DEVICE) >> 8,
65 get_pci_class_name(dev),
66 pci_read_config16(dev, PCI_CLASS_DEVICE) & 0xff,
67 get_pci_subclass_name(dev),
68 pci_read_config8(dev, PCI_CLASS_PROG),
69 pci_read_config8(dev, PCI_REVISION_ID));
70
Lee Leahy77ff0b12015-05-05 15:07:29 -070071 /* Set the operations if it is a special bus type */
72 if (dev->path.type == DEVICE_PATH_DOMAIN) {
73 dev->ops = &pci_domain_ops;
74 } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) {
75 dev->ops = &cpu_bus_ops;
76 } else if (dev->path.type == DEVICE_PATH_PCI) {
77 /* Handle south cluster enablement. */
78 if (PCI_SLOT(dev->path.pci.devfn) > GFX_DEV &&
79 (dev->ops == NULL || dev->ops->enable == NULL)) {
80 southcluster_enable_dev(dev);
81 }
82 }
83}
84
Aaron Durbin64031672018-04-21 14:45:32 -060085__weak void board_silicon_USB2_override(SILICON_INIT_UPD *params)
Matt DeVillier2c8ac222017-08-26 04:53:35 -050086{
87}
88
Lee Leahy32471722015-04-20 15:20:28 -070089void soc_silicon_init_params(SILICON_INIT_UPD *params)
90{
91 device_t dev = dev_find_slot(0, PCI_DEVFN(LPC_DEV, LPC_FUNC));
Ravi Sarawadid077b582015-09-09 14:12:16 -070092 struct soc_intel_braswell_config *config;
93
94 if (!dev) {
95 printk(BIOS_ERR,
96 "Error! Device (%s) not found, "
97 "soc_silicon_init_params!\n", dev_path(dev));
98 return;
99 }
100
101 config = dev->chip_info;
Lee Leahy32471722015-04-20 15:20:28 -0700102
103 /* Set the parameters for SiliconInit */
104 printk(BIOS_DEBUG, "Updating UPD values for SiliconInit\n");
105 params->PcdSdcardMode = config->PcdSdcardMode;
106 params->PcdEnableHsuart0 = config->PcdEnableHsuart0;
107 params->PcdEnableHsuart1 = config->PcdEnableHsuart1;
108 params->PcdEnableAzalia = config->PcdEnableAzalia;
Lee Leahy32471722015-04-20 15:20:28 -0700109 params->PcdEnableSata = config->PcdEnableSata;
110 params->PcdEnableXhci = config->PcdEnableXhci;
111 params->PcdEnableLpe = config->PcdEnableLpe;
112 params->PcdEnableDma0 = config->PcdEnableDma0;
113 params->PcdEnableDma1 = config->PcdEnableDma1;
114 params->PcdEnableI2C0 = config->PcdEnableI2C0;
115 params->PcdEnableI2C1 = config->PcdEnableI2C1;
116 params->PcdEnableI2C2 = config->PcdEnableI2C2;
117 params->PcdEnableI2C3 = config->PcdEnableI2C3;
118 params->PcdEnableI2C4 = config->PcdEnableI2C4;
119 params->PcdEnableI2C5 = config->PcdEnableI2C5;
120 params->PcdEnableI2C6 = config->PcdEnableI2C6;
Subrata Banik13cd3312015-08-07 18:22:54 +0530121 params->GraphicsConfigPtr = 0;
122 params->AzaliaConfigPtr = 0;
Lee Leahy32471722015-04-20 15:20:28 -0700123 params->PunitPwrConfigDisable = config->PunitPwrConfigDisable;
124 params->ChvSvidConfig = config->ChvSvidConfig;
125 params->DptfDisable = config->DptfDisable;
126 params->PcdEmmcMode = config->PcdEmmcMode;
127 params->PcdUsb3ClkSsc = config->PcdUsb3ClkSsc;
128 params->PcdDispClkSsc = config->PcdDispClkSsc;
129 params->PcdSataClkSsc = config->PcdSataClkSsc;
130 params->Usb2Port0PerPortPeTxiSet = config->Usb2Port0PerPortPeTxiSet;
131 params->Usb2Port0PerPortTxiSet = config->Usb2Port0PerPortTxiSet;
132 params->Usb2Port0IUsbTxEmphasisEn = config->Usb2Port0IUsbTxEmphasisEn;
133 params->Usb2Port0PerPortTxPeHalf = config->Usb2Port0PerPortTxPeHalf;
Kevin Chiu348a6d52016-06-30 14:50:52 +0800134 if (config->D0Usb2Port0PerPortRXISet != 0)
135 params->D0Usb2Port0PerPortRXISet = config->D0Usb2Port0PerPortRXISet;
136
Lee Leahy32471722015-04-20 15:20:28 -0700137 params->Usb2Port1PerPortPeTxiSet = config->Usb2Port1PerPortPeTxiSet;
138 params->Usb2Port1PerPortTxiSet = config->Usb2Port1PerPortTxiSet;
139 params->Usb2Port1IUsbTxEmphasisEn = config->Usb2Port1IUsbTxEmphasisEn;
140 params->Usb2Port1PerPortTxPeHalf = config->Usb2Port1PerPortTxPeHalf;
Kevin Chiu348a6d52016-06-30 14:50:52 +0800141 if (config->D0Usb2Port1PerPortRXISet != 0)
142 params->D0Usb2Port1PerPortRXISet = config->D0Usb2Port1PerPortRXISet;
143
Lee Leahy32471722015-04-20 15:20:28 -0700144 params->Usb2Port2PerPortPeTxiSet = config->Usb2Port2PerPortPeTxiSet;
145 params->Usb2Port2PerPortTxiSet = config->Usb2Port2PerPortTxiSet;
146 params->Usb2Port2IUsbTxEmphasisEn = config->Usb2Port2IUsbTxEmphasisEn;
147 params->Usb2Port2PerPortTxPeHalf = config->Usb2Port2PerPortTxPeHalf;
Kevin Chiu348a6d52016-06-30 14:50:52 +0800148 if (config->D0Usb2Port2PerPortRXISet != 0)
149 params->D0Usb2Port2PerPortRXISet = config->D0Usb2Port2PerPortRXISet;
150
Lee Leahy32471722015-04-20 15:20:28 -0700151 params->Usb2Port3PerPortPeTxiSet = config->Usb2Port3PerPortPeTxiSet;
152 params->Usb2Port3PerPortTxiSet = config->Usb2Port3PerPortTxiSet;
153 params->Usb2Port3IUsbTxEmphasisEn = config->Usb2Port3IUsbTxEmphasisEn;
154 params->Usb2Port3PerPortTxPeHalf = config->Usb2Port3PerPortTxPeHalf;
Kevin Chiu348a6d52016-06-30 14:50:52 +0800155 if (config->D0Usb2Port3PerPortRXISet != 0)
156 params->D0Usb2Port3PerPortRXISet = config->D0Usb2Port3PerPortRXISet;
157
Lee Leahy32471722015-04-20 15:20:28 -0700158 params->Usb2Port4PerPortPeTxiSet = config->Usb2Port4PerPortPeTxiSet;
159 params->Usb2Port4PerPortTxiSet = config->Usb2Port4PerPortTxiSet;
160 params->Usb2Port4IUsbTxEmphasisEn = config->Usb2Port4IUsbTxEmphasisEn;
161 params->Usb2Port4PerPortTxPeHalf = config->Usb2Port4PerPortTxPeHalf;
Kevin Chiu348a6d52016-06-30 14:50:52 +0800162 if (config->D0Usb2Port4PerPortRXISet != 0)
163 params->D0Usb2Port4PerPortRXISet = config->D0Usb2Port4PerPortRXISet;
164
Lee Leahy32471722015-04-20 15:20:28 -0700165 params->Usb3Lane0Ow2tapgen2deemph3p5 =
166 config->Usb3Lane0Ow2tapgen2deemph3p5;
167 params->Usb3Lane1Ow2tapgen2deemph3p5 =
168 config->Usb3Lane1Ow2tapgen2deemph3p5;
169 params->Usb3Lane2Ow2tapgen2deemph3p5 =
170 config->Usb3Lane2Ow2tapgen2deemph3p5;
171 params->Usb3Lane3Ow2tapgen2deemph3p5 =
172 config->Usb3Lane3Ow2tapgen2deemph3p5;
173 params->PcdSataInterfaceSpeed = config->PcdSataInterfaceSpeed;
174 params->PcdPchUsbSsicPort = config->PcdPchUsbSsicPort;
175 params->PcdPchUsbHsicPort = config->PcdPchUsbHsicPort;
176 params->PcdPcieRootPortSpeed = config->PcdPcieRootPortSpeed;
177 params->PcdPchSsicEnable = config->PcdPchSsicEnable;
178 params->PcdLogoPtr = config->PcdLogoPtr;
179 params->PcdLogoSize = config->PcdLogoSize;
180 params->PcdRtcLock = config->PcdRtcLock;
181 params->PMIC_I2CBus = config->PMIC_I2CBus;
182 params->ISPEnable = config->ISPEnable;
183 params->ISPPciDevConfig = config->ISPPciDevConfig;
Divya Sasidharan89a66852015-10-28 15:02:35 -0700184 params->PcdSdDetectChk = config->PcdSdDetectChk;
Divagar Mohandass0c685302016-02-08 16:09:21 +0530185 params->I2C0Frequency = config->I2C0Frequency;
186 params->I2C1Frequency = config->I2C1Frequency;
187 params->I2C2Frequency = config->I2C2Frequency;
188 params->I2C3Frequency = config->I2C3Frequency;
189 params->I2C4Frequency = config->I2C4Frequency;
190 params->I2C5Frequency = config->I2C5Frequency;
191 params->I2C6Frequency = config->I2C6Frequency;
Matt DeVillier143a8362017-08-26 04:47:15 -0500192
Matt DeVillier2c8ac222017-08-26 04:53:35 -0500193 board_silicon_USB2_override(params);
Lee Leahy32471722015-04-20 15:20:28 -0700194}
195
196void soc_display_silicon_init_params(const SILICON_INIT_UPD *old,
197 SILICON_INIT_UPD *new)
198{
199 /* Display the parameters for SiliconInit */
200 printk(BIOS_SPEW, "UPD values for SiliconInit:\n");
Lee Leahy66208bd2015-10-15 16:17:58 -0700201 fsp_display_upd_value("PcdSdcardMode", 1, old->PcdSdcardMode,
Lee Leahy32471722015-04-20 15:20:28 -0700202 new->PcdSdcardMode);
Lee Leahy66208bd2015-10-15 16:17:58 -0700203 fsp_display_upd_value("PcdEnableHsuart0", 1, old->PcdEnableHsuart0,
Lee Leahy32471722015-04-20 15:20:28 -0700204 new->PcdEnableHsuart0);
Lee Leahy66208bd2015-10-15 16:17:58 -0700205 fsp_display_upd_value("PcdEnableHsuart1", 1, old->PcdEnableHsuart1,
Lee Leahy32471722015-04-20 15:20:28 -0700206 new->PcdEnableHsuart1);
Lee Leahy66208bd2015-10-15 16:17:58 -0700207 fsp_display_upd_value("PcdEnableAzalia", 1, old->PcdEnableAzalia,
Lee Leahy32471722015-04-20 15:20:28 -0700208 new->PcdEnableAzalia);
Lee Leahy66208bd2015-10-15 16:17:58 -0700209 fsp_display_upd_value("AzaliaConfigPtr", 4,
Subrata Banik13cd3312015-08-07 18:22:54 +0530210 (uint32_t)old->AzaliaConfigPtr,
211 (uint32_t)new->AzaliaConfigPtr);
Lee Leahy66208bd2015-10-15 16:17:58 -0700212 fsp_display_upd_value("PcdEnableSata", 1, old->PcdEnableSata,
Lee Leahy32471722015-04-20 15:20:28 -0700213 new->PcdEnableSata);
Lee Leahy66208bd2015-10-15 16:17:58 -0700214 fsp_display_upd_value("PcdEnableXhci", 1, old->PcdEnableXhci,
Lee Leahy32471722015-04-20 15:20:28 -0700215 new->PcdEnableXhci);
Lee Leahy66208bd2015-10-15 16:17:58 -0700216 fsp_display_upd_value("PcdEnableLpe", 1, old->PcdEnableLpe,
Lee Leahy32471722015-04-20 15:20:28 -0700217 new->PcdEnableLpe);
Lee Leahy66208bd2015-10-15 16:17:58 -0700218 fsp_display_upd_value("PcdEnableDma0", 1, old->PcdEnableDma0,
Lee Leahy32471722015-04-20 15:20:28 -0700219 new->PcdEnableDma0);
Lee Leahy66208bd2015-10-15 16:17:58 -0700220 fsp_display_upd_value("PcdEnableDma1", 1, old->PcdEnableDma1,
Lee Leahy32471722015-04-20 15:20:28 -0700221 new->PcdEnableDma1);
Lee Leahy66208bd2015-10-15 16:17:58 -0700222 fsp_display_upd_value("PcdEnableI2C0", 1, old->PcdEnableI2C0,
Lee Leahy32471722015-04-20 15:20:28 -0700223 new->PcdEnableI2C0);
Lee Leahy66208bd2015-10-15 16:17:58 -0700224 fsp_display_upd_value("PcdEnableI2C1", 1, old->PcdEnableI2C1,
Lee Leahy32471722015-04-20 15:20:28 -0700225 new->PcdEnableI2C1);
Lee Leahy66208bd2015-10-15 16:17:58 -0700226 fsp_display_upd_value("PcdEnableI2C2", 1, old->PcdEnableI2C2,
Lee Leahy32471722015-04-20 15:20:28 -0700227 new->PcdEnableI2C2);
Lee Leahy66208bd2015-10-15 16:17:58 -0700228 fsp_display_upd_value("PcdEnableI2C3", 1, old->PcdEnableI2C3,
Lee Leahy32471722015-04-20 15:20:28 -0700229 new->PcdEnableI2C3);
Lee Leahy66208bd2015-10-15 16:17:58 -0700230 fsp_display_upd_value("PcdEnableI2C4", 1, old->PcdEnableI2C4,
Lee Leahy32471722015-04-20 15:20:28 -0700231 new->PcdEnableI2C4);
Lee Leahy66208bd2015-10-15 16:17:58 -0700232 fsp_display_upd_value("PcdEnableI2C5", 1, old->PcdEnableI2C5,
Lee Leahy32471722015-04-20 15:20:28 -0700233 new->PcdEnableI2C5);
Lee Leahy66208bd2015-10-15 16:17:58 -0700234 fsp_display_upd_value("PcdEnableI2C6", 1, old->PcdEnableI2C6,
Lee Leahy32471722015-04-20 15:20:28 -0700235 new->PcdEnableI2C6);
Lee Leahy66208bd2015-10-15 16:17:58 -0700236 fsp_display_upd_value("PcdGraphicsConfigPtr", 4,
Subrata Banik13cd3312015-08-07 18:22:54 +0530237 old->GraphicsConfigPtr, new->GraphicsConfigPtr);
Lee Leahy66208bd2015-10-15 16:17:58 -0700238 fsp_display_upd_value("GpioFamilyInitTablePtr", 4,
Lee Leahy32471722015-04-20 15:20:28 -0700239 (uint32_t)old->GpioFamilyInitTablePtr,
240 (uint32_t)new->GpioFamilyInitTablePtr);
Lee Leahy66208bd2015-10-15 16:17:58 -0700241 fsp_display_upd_value("GpioPadInitTablePtr", 4,
Lee Leahy32471722015-04-20 15:20:28 -0700242 (uint32_t)old->GpioPadInitTablePtr,
243 (uint32_t)new->GpioPadInitTablePtr);
Lee Leahy66208bd2015-10-15 16:17:58 -0700244 fsp_display_upd_value("PunitPwrConfigDisable", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700245 old->PunitPwrConfigDisable,
246 new->PunitPwrConfigDisable);
Lee Leahy66208bd2015-10-15 16:17:58 -0700247 fsp_display_upd_value("ChvSvidConfig", 1, old->ChvSvidConfig,
Lee Leahy32471722015-04-20 15:20:28 -0700248 new->ChvSvidConfig);
Lee Leahy66208bd2015-10-15 16:17:58 -0700249 fsp_display_upd_value("DptfDisable", 1, old->DptfDisable,
Lee Leahy32471722015-04-20 15:20:28 -0700250 new->DptfDisable);
Lee Leahy66208bd2015-10-15 16:17:58 -0700251 fsp_display_upd_value("PcdEmmcMode", 1, old->PcdEmmcMode,
Lee Leahy32471722015-04-20 15:20:28 -0700252 new->PcdEmmcMode);
Lee Leahy66208bd2015-10-15 16:17:58 -0700253 fsp_display_upd_value("PcdUsb3ClkSsc", 1, old->PcdUsb3ClkSsc,
Lee Leahy32471722015-04-20 15:20:28 -0700254 new->PcdUsb3ClkSsc);
Lee Leahy66208bd2015-10-15 16:17:58 -0700255 fsp_display_upd_value("PcdDispClkSsc", 1, old->PcdDispClkSsc,
Lee Leahy32471722015-04-20 15:20:28 -0700256 new->PcdDispClkSsc);
Lee Leahy66208bd2015-10-15 16:17:58 -0700257 fsp_display_upd_value("PcdSataClkSsc", 1, old->PcdSataClkSsc,
Lee Leahy32471722015-04-20 15:20:28 -0700258 new->PcdSataClkSsc);
Lee Leahy66208bd2015-10-15 16:17:58 -0700259 fsp_display_upd_value("Usb2Port0PerPortPeTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700260 old->Usb2Port0PerPortPeTxiSet,
261 new->Usb2Port0PerPortPeTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700262 fsp_display_upd_value("Usb2Port0PerPortTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700263 old->Usb2Port0PerPortTxiSet,
264 new->Usb2Port0PerPortTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700265 fsp_display_upd_value("Usb2Port0IUsbTxEmphasisEn", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700266 old->Usb2Port0IUsbTxEmphasisEn,
267 new->Usb2Port0IUsbTxEmphasisEn);
Lee Leahy66208bd2015-10-15 16:17:58 -0700268 fsp_display_upd_value("Usb2Port0PerPortTxPeHalf", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700269 old->Usb2Port0PerPortTxPeHalf,
270 new->Usb2Port0PerPortTxPeHalf);
Kevin Chiu348a6d52016-06-30 14:50:52 +0800271 fsp_display_upd_value("D0Usb2Port0PerPortRXISet", 1,
272 old->D0Usb2Port0PerPortRXISet,
273 new->D0Usb2Port0PerPortRXISet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700274 fsp_display_upd_value("Usb2Port1PerPortPeTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700275 old->Usb2Port1PerPortPeTxiSet,
276 new->Usb2Port1PerPortPeTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700277 fsp_display_upd_value("Usb2Port1PerPortTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700278 old->Usb2Port1PerPortTxiSet,
279 new->Usb2Port1PerPortTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700280 fsp_display_upd_value("Usb2Port1IUsbTxEmphasisEn", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700281 old->Usb2Port1IUsbTxEmphasisEn,
282 new->Usb2Port1IUsbTxEmphasisEn);
Lee Leahy66208bd2015-10-15 16:17:58 -0700283 fsp_display_upd_value("Usb2Port1PerPortTxPeHalf", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700284 old->Usb2Port1PerPortTxPeHalf,
285 new->Usb2Port1PerPortTxPeHalf);
Kevin Chiu348a6d52016-06-30 14:50:52 +0800286 fsp_display_upd_value("D0Usb2Port1PerPortRXISet", 1,
287 old->D0Usb2Port1PerPortRXISet,
288 new->D0Usb2Port1PerPortRXISet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700289 fsp_display_upd_value("Usb2Port2PerPortPeTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700290 old->Usb2Port2PerPortPeTxiSet,
291 new->Usb2Port2PerPortPeTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700292 fsp_display_upd_value("Usb2Port2PerPortTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700293 old->Usb2Port2PerPortTxiSet,
294 new->Usb2Port2PerPortTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700295 fsp_display_upd_value("Usb2Port2IUsbTxEmphasisEn", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700296 old->Usb2Port2IUsbTxEmphasisEn,
297 new->Usb2Port2IUsbTxEmphasisEn);
Lee Leahy66208bd2015-10-15 16:17:58 -0700298 fsp_display_upd_value("Usb2Port2PerPortTxPeHalf", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700299 old->Usb2Port2PerPortTxPeHalf,
300 new->Usb2Port2PerPortTxPeHalf);
Kevin Chiu348a6d52016-06-30 14:50:52 +0800301 fsp_display_upd_value("D0Usb2Port2PerPortRXISet", 1,
302 old->D0Usb2Port2PerPortRXISet,
303 new->D0Usb2Port2PerPortRXISet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700304 fsp_display_upd_value("Usb2Port3PerPortPeTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700305 old->Usb2Port3PerPortPeTxiSet,
306 new->Usb2Port3PerPortPeTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700307 fsp_display_upd_value("Usb2Port3PerPortTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700308 old->Usb2Port3PerPortTxiSet,
309 new->Usb2Port3PerPortTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700310 fsp_display_upd_value("Usb2Port3IUsbTxEmphasisEn", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700311 old->Usb2Port3IUsbTxEmphasisEn,
312 new->Usb2Port3IUsbTxEmphasisEn);
Lee Leahy66208bd2015-10-15 16:17:58 -0700313 fsp_display_upd_value("Usb2Port3PerPortTxPeHalf", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700314 old->Usb2Port3PerPortTxPeHalf,
315 new->Usb2Port3PerPortTxPeHalf);
Kevin Chiu348a6d52016-06-30 14:50:52 +0800316 fsp_display_upd_value("D0Usb2Port3PerPortRXISet", 1,
317 old->D0Usb2Port3PerPortRXISet,
318 new->D0Usb2Port3PerPortRXISet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700319 fsp_display_upd_value("Usb2Port4PerPortPeTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700320 old->Usb2Port4PerPortPeTxiSet,
321 new->Usb2Port4PerPortPeTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700322 fsp_display_upd_value("Usb2Port4PerPortTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700323 old->Usb2Port4PerPortTxiSet,
324 new->Usb2Port4PerPortTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700325 fsp_display_upd_value("Usb2Port4IUsbTxEmphasisEn", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700326 old->Usb2Port4IUsbTxEmphasisEn,
327 new->Usb2Port4IUsbTxEmphasisEn);
Lee Leahy66208bd2015-10-15 16:17:58 -0700328 fsp_display_upd_value("Usb2Port4PerPortTxPeHalf", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700329 old->Usb2Port4PerPortTxPeHalf,
330 new->Usb2Port4PerPortTxPeHalf);
Kevin Chiu348a6d52016-06-30 14:50:52 +0800331 fsp_display_upd_value("D0Usb2Port4PerPortRXISet", 1,
332 old->D0Usb2Port4PerPortRXISet,
333 new->D0Usb2Port4PerPortRXISet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700334 fsp_display_upd_value("Usb3Lane0Ow2tapgen2deemph3p5", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700335 old->Usb3Lane0Ow2tapgen2deemph3p5,
336 new->Usb3Lane0Ow2tapgen2deemph3p5);
Lee Leahy66208bd2015-10-15 16:17:58 -0700337 fsp_display_upd_value("Usb3Lane1Ow2tapgen2deemph3p5", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700338 old->Usb3Lane1Ow2tapgen2deemph3p5,
339 new->Usb3Lane1Ow2tapgen2deemph3p5);
Lee Leahy66208bd2015-10-15 16:17:58 -0700340 fsp_display_upd_value("Usb3Lane2Ow2tapgen2deemph3p5", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700341 old->Usb3Lane2Ow2tapgen2deemph3p5,
342 new->Usb3Lane2Ow2tapgen2deemph3p5);
Lee Leahy66208bd2015-10-15 16:17:58 -0700343 fsp_display_upd_value("Usb3Lane3Ow2tapgen2deemph3p5", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700344 old->Usb3Lane3Ow2tapgen2deemph3p5,
345 new->Usb3Lane3Ow2tapgen2deemph3p5);
Lee Leahy66208bd2015-10-15 16:17:58 -0700346 fsp_display_upd_value("PcdSataInterfaceSpeed", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700347 old->PcdSataInterfaceSpeed,
348 new->PcdSataInterfaceSpeed);
Lee Leahy66208bd2015-10-15 16:17:58 -0700349 fsp_display_upd_value("PcdPchUsbSsicPort", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700350 old->PcdPchUsbSsicPort, new->PcdPchUsbSsicPort);
Lee Leahy66208bd2015-10-15 16:17:58 -0700351 fsp_display_upd_value("PcdPchUsbHsicPort", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700352 old->PcdPchUsbHsicPort, new->PcdPchUsbHsicPort);
Lee Leahy66208bd2015-10-15 16:17:58 -0700353 fsp_display_upd_value("PcdPcieRootPortSpeed", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700354 old->PcdPcieRootPortSpeed, new->PcdPcieRootPortSpeed);
Lee Leahy66208bd2015-10-15 16:17:58 -0700355 fsp_display_upd_value("PcdPchSsicEnable", 1, old->PcdPchSsicEnable,
Lee Leahy32471722015-04-20 15:20:28 -0700356 new->PcdPchSsicEnable);
Lee Leahy66208bd2015-10-15 16:17:58 -0700357 fsp_display_upd_value("PcdLogoPtr", 4, old->PcdLogoPtr,
Lee Leahy32471722015-04-20 15:20:28 -0700358 new->PcdLogoPtr);
Lee Leahy66208bd2015-10-15 16:17:58 -0700359 fsp_display_upd_value("PcdLogoSize", 4, old->PcdLogoSize,
Lee Leahy32471722015-04-20 15:20:28 -0700360 new->PcdLogoSize);
Lee Leahy66208bd2015-10-15 16:17:58 -0700361 fsp_display_upd_value("PcdRtcLock", 1, old->PcdRtcLock,
Lee Leahy32471722015-04-20 15:20:28 -0700362 new->PcdRtcLock);
Lee Leahy66208bd2015-10-15 16:17:58 -0700363 fsp_display_upd_value("PMIC_I2CBus", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700364 old->PMIC_I2CBus, new->PMIC_I2CBus);
Lee Leahy66208bd2015-10-15 16:17:58 -0700365 fsp_display_upd_value("ISPEnable", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700366 old->ISPEnable, new->ISPEnable);
Lee Leahy66208bd2015-10-15 16:17:58 -0700367 fsp_display_upd_value("ISPPciDevConfig", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700368 old->ISPPciDevConfig, new->ISPPciDevConfig);
Divya Sasidharan89a66852015-10-28 15:02:35 -0700369 fsp_display_upd_value("PcdSdDetectChk", 1,
370 old->PcdSdDetectChk, new->PcdSdDetectChk);
Lee Leahy32471722015-04-20 15:20:28 -0700371}
372
Lee Leahy77ff0b12015-05-05 15:07:29 -0700373/* Called at BS_DEV_INIT_CHIPS time -- very early. Just after BS_PRE_DEVICE. */
374static void soc_init(void *chip_info)
375{
Lee Leahy32471722015-04-20 15:20:28 -0700376 printk(BIOS_SPEW, "%s/%s\n", __FILE__, __func__);
377 soc_init_pre_device(chip_info);
Lee Leahy77ff0b12015-05-05 15:07:29 -0700378}
379
Lee Leahy32471722015-04-20 15:20:28 -0700380struct chip_operations soc_intel_braswell_ops = {
381 CHIP_NAME("Intel Braswell SoC")
Lee Leahy77ff0b12015-05-05 15:07:29 -0700382 .enable_dev = enable_dev,
383 .init = soc_init,
384};
385
Lee Leahy1072e7d2017-03-16 17:35:32 -0700386static void pci_set_subsystem(device_t dev, unsigned int vendor,
387 unsigned int device)
Lee Leahy77ff0b12015-05-05 15:07:29 -0700388{
Lee Leahy32471722015-04-20 15:20:28 -0700389 printk(BIOS_SPEW, "%s/%s ( %s, 0x%04x, 0x%04x )\n",
390 __FILE__, __func__, dev_name(dev), vendor, device);
Lee Leahy77ff0b12015-05-05 15:07:29 -0700391 if (!vendor || !device) {
392 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
393 pci_read_config32(dev, PCI_VENDOR_ID));
394 } else {
395 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
396 ((device & 0xffff) << 16) | (vendor & 0xffff));
397 }
398}
399
400struct pci_operations soc_pci_ops = {
401 .set_subsystem = &pci_set_subsystem,
402};
Matt DeVillier143a8362017-08-26 04:47:15 -0500403
404/**
405 Return SoC stepping type
406
407 @retval SOC_STEPPING SoC stepping type
408**/
409int SocStepping(void)
410{
411 device_t dev = dev_find_slot(0, PCI_DEVFN(LPC_DEV, LPC_FUNC));
412 u8 revid = pci_read_config8(dev, 0x8);
413
414 switch (revid & B_PCH_LPC_RID_STEPPING_MASK) {
415 case V_PCH_LPC_RID_A0:
416 return SocA0;
417 case V_PCH_LPC_RID_A1:
418 return SocA1;
419 case V_PCH_LPC_RID_A2:
420 return SocA2;
421 case V_PCH_LPC_RID_A3:
422 return SocA3;
423 case V_PCH_LPC_RID_A4:
424 return SocA4;
425 case V_PCH_LPC_RID_A5:
426 return SocA5;
427 case V_PCH_LPC_RID_A6:
428 return SocA6;
429 case V_PCH_LPC_RID_A7:
430 return SocA7;
431 case V_PCH_LPC_RID_B0:
432 return SocB0;
433 case V_PCH_LPC_RID_B1:
434 return SocB1;
435 case V_PCH_LPC_RID_B2:
436 return SocB2;
437 case V_PCH_LPC_RID_B3:
438 return SocB3;
439 case V_PCH_LPC_RID_B4:
440 return SocB4;
441 case V_PCH_LPC_RID_B5:
442 return SocB5;
443 case V_PCH_LPC_RID_B6:
444 return SocB6;
445 case V_PCH_LPC_RID_B7:
446 return SocB7;
447 case V_PCH_LPC_RID_C0:
448 return SocC0;
449 case V_PCH_LPC_RID_C1:
450 return SocC1;
451 case V_PCH_LPC_RID_C2:
452 return SocC2;
453 case V_PCH_LPC_RID_C3:
454 return SocC3;
455 case V_PCH_LPC_RID_C4:
456 return SocC4;
457 case V_PCH_LPC_RID_C5:
458 return SocC5;
459 case V_PCH_LPC_RID_C6:
460 return SocC6;
461 case V_PCH_LPC_RID_C7:
462 return SocC7;
463 case V_PCH_LPC_RID_D0:
464 return SocD0;
465 case V_PCH_LPC_RID_D1:
466 return SocD1;
467 case V_PCH_LPC_RID_D2:
468 return SocD2;
469 case V_PCH_LPC_RID_D3:
470 return SocD3;
471 case V_PCH_LPC_RID_D4:
472 return SocD4;
473 case V_PCH_LPC_RID_D5:
474 return SocD5;
475 case V_PCH_LPC_RID_D6:
476 return SocD6;
477 case V_PCH_LPC_RID_D7:
478 return SocD7;
479 default:
480 return SocSteppingMax;
481 }
482}