Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2013-2014 Sage Electronic Engineering, LLC. |
York Yang | f226a4d | 2015-07-07 11:09:02 -0700 | [diff] [blame] | 5 | * Copyright (C) 2014-2015 Intel Corporation |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 6 | * |
| 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. |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <types.h> |
| 18 | #include <string.h> |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 19 | #include <console/console.h> |
| 20 | #include <bootstate.h> |
| 21 | #include <cbmem.h> |
| 22 | #include <device/device.h> |
| 23 | #include <device/pci_def.h> |
Ben Gardner | fa6014a | 2015-12-08 21:20:25 -0600 | [diff] [blame] | 24 | #include <soc/pci_devs.h> |
Marc Jones | 7868797 | 2015-04-22 23:16:31 -0600 | [diff] [blame] | 25 | #include <drivers/intel/fsp1_0/fsp_util.h> |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 26 | #include "../chip.h" |
Mohan D'Costa | ed0c838 | 2014-09-18 15:57:06 +0900 | [diff] [blame] | 27 | #include <arch/io.h> |
Ben Gardner | fa6014a | 2015-12-08 21:20:25 -0600 | [diff] [blame] | 28 | #include <soc/reset.h> |
| 29 | #include <soc/pmc.h> |
| 30 | #include <soc/acpi.h> |
| 31 | #include <soc/iomap.h> |
| 32 | #include <soc/smm.h> |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 33 | |
| 34 | #ifdef __PRE_RAM__ |
Ben Gardner | fa6014a | 2015-12-08 21:20:25 -0600 | [diff] [blame] | 35 | #include <soc/romstage.h> |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 36 | #endif |
| 37 | |
| 38 | #ifdef __PRE_RAM__ |
| 39 | |
| 40 | /* Copy the default UPD region and settings to a buffer for modification */ |
| 41 | static void GetUpdDefaultFromFsp (FSP_INFO_HEADER *FspInfo, UPD_DATA_REGION *UpdData) |
| 42 | { |
| 43 | VPD_DATA_REGION *VpdDataRgnPtr; |
| 44 | UPD_DATA_REGION *UpdDataRgnPtr; |
| 45 | VpdDataRgnPtr = (VPD_DATA_REGION *)(UINT32)(FspInfo->CfgRegionOffset + FspInfo->ImageBase); |
| 46 | UpdDataRgnPtr = (UPD_DATA_REGION *)(UINT32)(VpdDataRgnPtr->PcdUpdRegionOffset + FspInfo->ImageBase); |
| 47 | memcpy((void*)UpdData, (void*)UpdDataRgnPtr, sizeof(UPD_DATA_REGION)); |
| 48 | } |
| 49 | |
| 50 | /* default to just enabling HDMI audio */ |
| 51 | const PCH_AZALIA_CONFIG mAzaliaConfig = { |
| 52 | .Pme = 1, |
| 53 | .DS = 1, |
| 54 | .DA = 0, |
| 55 | .HdmiCodec = 1, |
| 56 | .AzaliaVCi = 1, |
| 57 | .Rsvdbits = 0, |
| 58 | .AzaliaVerbTableNum = 0, |
| 59 | .AzaliaVerbTable = NULL, |
| 60 | .ResetWaitTimer = 300 |
| 61 | }; |
| 62 | |
| 63 | typedef struct soc_intel_fsp_baytrail_config config_t; |
| 64 | |
Martin Roth | 12d86e7 | 2014-11-16 20:53:14 -0700 | [diff] [blame] | 65 | static const char *acpi_pci_mode_strings[] = { |
| 66 | "Disabled", |
| 67 | "Enabled in PCI Mode", |
| 68 | "Enabled in ACPI Mode" |
| 69 | }; |
| 70 | |
| 71 | static const char *emmc_mode_strings[] = { |
| 72 | "Disabled", |
| 73 | "Auto", |
| 74 | "eMMC 4.1", |
| 75 | "eMMC 4.5" |
| 76 | }; |
| 77 | |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 78 | /** |
| 79 | * Update the UPD data based on values from devicetree.cb |
| 80 | * |
| 81 | * @param UpdData Pointer to the UPD Data structure |
| 82 | */ |
York Yang | fc1c1b5 | 2014-11-04 17:04:37 -0700 | [diff] [blame] | 83 | static void ConfigureDefaultUpdData(FSP_INFO_HEADER *FspInfo, UPD_DATA_REGION *UpdData) |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 84 | { |
| 85 | ROMSTAGE_CONST struct device *dev; |
| 86 | ROMSTAGE_CONST config_t *config; |
Martin Roth | bdfe98f | 2014-11-18 19:52:46 -0700 | [diff] [blame] | 87 | printk(FSP_INFO_LEVEL, "Configure Default UPD Data\n"); |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 88 | |
| 89 | dev = dev_find_slot(0, SOC_DEV_FUNC); |
| 90 | config = dev->chip_info; |
| 91 | |
| 92 | /* Set up default verb tables - Just HDMI audio */ |
| 93 | UpdData->AzaliaConfigPtr = (UINT32)&mAzaliaConfig; |
| 94 | |
| 95 | /* Set SPD addresses */ |
Martin Roth | 8d936ce | 2014-11-16 20:07:16 -0700 | [diff] [blame] | 96 | UPD_SPD_CHECK(PcdMrcInitSPDAddr1); |
| 97 | UPD_SPD_CHECK(PcdMrcInitSPDAddr2); |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 98 | |
Martin Roth | e8d1901 | 2014-11-16 20:06:23 -0700 | [diff] [blame] | 99 | UPD_DEFAULT_CHECK(PcdSataMode); |
| 100 | UPD_DEFAULT_CHECK(PcdLpssSioEnablePciMode); |
| 101 | UPD_DEFAULT_CHECK(PcdMrcInitMmioSize); |
| 102 | UPD_DEFAULT_CHECK(PcdIgdDvmt50PreAlloc); |
| 103 | UPD_DEFAULT_CHECK(PcdApertureSize); |
| 104 | UPD_DEFAULT_CHECK(PcdGttSize); |
| 105 | UPD_DEFAULT_CHECK(SerialDebugPortAddress); |
| 106 | UPD_DEFAULT_CHECK(SerialDebugPortType); |
| 107 | UPD_DEFAULT_CHECK(PcdMrcDebugMsg); |
| 108 | UPD_DEFAULT_CHECK(PcdSccEnablePciMode); |
| 109 | UPD_DEFAULT_CHECK(IgdRenderStandby); |
| 110 | UPD_DEFAULT_CHECK(TxeUmaEnable); |
York Yang | f226a4d | 2015-07-07 11:09:02 -0700 | [diff] [blame] | 111 | UPD_DEFAULT_CHECK(PcdOsSelection); |
| 112 | UPD_DEFAULT_CHECK(PcdEMMC45DDR50Enabled); |
| 113 | UPD_DEFAULT_CHECK(PcdEMMC45HS200Enabled); |
| 114 | UPD_DEFAULT_CHECK(PcdEMMC45RetuneTimerValue); |
| 115 | UPD_DEFAULT_CHECK(PcdEnableIgd); |
Ben Gardner | 3968653 | 2016-01-14 17:15:37 -0600 | [diff] [blame] | 116 | UPD_DEFAULT_CHECK(AutoSelfRefreshEnable); |
| 117 | UPD_DEFAULT_CHECK(APTaskTimeoutCnt); |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 118 | |
Martin Roth | e55a7c5 | 2014-11-16 17:09:15 -0700 | [diff] [blame] | 119 | if ((config->PcdeMMCBootMode != EMMC_USE_DEFAULT) || |
| 120 | (config->PcdeMMCBootMode != EMMC_FOLLOWS_DEVICETREE)) |
| 121 | UpdData->PcdeMMCBootMode = config->PcdeMMCBootMode; |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 122 | |
Martin Roth | 30eda3e | 2014-11-16 20:28:57 -0700 | [diff] [blame] | 123 | UpdData->PcdMrcInitTsegSize = smm_region_size() >> 20; |
Martin Roth | e8d1901 | 2014-11-16 20:06:23 -0700 | [diff] [blame] | 124 | |
Martin Roth | bdfe98f | 2014-11-18 19:52:46 -0700 | [diff] [blame] | 125 | printk(FSP_INFO_LEVEL, "GTT Size:\t\t%d MB\n", UpdData->PcdGttSize); |
| 126 | printk(FSP_INFO_LEVEL, "Tseg Size:\t\t%d MB\n", UpdData->PcdMrcInitTsegSize); |
| 127 | printk(FSP_INFO_LEVEL, "Aperture Size:\t\t%d MB\n", |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 128 | APERTURE_SIZE_BASE << UpdData->PcdApertureSize); |
Martin Roth | bdfe98f | 2014-11-18 19:52:46 -0700 | [diff] [blame] | 129 | printk(FSP_INFO_LEVEL, "IGD Memory Size:\t%d MB\n", |
Martin Roth | e8d1901 | 2014-11-16 20:06:23 -0700 | [diff] [blame] | 130 | UpdData->PcdIgdDvmt50PreAlloc * IGD_MEMSIZE_MULTIPLIER); |
Martin Roth | bdfe98f | 2014-11-18 19:52:46 -0700 | [diff] [blame] | 131 | printk(FSP_INFO_LEVEL, "MMIO Size:\t\t%d MB\n", UpdData->PcdMrcInitMmioSize); |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 132 | |
| 133 | /* Advance dev to PCI device 0.0 */ |
| 134 | for (dev = &dev_root; dev; dev = dev_find_next_pci_device(dev)){ |
| 135 | if (dev->path.type != DEVICE_PATH_PCI) |
| 136 | continue; |
| 137 | if (dev->path.pci.devfn == PCI_DEVFN(0x0,0)) |
| 138 | break; |
| 139 | } |
| 140 | |
| 141 | /* |
| 142 | * Loop through all the SOC devices in the devicetree |
| 143 | * enabling and disabling them as requested. |
| 144 | */ |
| 145 | for (; dev; dev = dev->sibling) { |
| 146 | |
| 147 | if (dev->path.type != DEVICE_PATH_PCI) |
| 148 | continue; |
| 149 | |
| 150 | switch (dev->path.pci.devfn) { |
Martin Roth | 12d86e7 | 2014-11-16 20:53:14 -0700 | [diff] [blame] | 151 | UPD_DEVICE_CHECK(SDIO_DEV_FUNC, PcdEnableSdio, "Sdio:\t\t\t"); |
| 152 | UPD_DEVICE_CHECK(SD_DEV_FUNC, PcdEnableSdcard, "Sdcard:\t\t\t"); |
| 153 | UPD_DEVICE_CHECK(SIO_DMA1_DEV_FUNC, PcdEnableDma0, "SIO Dma 0:\t\t"); |
| 154 | UPD_DEVICE_CHECK(I2C1_DEV_FUNC, PcdEnableI2C0, "SIO I2C0:\t\t"); |
| 155 | UPD_DEVICE_CHECK(I2C2_DEV_FUNC, PcdEnableI2C1, "SIO I2C1:\t\t"); |
| 156 | UPD_DEVICE_CHECK(I2C3_DEV_FUNC, PcdEnableI2C2, "SIO I2C2:\t\t"); |
| 157 | UPD_DEVICE_CHECK(I2C4_DEV_FUNC, PcdEnableI2C3, "SIO I2C3:\t\t"); |
| 158 | UPD_DEVICE_CHECK(I2C5_DEV_FUNC, PcdEnableI2C4, "SIO I2C4:\t\t"); |
| 159 | UPD_DEVICE_CHECK(I2C6_DEV_FUNC, PcdEnableI2C5, "SIO I2C5:\t\t"); |
| 160 | UPD_DEVICE_CHECK(I2C7_DEV_FUNC, PcdEnableI2C6, "SIO I2C6:\t\t"); |
| 161 | UPD_DEVICE_CHECK(SIO_DMA2_DEV_FUNC, PcdEnableDma1, "SIO Dma1:\t\t"); |
| 162 | UPD_DEVICE_CHECK(PWM1_DEV_FUNC, PcdEnablePwm0, "Pwm0:\t\t\t"); |
| 163 | UPD_DEVICE_CHECK(PWM2_DEV_FUNC, PcdEnablePwm1, "Pwm1:\t\t\t"); |
| 164 | UPD_DEVICE_CHECK(HSUART1_DEV_FUNC, PcdEnableHsuart0, "Hsuart0:\t\t"); |
| 165 | UPD_DEVICE_CHECK(HSUART2_DEV_FUNC, PcdEnableHsuart1, "Hsuart1:\t\t"); |
| 166 | UPD_DEVICE_CHECK(SPI_DEV_FUNC, PcdEnableSpi, "Spi:\t\t\t"); |
| 167 | UPD_DEVICE_CHECK(SATA_DEV_FUNC, PcdEnableSata, "SATA:\t\t\t"); |
| 168 | UPD_DEVICE_CHECK(HDA_DEV_FUNC, PcdEnableAzalia, "Azalia:\t\t\t"); |
| 169 | |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 170 | case MIPI_DEV_FUNC: /* Camera / Image Signal Processing */ |
York Yang | fc1c1b5 | 2014-11-04 17:04:37 -0700 | [diff] [blame] | 171 | if (FspInfo->ImageRevision >= FSP_GOLD3_REV_ID) { |
| 172 | UpdData->ISPEnable = dev->enabled; |
| 173 | } else { |
David Imhoff | 6b0933a | 2015-05-06 21:42:37 +0200 | [diff] [blame] | 174 | /* Gold2 and earlier FSP: ISPEnable is the field */ |
York Yang | fc1c1b5 | 2014-11-04 17:04:37 -0700 | [diff] [blame] | 175 | /* next to PcdGttSize in UPD_DATA_REGION struct */ |
| 176 | *(&(UpdData->PcdGttSize)+sizeof(UINT8)) = dev->enabled; |
Martin Roth | bdfe98f | 2014-11-18 19:52:46 -0700 | [diff] [blame] | 177 | printk (FSP_INFO_LEVEL, |
York Yang | fc1c1b5 | 2014-11-04 17:04:37 -0700 | [diff] [blame] | 178 | "Baytrail Gold2 or earlier FSP, adjust ISPEnable offset.\n"); |
| 179 | } |
Martin Roth | bdfe98f | 2014-11-18 19:52:46 -0700 | [diff] [blame] | 180 | printk(FSP_INFO_LEVEL, "MIPI/ISP:\t\t%s\n", |
David Imhoff | 6b0933a | 2015-05-06 21:42:37 +0200 | [diff] [blame] | 181 | dev->enabled?"Enabled":"Disabled"); |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 182 | break; |
| 183 | case EMMC_DEV_FUNC: /* EMMC 4.1*/ |
| 184 | if ((dev->enabled) && |
Martin Roth | e55a7c5 | 2014-11-16 17:09:15 -0700 | [diff] [blame] | 185 | (config->PcdeMMCBootMode == EMMC_FOLLOWS_DEVICETREE)) |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 186 | UpdData->PcdeMMCBootMode = EMMC_4_1 - EMMC_DISABLED; |
| 187 | break; |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 188 | case MMC45_DEV_FUNC: /* MMC 4.5*/ |
| 189 | if ((dev->enabled) && |
Martin Roth | e55a7c5 | 2014-11-16 17:09:15 -0700 | [diff] [blame] | 190 | (config->PcdeMMCBootMode == EMMC_FOLLOWS_DEVICETREE)) |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 191 | UpdData->PcdeMMCBootMode = EMMC_4_5 - EMMC_DISABLED; |
| 192 | break; |
Martin Roth | 12d86e7 | 2014-11-16 20:53:14 -0700 | [diff] [blame] | 193 | case XHCI_DEV_FUNC: |
| 194 | UpdData->PcdEnableXhci = dev->enabled; |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 195 | break; |
| 196 | case EHCI_DEV_FUNC: |
| 197 | UpdData->PcdEnableXhci = !(dev->enabled); |
| 198 | break; |
Martin Roth | 12d86e7 | 2014-11-16 20:53:14 -0700 | [diff] [blame] | 199 | |
| 200 | case LPE_DEV_FUNC: |
| 201 | if (dev->enabled) |
| 202 | UpdData->PcdEnableLpe = config->LpeAcpiModeEnable; |
| 203 | else |
| 204 | UpdData->PcdEnableLpe = 0; |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 205 | break; |
| 206 | } |
| 207 | } |
| 208 | |
Martin Roth | 12d86e7 | 2014-11-16 20:53:14 -0700 | [diff] [blame] | 209 | if (UpdData->PcdEnableLpe < sizeof(acpi_pci_mode_strings) / sizeof (char *)) |
Martin Roth | bdfe98f | 2014-11-18 19:52:46 -0700 | [diff] [blame] | 210 | printk(FSP_INFO_LEVEL, "Lpe:\t\t\t%s\n", |
Martin Roth | 12d86e7 | 2014-11-16 20:53:14 -0700 | [diff] [blame] | 211 | acpi_pci_mode_strings[UpdData->PcdEnableLpe]); |
| 212 | |
| 213 | if (UpdData->PcdeMMCBootMode < sizeof(emmc_mode_strings) / sizeof (char *)) |
Ben Gardner | d347f6c | 2015-12-02 12:42:28 -0600 | [diff] [blame] | 214 | printk(FSP_INFO_LEVEL, "eMMC Mode:\t\t%s\n", |
Martin Roth | 12d86e7 | 2014-11-16 20:53:14 -0700 | [diff] [blame] | 215 | emmc_mode_strings[UpdData->PcdeMMCBootMode]); |
| 216 | |
| 217 | if (UpdData->PcdEnableSata) |
Martin Roth | bdfe98f | 2014-11-18 19:52:46 -0700 | [diff] [blame] | 218 | printk(FSP_INFO_LEVEL, "SATA Mode:\t\t%s\n", |
Martin Roth | 12d86e7 | 2014-11-16 20:53:14 -0700 | [diff] [blame] | 219 | UpdData->PcdSataMode?"AHCI":"IDE"); |
| 220 | |
Martin Roth | bdfe98f | 2014-11-18 19:52:46 -0700 | [diff] [blame] | 221 | printk(FSP_INFO_LEVEL, "Xhci:\t\t\t%s\n", |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 222 | UpdData->PcdEnableXhci?"Enabled":"Disabled"); |
| 223 | |
Martin Roth | 5c8e7a4 | 2014-12-02 10:49:21 -0700 | [diff] [blame] | 224 | /* |
| 225 | * set memory down parameters |
| 226 | * Skip setting values if memory down is disabled |
| 227 | * Skip setting values if FSP is earlier than gold 3 |
| 228 | */ |
| 229 | if (FspInfo->ImageRevision >= FSP_GOLD3_REV_ID) { |
| 230 | UPD_MEMDOWN_CHECK(EnableMemoryDown, DECREMENT_FOR_DEFAULT); |
| 231 | if (UpdData->PcdMemoryParameters.EnableMemoryDown) { |
| 232 | UPD_MEMDOWN_CHECK(DRAMSpeed, DECREMENT_FOR_DEFAULT); |
| 233 | UPD_MEMDOWN_CHECK(DRAMType, DECREMENT_FOR_DEFAULT); |
| 234 | UPD_MEMDOWN_CHECK(DIMM0Enable, DECREMENT_FOR_DEFAULT); |
| 235 | UPD_MEMDOWN_CHECK(DIMM1Enable, DECREMENT_FOR_DEFAULT); |
| 236 | UPD_MEMDOWN_CHECK(DIMMDWidth, DECREMENT_FOR_DEFAULT); |
| 237 | UPD_MEMDOWN_CHECK(DIMMDensity, DECREMENT_FOR_DEFAULT); |
| 238 | UPD_MEMDOWN_CHECK(DIMMBusWidth, DECREMENT_FOR_DEFAULT); |
| 239 | UPD_MEMDOWN_CHECK(DIMMSides, DECREMENT_FOR_DEFAULT); |
| 240 | UPD_MEMDOWN_CHECK(DIMMtCL, NO_DECREMENT_FOR_DEFAULT); |
| 241 | UPD_MEMDOWN_CHECK(DIMMtRPtRCD, NO_DECREMENT_FOR_DEFAULT); |
| 242 | UPD_MEMDOWN_CHECK(DIMMtWR, NO_DECREMENT_FOR_DEFAULT); |
| 243 | UPD_MEMDOWN_CHECK(DIMMtWTR, NO_DECREMENT_FOR_DEFAULT); |
| 244 | UPD_MEMDOWN_CHECK(DIMMtRRD, NO_DECREMENT_FOR_DEFAULT); |
| 245 | UPD_MEMDOWN_CHECK(DIMMtRTP, NO_DECREMENT_FOR_DEFAULT); |
| 246 | UPD_MEMDOWN_CHECK(DIMMtFAW, NO_DECREMENT_FOR_DEFAULT); |
York Yang | fc1c1b5 | 2014-11-04 17:04:37 -0700 | [diff] [blame] | 247 | |
Martin Roth | bdfe98f | 2014-11-18 19:52:46 -0700 | [diff] [blame] | 248 | printk (FSP_INFO_LEVEL, |
Martin Roth | 5c8e7a4 | 2014-12-02 10:49:21 -0700 | [diff] [blame] | 249 | "Memory Down Data Existed : %s\n"\ |
| 250 | "- Speed (0: 800, 1: 1066, 2: 1333, 3: 1600): %d\n"\ |
| 251 | "- Type (0: DDR3, 1: DDR3L) : %d\n"\ |
| 252 | "- DIMM0 : %s\n"\ |
| 253 | "- DIMM1 : %s\n"\ |
| 254 | "- Width : x%d\n"\ |
| 255 | "- Density : %dGbit\n" |
| 256 | "- BudWidth : %dbit\n"\ |
| 257 | "- Rank # : %d\n"\ |
| 258 | "- tCL : %02X\n"\ |
| 259 | "- tRPtRCD : %02X\n"\ |
| 260 | "- tWR : %02X\n"\ |
| 261 | "- tWTR : %02X\n"\ |
| 262 | "- tRRD : %02X\n"\ |
| 263 | "- tRTP : %02X\n"\ |
| 264 | "- tFAW : %02X\n" |
| 265 | , (UpdData->PcdMemoryParameters.EnableMemoryDown) ? "Enabled" : "Disabled" |
| 266 | , UpdData->PcdMemoryParameters.DRAMSpeed |
| 267 | , UpdData->PcdMemoryParameters.DRAMType |
| 268 | , (UpdData->PcdMemoryParameters.DIMM0Enable) ? "Enabled" : "Disabled" |
| 269 | , (UpdData->PcdMemoryParameters.DIMM1Enable) ? "Enabled" : "Disabled" |
| 270 | , 8 << (UpdData->PcdMemoryParameters.DIMMDWidth) |
| 271 | , 1 << (UpdData->PcdMemoryParameters.DIMMDensity) |
| 272 | , 8 << (UpdData->PcdMemoryParameters.DIMMBusWidth) |
| 273 | , (UpdData->PcdMemoryParameters.DIMMSides) + 1 |
| 274 | , UpdData->PcdMemoryParameters.DIMMtCL |
| 275 | , UpdData->PcdMemoryParameters.DIMMtRPtRCD |
| 276 | , UpdData->PcdMemoryParameters.DIMMtWR |
| 277 | , UpdData->PcdMemoryParameters.DIMMtWTR |
| 278 | , UpdData->PcdMemoryParameters.DIMMtRRD |
| 279 | , UpdData->PcdMemoryParameters.DIMMtRTP |
| 280 | , UpdData->PcdMemoryParameters.DIMMtFAW |
York Yang | fc1c1b5 | 2014-11-04 17:04:37 -0700 | [diff] [blame] | 281 | ); |
Martin Roth | 5c8e7a4 | 2014-12-02 10:49:21 -0700 | [diff] [blame] | 282 | } |
York Yang | fc1c1b5 | 2014-11-04 17:04:37 -0700 | [diff] [blame] | 283 | } |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 284 | } |
| 285 | |
| 286 | /* Set up the Baytrail specific structures for the call into the FSP */ |
| 287 | void chipset_fsp_early_init(FSP_INIT_PARAMS *pFspInitParams, |
| 288 | FSP_INFO_HEADER *fsp_ptr) |
| 289 | { |
| 290 | FSP_INIT_RT_BUFFER *pFspRtBuffer = pFspInitParams->RtBufferPtr; |
Mohan D'Costa | ed0c838 | 2014-09-18 15:57:06 +0900 | [diff] [blame] | 291 | uint32_t prev_sleep_state; |
| 292 | |
| 293 | /* Get previous sleep state but don't clear */ |
| 294 | prev_sleep_state = chipset_prev_sleep_state(0); |
| 295 | printk(BIOS_INFO, "prev_sleep_state = S%d\n", prev_sleep_state); |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 296 | |
| 297 | /* Initialize the UPD Data */ |
| 298 | GetUpdDefaultFromFsp (fsp_ptr, pFspRtBuffer->Common.UpdDataRgnPtr); |
York Yang | fc1c1b5 | 2014-11-04 17:04:37 -0700 | [diff] [blame] | 299 | ConfigureDefaultUpdData(fsp_ptr, pFspRtBuffer->Common.UpdDataRgnPtr); |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 300 | pFspInitParams->NvsBufferPtr = NULL; |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 301 | |
Mohan D'Costa | ed0c838 | 2014-09-18 15:57:06 +0900 | [diff] [blame] | 302 | #if IS_ENABLED(CONFIG_ENABLE_MRC_CACHE) |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 303 | /* Find the fastboot cache that was saved in the ROM */ |
| 304 | pFspInitParams->NvsBufferPtr = find_and_set_fastboot_cache(); |
| 305 | #endif |
| 306 | |
Aaron Durbin | 15e439a | 2016-07-13 23:22:01 -0500 | [diff] [blame^] | 307 | if (prev_sleep_state == ACPI_S3) { |
Mohan D'Costa | ed0c838 | 2014-09-18 15:57:06 +0900 | [diff] [blame] | 308 | /* S3 resume */ |
| 309 | if ( pFspInitParams->NvsBufferPtr == NULL) { |
| 310 | /* If waking from S3 and no cache then. */ |
| 311 | printk(BIOS_WARNING, "No MRC cache found in S3 resume path.\n"); |
| 312 | post_code(POST_RESUME_FAILURE); |
| 313 | /* Clear Sleep Type */ |
| 314 | outl(inl(ACPI_BASE_ADDRESS + PM1_CNT) & |
| 315 | ~(SLP_TYP), ACPI_BASE_ADDRESS + PM1_CNT); |
| 316 | /* Reboot */ |
| 317 | printk(BIOS_WARNING,"Rebooting..\n" ); |
| 318 | warm_reset(); |
| 319 | /* Should not reach here.. */ |
| 320 | die("Reboot System\n"); |
| 321 | } |
| 322 | pFspRtBuffer->Common.BootMode = BOOT_ON_S3_RESUME; |
| 323 | } else { |
| 324 | /* Not S3 resume */ |
| 325 | pFspRtBuffer->Common.BootMode = BOOT_WITH_FULL_CONFIGURATION; |
| 326 | } |
| 327 | |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 328 | return; |
| 329 | } |
| 330 | |
| 331 | /* The FSP returns here after the fsp_early_init call */ |
| 332 | void ChipsetFspReturnPoint(EFI_STATUS Status, |
| 333 | VOID *HobListPtr) |
| 334 | { |
Martin Roth | 582b2ae | 2015-01-11 14:29:29 -0700 | [diff] [blame] | 335 | *(void **)CBMEM_FSP_HOB_PTR=HobListPtr; |
| 336 | |
Martin Roth | 433659a | 2014-05-12 21:55:00 -0600 | [diff] [blame] | 337 | if (Status == 0xFFFFFFFF) { |
| 338 | warm_reset(); |
| 339 | } |
| 340 | romstage_main_continue(Status, HobListPtr); |
| 341 | } |
| 342 | |
| 343 | #endif /* __PRE_RAM__ */ |