blob: afa90c32db712731444dee94d4e03baa83887c79 [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>
Lee Leahy77ff0b12015-05-05 15:07:29 -070018#include <console/console.h>
19#include <device/device.h>
20#include <device/pci.h>
Aaron Durbin789f2b62015-09-09 17:05:06 -050021#include <fsp/util.h>
Lee Leahy77ff0b12015-05-05 15:07:29 -070022#include <soc/pci_devs.h>
23#include <soc/ramstage.h>
Lee Leahy77ff0b12015-05-05 15:07:29 -070024
25static void pci_domain_set_resources(device_t dev)
26{
Lee Leahy32471722015-04-20 15:20:28 -070027 printk(BIOS_SPEW, "%s/%s ( %s )\n",
28 __FILE__, __func__, dev_name(dev));
Lee Leahy77ff0b12015-05-05 15:07:29 -070029 assign_resources(dev->link_list);
30}
31
32static struct device_operations pci_domain_ops = {
33 .read_resources = pci_domain_read_resources,
34 .set_resources = pci_domain_set_resources,
35 .enable_resources = NULL,
36 .init = NULL,
37 .scan_bus = pci_domain_scan_bus,
38 .ops_pci_bus = pci_bus_default_ops,
39};
40
Lee Leahy32471722015-04-20 15:20:28 -070041static void cpu_bus_noop(device_t dev) { }
42
Lee Leahy77ff0b12015-05-05 15:07:29 -070043static struct device_operations cpu_bus_ops = {
Lee Leahy32471722015-04-20 15:20:28 -070044 .read_resources = cpu_bus_noop,
45 .set_resources = cpu_bus_noop,
46 .enable_resources = cpu_bus_noop,
47 .init = soc_init_cpus
Lee Leahy77ff0b12015-05-05 15:07:29 -070048};
49
50
51static void enable_dev(device_t dev)
52{
Lee Leahy32471722015-04-20 15:20:28 -070053 printk(BIOS_SPEW, "----------\n%s/%s ( %s ), type: %d\n",
54 __FILE__, __func__,
55 dev_name(dev), dev->path.type);
56 printk(BIOS_SPEW, "vendor: 0x%04x. device: 0x%04x\n",
57 pci_read_config16(dev, PCI_VENDOR_ID),
58 pci_read_config16(dev, PCI_DEVICE_ID));
59 printk(BIOS_SPEW, "class: 0x%02x %s\n"
60 "subclass: 0x%02x %s\n"
61 "prog: 0x%02x\n"
62 "revision: 0x%02x\n",
63 pci_read_config16(dev, PCI_CLASS_DEVICE) >> 8,
64 get_pci_class_name(dev),
65 pci_read_config16(dev, PCI_CLASS_DEVICE) & 0xff,
66 get_pci_subclass_name(dev),
67 pci_read_config8(dev, PCI_CLASS_PROG),
68 pci_read_config8(dev, PCI_REVISION_ID));
69
Lee Leahy77ff0b12015-05-05 15:07:29 -070070 /* Set the operations if it is a special bus type */
71 if (dev->path.type == DEVICE_PATH_DOMAIN) {
72 dev->ops = &pci_domain_ops;
73 } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) {
74 dev->ops = &cpu_bus_ops;
75 } else if (dev->path.type == DEVICE_PATH_PCI) {
76 /* Handle south cluster enablement. */
77 if (PCI_SLOT(dev->path.pci.devfn) > GFX_DEV &&
78 (dev->ops == NULL || dev->ops->enable == NULL)) {
79 southcluster_enable_dev(dev);
80 }
81 }
82}
83
Matt DeVillier2c8ac222017-08-26 04:53:35 -050084__attribute__((weak)) void board_silicon_USB2_override(SILICON_INIT_UPD *params)
85{
86}
87
Lee Leahy32471722015-04-20 15:20:28 -070088void soc_silicon_init_params(SILICON_INIT_UPD *params)
89{
90 device_t dev = dev_find_slot(0, PCI_DEVFN(LPC_DEV, LPC_FUNC));
Ravi Sarawadid077b582015-09-09 14:12:16 -070091 struct soc_intel_braswell_config *config;
92
93 if (!dev) {
94 printk(BIOS_ERR,
95 "Error! Device (%s) not found, "
96 "soc_silicon_init_params!\n", dev_path(dev));
97 return;
98 }
99
100 config = dev->chip_info;
Lee Leahy32471722015-04-20 15:20:28 -0700101
102 /* Set the parameters for SiliconInit */
103 printk(BIOS_DEBUG, "Updating UPD values for SiliconInit\n");
104 params->PcdSdcardMode = config->PcdSdcardMode;
105 params->PcdEnableHsuart0 = config->PcdEnableHsuart0;
106 params->PcdEnableHsuart1 = config->PcdEnableHsuart1;
107 params->PcdEnableAzalia = config->PcdEnableAzalia;
Lee Leahy32471722015-04-20 15:20:28 -0700108 params->PcdEnableSata = config->PcdEnableSata;
109 params->PcdEnableXhci = config->PcdEnableXhci;
110 params->PcdEnableLpe = config->PcdEnableLpe;
111 params->PcdEnableDma0 = config->PcdEnableDma0;
112 params->PcdEnableDma1 = config->PcdEnableDma1;
113 params->PcdEnableI2C0 = config->PcdEnableI2C0;
114 params->PcdEnableI2C1 = config->PcdEnableI2C1;
115 params->PcdEnableI2C2 = config->PcdEnableI2C2;
116 params->PcdEnableI2C3 = config->PcdEnableI2C3;
117 params->PcdEnableI2C4 = config->PcdEnableI2C4;
118 params->PcdEnableI2C5 = config->PcdEnableI2C5;
119 params->PcdEnableI2C6 = config->PcdEnableI2C6;
Subrata Banik13cd3312015-08-07 18:22:54 +0530120 params->GraphicsConfigPtr = 0;
121 params->AzaliaConfigPtr = 0;
Lee Leahy32471722015-04-20 15:20:28 -0700122 params->PunitPwrConfigDisable = config->PunitPwrConfigDisable;
123 params->ChvSvidConfig = config->ChvSvidConfig;
124 params->DptfDisable = config->DptfDisable;
125 params->PcdEmmcMode = config->PcdEmmcMode;
126 params->PcdUsb3ClkSsc = config->PcdUsb3ClkSsc;
127 params->PcdDispClkSsc = config->PcdDispClkSsc;
128 params->PcdSataClkSsc = config->PcdSataClkSsc;
129 params->Usb2Port0PerPortPeTxiSet = config->Usb2Port0PerPortPeTxiSet;
130 params->Usb2Port0PerPortTxiSet = config->Usb2Port0PerPortTxiSet;
131 params->Usb2Port0IUsbTxEmphasisEn = config->Usb2Port0IUsbTxEmphasisEn;
132 params->Usb2Port0PerPortTxPeHalf = config->Usb2Port0PerPortTxPeHalf;
133 params->Usb2Port1PerPortPeTxiSet = config->Usb2Port1PerPortPeTxiSet;
134 params->Usb2Port1PerPortTxiSet = config->Usb2Port1PerPortTxiSet;
135 params->Usb2Port1IUsbTxEmphasisEn = config->Usb2Port1IUsbTxEmphasisEn;
136 params->Usb2Port1PerPortTxPeHalf = config->Usb2Port1PerPortTxPeHalf;
137 params->Usb2Port2PerPortPeTxiSet = config->Usb2Port2PerPortPeTxiSet;
138 params->Usb2Port2PerPortTxiSet = config->Usb2Port2PerPortTxiSet;
139 params->Usb2Port2IUsbTxEmphasisEn = config->Usb2Port2IUsbTxEmphasisEn;
140 params->Usb2Port2PerPortTxPeHalf = config->Usb2Port2PerPortTxPeHalf;
141 params->Usb2Port3PerPortPeTxiSet = config->Usb2Port3PerPortPeTxiSet;
142 params->Usb2Port3PerPortTxiSet = config->Usb2Port3PerPortTxiSet;
143 params->Usb2Port3IUsbTxEmphasisEn = config->Usb2Port3IUsbTxEmphasisEn;
144 params->Usb2Port3PerPortTxPeHalf = config->Usb2Port3PerPortTxPeHalf;
145 params->Usb2Port4PerPortPeTxiSet = config->Usb2Port4PerPortPeTxiSet;
146 params->Usb2Port4PerPortTxiSet = config->Usb2Port4PerPortTxiSet;
147 params->Usb2Port4IUsbTxEmphasisEn = config->Usb2Port4IUsbTxEmphasisEn;
148 params->Usb2Port4PerPortTxPeHalf = config->Usb2Port4PerPortTxPeHalf;
149 params->Usb3Lane0Ow2tapgen2deemph3p5 =
150 config->Usb3Lane0Ow2tapgen2deemph3p5;
151 params->Usb3Lane1Ow2tapgen2deemph3p5 =
152 config->Usb3Lane1Ow2tapgen2deemph3p5;
153 params->Usb3Lane2Ow2tapgen2deemph3p5 =
154 config->Usb3Lane2Ow2tapgen2deemph3p5;
155 params->Usb3Lane3Ow2tapgen2deemph3p5 =
156 config->Usb3Lane3Ow2tapgen2deemph3p5;
157 params->PcdSataInterfaceSpeed = config->PcdSataInterfaceSpeed;
158 params->PcdPchUsbSsicPort = config->PcdPchUsbSsicPort;
159 params->PcdPchUsbHsicPort = config->PcdPchUsbHsicPort;
160 params->PcdPcieRootPortSpeed = config->PcdPcieRootPortSpeed;
161 params->PcdPchSsicEnable = config->PcdPchSsicEnable;
162 params->PcdLogoPtr = config->PcdLogoPtr;
163 params->PcdLogoSize = config->PcdLogoSize;
164 params->PcdRtcLock = config->PcdRtcLock;
165 params->PMIC_I2CBus = config->PMIC_I2CBus;
166 params->ISPEnable = config->ISPEnable;
167 params->ISPPciDevConfig = config->ISPPciDevConfig;
Divya Sasidharan89a66852015-10-28 15:02:35 -0700168 params->PcdSdDetectChk = config->PcdSdDetectChk;
Divagar Mohandass0c685302016-02-08 16:09:21 +0530169 params->I2C0Frequency = config->I2C0Frequency;
170 params->I2C1Frequency = config->I2C1Frequency;
171 params->I2C2Frequency = config->I2C2Frequency;
172 params->I2C3Frequency = config->I2C3Frequency;
173 params->I2C4Frequency = config->I2C4Frequency;
174 params->I2C5Frequency = config->I2C5Frequency;
175 params->I2C6Frequency = config->I2C6Frequency;
Matt DeVillier143a8362017-08-26 04:47:15 -0500176
Matt DeVillier2c8ac222017-08-26 04:53:35 -0500177 board_silicon_USB2_override(params);
Lee Leahy32471722015-04-20 15:20:28 -0700178}
179
180void soc_display_silicon_init_params(const SILICON_INIT_UPD *old,
181 SILICON_INIT_UPD *new)
182{
183 /* Display the parameters for SiliconInit */
184 printk(BIOS_SPEW, "UPD values for SiliconInit:\n");
Lee Leahy66208bd2015-10-15 16:17:58 -0700185 fsp_display_upd_value("PcdSdcardMode", 1, old->PcdSdcardMode,
Lee Leahy32471722015-04-20 15:20:28 -0700186 new->PcdSdcardMode);
Lee Leahy66208bd2015-10-15 16:17:58 -0700187 fsp_display_upd_value("PcdEnableHsuart0", 1, old->PcdEnableHsuart0,
Lee Leahy32471722015-04-20 15:20:28 -0700188 new->PcdEnableHsuart0);
Lee Leahy66208bd2015-10-15 16:17:58 -0700189 fsp_display_upd_value("PcdEnableHsuart1", 1, old->PcdEnableHsuart1,
Lee Leahy32471722015-04-20 15:20:28 -0700190 new->PcdEnableHsuart1);
Lee Leahy66208bd2015-10-15 16:17:58 -0700191 fsp_display_upd_value("PcdEnableAzalia", 1, old->PcdEnableAzalia,
Lee Leahy32471722015-04-20 15:20:28 -0700192 new->PcdEnableAzalia);
Lee Leahy66208bd2015-10-15 16:17:58 -0700193 fsp_display_upd_value("AzaliaConfigPtr", 4,
Subrata Banik13cd3312015-08-07 18:22:54 +0530194 (uint32_t)old->AzaliaConfigPtr,
195 (uint32_t)new->AzaliaConfigPtr);
Lee Leahy66208bd2015-10-15 16:17:58 -0700196 fsp_display_upd_value("PcdEnableSata", 1, old->PcdEnableSata,
Lee Leahy32471722015-04-20 15:20:28 -0700197 new->PcdEnableSata);
Lee Leahy66208bd2015-10-15 16:17:58 -0700198 fsp_display_upd_value("PcdEnableXhci", 1, old->PcdEnableXhci,
Lee Leahy32471722015-04-20 15:20:28 -0700199 new->PcdEnableXhci);
Lee Leahy66208bd2015-10-15 16:17:58 -0700200 fsp_display_upd_value("PcdEnableLpe", 1, old->PcdEnableLpe,
Lee Leahy32471722015-04-20 15:20:28 -0700201 new->PcdEnableLpe);
Lee Leahy66208bd2015-10-15 16:17:58 -0700202 fsp_display_upd_value("PcdEnableDma0", 1, old->PcdEnableDma0,
Lee Leahy32471722015-04-20 15:20:28 -0700203 new->PcdEnableDma0);
Lee Leahy66208bd2015-10-15 16:17:58 -0700204 fsp_display_upd_value("PcdEnableDma1", 1, old->PcdEnableDma1,
Lee Leahy32471722015-04-20 15:20:28 -0700205 new->PcdEnableDma1);
Lee Leahy66208bd2015-10-15 16:17:58 -0700206 fsp_display_upd_value("PcdEnableI2C0", 1, old->PcdEnableI2C0,
Lee Leahy32471722015-04-20 15:20:28 -0700207 new->PcdEnableI2C0);
Lee Leahy66208bd2015-10-15 16:17:58 -0700208 fsp_display_upd_value("PcdEnableI2C1", 1, old->PcdEnableI2C1,
Lee Leahy32471722015-04-20 15:20:28 -0700209 new->PcdEnableI2C1);
Lee Leahy66208bd2015-10-15 16:17:58 -0700210 fsp_display_upd_value("PcdEnableI2C2", 1, old->PcdEnableI2C2,
Lee Leahy32471722015-04-20 15:20:28 -0700211 new->PcdEnableI2C2);
Lee Leahy66208bd2015-10-15 16:17:58 -0700212 fsp_display_upd_value("PcdEnableI2C3", 1, old->PcdEnableI2C3,
Lee Leahy32471722015-04-20 15:20:28 -0700213 new->PcdEnableI2C3);
Lee Leahy66208bd2015-10-15 16:17:58 -0700214 fsp_display_upd_value("PcdEnableI2C4", 1, old->PcdEnableI2C4,
Lee Leahy32471722015-04-20 15:20:28 -0700215 new->PcdEnableI2C4);
Lee Leahy66208bd2015-10-15 16:17:58 -0700216 fsp_display_upd_value("PcdEnableI2C5", 1, old->PcdEnableI2C5,
Lee Leahy32471722015-04-20 15:20:28 -0700217 new->PcdEnableI2C5);
Lee Leahy66208bd2015-10-15 16:17:58 -0700218 fsp_display_upd_value("PcdEnableI2C6", 1, old->PcdEnableI2C6,
Lee Leahy32471722015-04-20 15:20:28 -0700219 new->PcdEnableI2C6);
Lee Leahy66208bd2015-10-15 16:17:58 -0700220 fsp_display_upd_value("PcdGraphicsConfigPtr", 4,
Subrata Banik13cd3312015-08-07 18:22:54 +0530221 old->GraphicsConfigPtr, new->GraphicsConfigPtr);
Lee Leahy66208bd2015-10-15 16:17:58 -0700222 fsp_display_upd_value("GpioFamilyInitTablePtr", 4,
Lee Leahy32471722015-04-20 15:20:28 -0700223 (uint32_t)old->GpioFamilyInitTablePtr,
224 (uint32_t)new->GpioFamilyInitTablePtr);
Lee Leahy66208bd2015-10-15 16:17:58 -0700225 fsp_display_upd_value("GpioPadInitTablePtr", 4,
Lee Leahy32471722015-04-20 15:20:28 -0700226 (uint32_t)old->GpioPadInitTablePtr,
227 (uint32_t)new->GpioPadInitTablePtr);
Lee Leahy66208bd2015-10-15 16:17:58 -0700228 fsp_display_upd_value("PunitPwrConfigDisable", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700229 old->PunitPwrConfigDisable,
230 new->PunitPwrConfigDisable);
Lee Leahy66208bd2015-10-15 16:17:58 -0700231 fsp_display_upd_value("ChvSvidConfig", 1, old->ChvSvidConfig,
Lee Leahy32471722015-04-20 15:20:28 -0700232 new->ChvSvidConfig);
Lee Leahy66208bd2015-10-15 16:17:58 -0700233 fsp_display_upd_value("DptfDisable", 1, old->DptfDisable,
Lee Leahy32471722015-04-20 15:20:28 -0700234 new->DptfDisable);
Lee Leahy66208bd2015-10-15 16:17:58 -0700235 fsp_display_upd_value("PcdEmmcMode", 1, old->PcdEmmcMode,
Lee Leahy32471722015-04-20 15:20:28 -0700236 new->PcdEmmcMode);
Lee Leahy66208bd2015-10-15 16:17:58 -0700237 fsp_display_upd_value("PcdUsb3ClkSsc", 1, old->PcdUsb3ClkSsc,
Lee Leahy32471722015-04-20 15:20:28 -0700238 new->PcdUsb3ClkSsc);
Lee Leahy66208bd2015-10-15 16:17:58 -0700239 fsp_display_upd_value("PcdDispClkSsc", 1, old->PcdDispClkSsc,
Lee Leahy32471722015-04-20 15:20:28 -0700240 new->PcdDispClkSsc);
Lee Leahy66208bd2015-10-15 16:17:58 -0700241 fsp_display_upd_value("PcdSataClkSsc", 1, old->PcdSataClkSsc,
Lee Leahy32471722015-04-20 15:20:28 -0700242 new->PcdSataClkSsc);
Lee Leahy66208bd2015-10-15 16:17:58 -0700243 fsp_display_upd_value("Usb2Port0PerPortPeTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700244 old->Usb2Port0PerPortPeTxiSet,
245 new->Usb2Port0PerPortPeTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700246 fsp_display_upd_value("Usb2Port0PerPortTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700247 old->Usb2Port0PerPortTxiSet,
248 new->Usb2Port0PerPortTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700249 fsp_display_upd_value("Usb2Port0IUsbTxEmphasisEn", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700250 old->Usb2Port0IUsbTxEmphasisEn,
251 new->Usb2Port0IUsbTxEmphasisEn);
Lee Leahy66208bd2015-10-15 16:17:58 -0700252 fsp_display_upd_value("Usb2Port0PerPortTxPeHalf", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700253 old->Usb2Port0PerPortTxPeHalf,
254 new->Usb2Port0PerPortTxPeHalf);
Lee Leahy66208bd2015-10-15 16:17:58 -0700255 fsp_display_upd_value("Usb2Port1PerPortPeTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700256 old->Usb2Port1PerPortPeTxiSet,
257 new->Usb2Port1PerPortPeTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700258 fsp_display_upd_value("Usb2Port1PerPortTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700259 old->Usb2Port1PerPortTxiSet,
260 new->Usb2Port1PerPortTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700261 fsp_display_upd_value("Usb2Port1IUsbTxEmphasisEn", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700262 old->Usb2Port1IUsbTxEmphasisEn,
263 new->Usb2Port1IUsbTxEmphasisEn);
Lee Leahy66208bd2015-10-15 16:17:58 -0700264 fsp_display_upd_value("Usb2Port1PerPortTxPeHalf", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700265 old->Usb2Port1PerPortTxPeHalf,
266 new->Usb2Port1PerPortTxPeHalf);
Lee Leahy66208bd2015-10-15 16:17:58 -0700267 fsp_display_upd_value("Usb2Port2PerPortPeTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700268 old->Usb2Port2PerPortPeTxiSet,
269 new->Usb2Port2PerPortPeTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700270 fsp_display_upd_value("Usb2Port2PerPortTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700271 old->Usb2Port2PerPortTxiSet,
272 new->Usb2Port2PerPortTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700273 fsp_display_upd_value("Usb2Port2IUsbTxEmphasisEn", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700274 old->Usb2Port2IUsbTxEmphasisEn,
275 new->Usb2Port2IUsbTxEmphasisEn);
Lee Leahy66208bd2015-10-15 16:17:58 -0700276 fsp_display_upd_value("Usb2Port2PerPortTxPeHalf", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700277 old->Usb2Port2PerPortTxPeHalf,
278 new->Usb2Port2PerPortTxPeHalf);
Lee Leahy66208bd2015-10-15 16:17:58 -0700279 fsp_display_upd_value("Usb2Port3PerPortPeTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700280 old->Usb2Port3PerPortPeTxiSet,
281 new->Usb2Port3PerPortPeTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700282 fsp_display_upd_value("Usb2Port3PerPortTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700283 old->Usb2Port3PerPortTxiSet,
284 new->Usb2Port3PerPortTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700285 fsp_display_upd_value("Usb2Port3IUsbTxEmphasisEn", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700286 old->Usb2Port3IUsbTxEmphasisEn,
287 new->Usb2Port3IUsbTxEmphasisEn);
Lee Leahy66208bd2015-10-15 16:17:58 -0700288 fsp_display_upd_value("Usb2Port3PerPortTxPeHalf", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700289 old->Usb2Port3PerPortTxPeHalf,
290 new->Usb2Port3PerPortTxPeHalf);
Lee Leahy66208bd2015-10-15 16:17:58 -0700291 fsp_display_upd_value("Usb2Port4PerPortPeTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700292 old->Usb2Port4PerPortPeTxiSet,
293 new->Usb2Port4PerPortPeTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700294 fsp_display_upd_value("Usb2Port4PerPortTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700295 old->Usb2Port4PerPortTxiSet,
296 new->Usb2Port4PerPortTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700297 fsp_display_upd_value("Usb2Port4IUsbTxEmphasisEn", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700298 old->Usb2Port4IUsbTxEmphasisEn,
299 new->Usb2Port4IUsbTxEmphasisEn);
Lee Leahy66208bd2015-10-15 16:17:58 -0700300 fsp_display_upd_value("Usb2Port4PerPortTxPeHalf", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700301 old->Usb2Port4PerPortTxPeHalf,
302 new->Usb2Port4PerPortTxPeHalf);
Lee Leahy66208bd2015-10-15 16:17:58 -0700303 fsp_display_upd_value("Usb3Lane0Ow2tapgen2deemph3p5", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700304 old->Usb3Lane0Ow2tapgen2deemph3p5,
305 new->Usb3Lane0Ow2tapgen2deemph3p5);
Lee Leahy66208bd2015-10-15 16:17:58 -0700306 fsp_display_upd_value("Usb3Lane1Ow2tapgen2deemph3p5", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700307 old->Usb3Lane1Ow2tapgen2deemph3p5,
308 new->Usb3Lane1Ow2tapgen2deemph3p5);
Lee Leahy66208bd2015-10-15 16:17:58 -0700309 fsp_display_upd_value("Usb3Lane2Ow2tapgen2deemph3p5", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700310 old->Usb3Lane2Ow2tapgen2deemph3p5,
311 new->Usb3Lane2Ow2tapgen2deemph3p5);
Lee Leahy66208bd2015-10-15 16:17:58 -0700312 fsp_display_upd_value("Usb3Lane3Ow2tapgen2deemph3p5", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700313 old->Usb3Lane3Ow2tapgen2deemph3p5,
314 new->Usb3Lane3Ow2tapgen2deemph3p5);
Lee Leahy66208bd2015-10-15 16:17:58 -0700315 fsp_display_upd_value("PcdSataInterfaceSpeed", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700316 old->PcdSataInterfaceSpeed,
317 new->PcdSataInterfaceSpeed);
Lee Leahy66208bd2015-10-15 16:17:58 -0700318 fsp_display_upd_value("PcdPchUsbSsicPort", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700319 old->PcdPchUsbSsicPort, new->PcdPchUsbSsicPort);
Lee Leahy66208bd2015-10-15 16:17:58 -0700320 fsp_display_upd_value("PcdPchUsbHsicPort", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700321 old->PcdPchUsbHsicPort, new->PcdPchUsbHsicPort);
Lee Leahy66208bd2015-10-15 16:17:58 -0700322 fsp_display_upd_value("PcdPcieRootPortSpeed", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700323 old->PcdPcieRootPortSpeed, new->PcdPcieRootPortSpeed);
Lee Leahy66208bd2015-10-15 16:17:58 -0700324 fsp_display_upd_value("PcdPchSsicEnable", 1, old->PcdPchSsicEnable,
Lee Leahy32471722015-04-20 15:20:28 -0700325 new->PcdPchSsicEnable);
Lee Leahy66208bd2015-10-15 16:17:58 -0700326 fsp_display_upd_value("PcdLogoPtr", 4, old->PcdLogoPtr,
Lee Leahy32471722015-04-20 15:20:28 -0700327 new->PcdLogoPtr);
Lee Leahy66208bd2015-10-15 16:17:58 -0700328 fsp_display_upd_value("PcdLogoSize", 4, old->PcdLogoSize,
Lee Leahy32471722015-04-20 15:20:28 -0700329 new->PcdLogoSize);
Lee Leahy66208bd2015-10-15 16:17:58 -0700330 fsp_display_upd_value("PcdRtcLock", 1, old->PcdRtcLock,
Lee Leahy32471722015-04-20 15:20:28 -0700331 new->PcdRtcLock);
Lee Leahy66208bd2015-10-15 16:17:58 -0700332 fsp_display_upd_value("PMIC_I2CBus", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700333 old->PMIC_I2CBus, new->PMIC_I2CBus);
Lee Leahy66208bd2015-10-15 16:17:58 -0700334 fsp_display_upd_value("ISPEnable", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700335 old->ISPEnable, new->ISPEnable);
Lee Leahy66208bd2015-10-15 16:17:58 -0700336 fsp_display_upd_value("ISPPciDevConfig", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700337 old->ISPPciDevConfig, new->ISPPciDevConfig);
Divya Sasidharan89a66852015-10-28 15:02:35 -0700338 fsp_display_upd_value("PcdSdDetectChk", 1,
339 old->PcdSdDetectChk, new->PcdSdDetectChk);
Lee Leahy32471722015-04-20 15:20:28 -0700340}
341
Lee Leahy77ff0b12015-05-05 15:07:29 -0700342/* Called at BS_DEV_INIT_CHIPS time -- very early. Just after BS_PRE_DEVICE. */
343static void soc_init(void *chip_info)
344{
Lee Leahy32471722015-04-20 15:20:28 -0700345 printk(BIOS_SPEW, "%s/%s\n", __FILE__, __func__);
346 soc_init_pre_device(chip_info);
Lee Leahy77ff0b12015-05-05 15:07:29 -0700347}
348
Lee Leahy32471722015-04-20 15:20:28 -0700349struct chip_operations soc_intel_braswell_ops = {
350 CHIP_NAME("Intel Braswell SoC")
Lee Leahy77ff0b12015-05-05 15:07:29 -0700351 .enable_dev = enable_dev,
352 .init = soc_init,
353};
354
Lee Leahy1072e7d2017-03-16 17:35:32 -0700355static void pci_set_subsystem(device_t dev, unsigned int vendor,
356 unsigned int device)
Lee Leahy77ff0b12015-05-05 15:07:29 -0700357{
Lee Leahy32471722015-04-20 15:20:28 -0700358 printk(BIOS_SPEW, "%s/%s ( %s, 0x%04x, 0x%04x )\n",
359 __FILE__, __func__, dev_name(dev), vendor, device);
Lee Leahy77ff0b12015-05-05 15:07:29 -0700360 if (!vendor || !device) {
361 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
362 pci_read_config32(dev, PCI_VENDOR_ID));
363 } else {
364 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
365 ((device & 0xffff) << 16) | (vendor & 0xffff));
366 }
367}
368
369struct pci_operations soc_pci_ops = {
370 .set_subsystem = &pci_set_subsystem,
371};
Matt DeVillier143a8362017-08-26 04:47:15 -0500372
373/**
374 Return SoC stepping type
375
376 @retval SOC_STEPPING SoC stepping type
377**/
378int SocStepping(void)
379{
380 device_t dev = dev_find_slot(0, PCI_DEVFN(LPC_DEV, LPC_FUNC));
381 u8 revid = pci_read_config8(dev, 0x8);
382
383 switch (revid & B_PCH_LPC_RID_STEPPING_MASK) {
384 case V_PCH_LPC_RID_A0:
385 return SocA0;
386 case V_PCH_LPC_RID_A1:
387 return SocA1;
388 case V_PCH_LPC_RID_A2:
389 return SocA2;
390 case V_PCH_LPC_RID_A3:
391 return SocA3;
392 case V_PCH_LPC_RID_A4:
393 return SocA4;
394 case V_PCH_LPC_RID_A5:
395 return SocA5;
396 case V_PCH_LPC_RID_A6:
397 return SocA6;
398 case V_PCH_LPC_RID_A7:
399 return SocA7;
400 case V_PCH_LPC_RID_B0:
401 return SocB0;
402 case V_PCH_LPC_RID_B1:
403 return SocB1;
404 case V_PCH_LPC_RID_B2:
405 return SocB2;
406 case V_PCH_LPC_RID_B3:
407 return SocB3;
408 case V_PCH_LPC_RID_B4:
409 return SocB4;
410 case V_PCH_LPC_RID_B5:
411 return SocB5;
412 case V_PCH_LPC_RID_B6:
413 return SocB6;
414 case V_PCH_LPC_RID_B7:
415 return SocB7;
416 case V_PCH_LPC_RID_C0:
417 return SocC0;
418 case V_PCH_LPC_RID_C1:
419 return SocC1;
420 case V_PCH_LPC_RID_C2:
421 return SocC2;
422 case V_PCH_LPC_RID_C3:
423 return SocC3;
424 case V_PCH_LPC_RID_C4:
425 return SocC4;
426 case V_PCH_LPC_RID_C5:
427 return SocC5;
428 case V_PCH_LPC_RID_C6:
429 return SocC6;
430 case V_PCH_LPC_RID_C7:
431 return SocC7;
432 case V_PCH_LPC_RID_D0:
433 return SocD0;
434 case V_PCH_LPC_RID_D1:
435 return SocD1;
436 case V_PCH_LPC_RID_D2:
437 return SocD2;
438 case V_PCH_LPC_RID_D3:
439 return SocD3;
440 case V_PCH_LPC_RID_D4:
441 return SocD4;
442 case V_PCH_LPC_RID_D5:
443 return SocD5;
444 case V_PCH_LPC_RID_D6:
445 return SocD6;
446 case V_PCH_LPC_RID_D7:
447 return SocD7;
448 default:
449 return SocSteppingMax;
450 }
451}