Siyuan Wang | affe85f | 2013-07-25 15:14:15 +0800 | [diff] [blame] | 1 | /* $NoKeywords:$ */ |
| 2 | /** |
| 3 | * @file |
| 4 | * |
| 5 | * Config Fch HwAcpi controller |
| 6 | * |
| 7 | * Init HwAcpi Controller features. |
| 8 | * |
| 9 | * @xrefitem bom "File Content Label" "Release Content" |
| 10 | * @e project: AGESA |
| 11 | * @e sub-project: FCH |
| 12 | * @e \$Revision: 87262 $ @e \$Date: 2013-01-31 09:13:43 -0600 (Thu, 31 Jan 2013) $ |
| 13 | * |
| 14 | */ |
| 15 | /* |
| 16 | ***************************************************************************** |
| 17 | * |
| 18 | * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. |
| 19 | * All rights reserved. |
| 20 | * |
| 21 | * Redistribution and use in source and binary forms, with or without |
| 22 | * modification, are permitted provided that the following conditions are met: |
| 23 | * * Redistributions of source code must retain the above copyright |
| 24 | * notice, this list of conditions and the following disclaimer. |
| 25 | * * Redistributions in binary form must reproduce the above copyright |
| 26 | * notice, this list of conditions and the following disclaimer in the |
| 27 | * documentation and/or other materials provided with the distribution. |
| 28 | * * Neither the name of Advanced Micro Devices, Inc. nor the names of |
| 29 | * its contributors may be used to endorse or promote products derived |
| 30 | * from this software without specific prior written permission. |
| 31 | * |
| 32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 33 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 35 | * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY |
| 36 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 37 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 38 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 39 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 40 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 41 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 42 | **************************************************************************** |
| 43 | */ |
| 44 | #include "FchPlatform.h" |
| 45 | #include "amdlib.h" |
| 46 | #include "cpuServices.h" |
| 47 | #include "Filecode.h" |
| 48 | #define FILECODE PROC_FCH_HWACPI_FAMILY_YANGTZE_YANGTZEHWACPIENVSERVICE_FILECODE |
| 49 | |
| 50 | #define AMD_CPUID_APICID_LPC_BID 0x00000001ul // Local APIC ID, Logical Processor Count, Brand ID |
| 51 | |
| 52 | ACPI_REG_WRITE FchYangtzeInitEnvSpecificHwAcpiMmioTable[] = |
| 53 | { |
| 54 | {00, 00, 0xB0, 0xAC}, |
| 55 | {PMIO_BASE >> 8, FCH_PMIOA_REG28, (UINT8)~(BIT0 + BIT2), BIT0}, // Set ASF SMBUS master function enabled here (temporary) |
| 56 | #ifdef ACPI_SLEEP_TRAP |
| 57 | {SMI_BASE >> 8, FCH_SMI_REGB0, (UINT8)~(BIT2 + BIT3), BIT2}, // Set SLP_TYPE as SMI event |
| 58 | {PMIO_BASE >> 8, FCH_PMIOA_REGBE, (UINT8)~BIT5, 0x00}, // Disabled SLP function for S1/S3/S4/S5 |
| 59 | {PMIO_BASE >> 8, 0x08 + 3, (UINT8)~(BIT0 + BIT1), BIT1}, // Set S state transition disabled (BIT0) force ACPI to |
| 60 | // send SMI message when writing to SLP_TYP Acpi register. (BIT1) |
| 61 | {SMI_BASE >> 8, FCH_SMI_REG98 + 3, (UINT8)~BIT7, 0x00}, // Enabled Global Smi ( BIT7 clear as 0 to enable ) |
| 62 | #endif |
| 63 | {PMIO_BASE >> 8, 0x80 + 1, (UINT8)~(BIT3 + BIT4), BIT3 + BIT4}, |
| 64 | {0xFF, 0xFF, 0xFF, 0xFF}, |
| 65 | }; |
| 66 | |
| 67 | |
| 68 | /** |
| 69 | * FchInitEnvHwAcpiMmioTable - Fch ACPI MMIO initial |
| 70 | * during POST. |
| 71 | * |
| 72 | */ |
| 73 | ACPI_REG_WRITE FchYangtzeInitEnvHwAcpiMmioTable[] = |
| 74 | { |
| 75 | {00, 00, 0xB0, 0xAC}, /// Signature |
| 76 | |
| 77 | // |
| 78 | // HPET workaround |
| 79 | // |
WANG Siyuan | 7b6d412 | 2013-07-31 16:55:26 +0800 | [diff] [blame] | 80 | {PMIO_BASE >> 8, FCH_PMIOA_REG54 + 2, 0x7F, BIT7}, |
| 81 | {PMIO_BASE >> 8, FCH_PMIOA_REG54 + 2, 0x7F, 0x00}, |
Siyuan Wang | affe85f | 2013-07-25 15:14:15 +0800 | [diff] [blame] | 82 | {PMIO_BASE >> 8, FCH_PMIOA_REGC4, (UINT8)~BIT2, BIT2}, |
| 83 | {PMIO_BASE >> 8, FCH_PMIOA_REGC0, 0, 0x3D}, |
| 84 | {PMIO_BASE >> 8, FCH_PMIOA_REGC0 + 1, 0x0, 0x04}, |
| 85 | {PMIO_BASE >> 8, FCH_PMIOA_REGC2, 0x20, 0x58}, |
| 86 | {PMIO_BASE >> 8, FCH_PMIOA_REGC2 + 1, 0, 0x40}, |
| 87 | {PMIO_BASE >> 8, FCH_PMIOA_REGC2, (UINT8)~(BIT4), BIT4}, |
WANG Siyuan | 7b6d412 | 2013-07-31 16:55:26 +0800 | [diff] [blame] | 88 | {PMIO_BASE >> 8, FCH_PMIOA_REGCC, 0xF8, 0x03}, |
Siyuan Wang | affe85f | 2013-07-25 15:14:15 +0800 | [diff] [blame] | 89 | {PMIO_BASE >> 8, FCH_PMIOA_REG74, 0x00, BIT0 + BIT1 + BIT2 + BIT4}, |
| 90 | {PMIO_BASE >> 8, 0x74 + 3, (UINT8)~BIT5, 0}, |
| 91 | {PMIO_BASE >> 8, FCH_PMIOA_REGBA, (UINT8)~BIT3, BIT3}, |
Siyuan Wang | affe85f | 2013-07-25 15:14:15 +0800 | [diff] [blame] | 92 | {PMIO_BASE >> 8, FCH_PMIOA_REGBC, (UINT8)~BIT1, BIT1}, |
Siyuan Wang | affe85f | 2013-07-25 15:14:15 +0800 | [diff] [blame] | 93 | {PMIO_BASE >> 8, 0xDC, 0x7C, BIT1}, |
| 94 | |
| 95 | {SMI_BASE >> 8, FCH_SMI_Gevent1, 0, 1}, |
| 96 | {SMI_BASE >> 8, FCH_SMI_Gevent3, 0, 3}, |
| 97 | {SMI_BASE >> 8, FCH_SMI_Gevent4, 0, 4}, |
| 98 | {SMI_BASE >> 8, FCH_SMI_Gevent5, 0, 5}, |
| 99 | {SMI_BASE >> 8, FCH_SMI_Gevent6, 0, 6}, |
| 100 | {SMI_BASE >> 8, FCH_SMI_Gevent23, 0, 23}, |
| 101 | {SMI_BASE >> 8, FCH_SMI_xHC0Pme, 0, 11}, |
| 102 | {SMI_BASE >> 8, FCH_SMI_xHC1Pme, 0, 11}, |
| 103 | {SMI_BASE >> 8, FCH_SMI_Usbwakup0, 0, 11}, |
| 104 | {SMI_BASE >> 8, FCH_SMI_Usbwakup1, 0, 11}, |
| 105 | {SMI_BASE >> 8, FCH_SMI_Usbwakup2, 0, 11}, |
| 106 | {SMI_BASE >> 8, FCH_SMI_Usbwakup3, 0, 11}, |
| 107 | {SMI_BASE >> 8, FCH_SMI_IMCGevent0, 0, 12}, |
| 108 | {SMI_BASE >> 8, FCH_SMI_FanThGevent, 0, 13}, |
| 109 | {SMI_BASE >> 8, FCH_SMI_SBGppPme0, 0, 15}, |
| 110 | {SMI_BASE >> 8, FCH_SMI_SBGppPme1, 0, 16}, |
| 111 | {SMI_BASE >> 8, FCH_SMI_SBGppPme2, 0, 17}, |
| 112 | {SMI_BASE >> 8, FCH_SMI_SBGppPme3, 0, 18}, |
| 113 | {SMI_BASE >> 8, FCH_SMI_GecPme, 0, 19}, |
| 114 | {SMI_BASE >> 8, FCH_SMI_CIRPme, 0, 28}, |
| 115 | {SMI_BASE >> 8, FCH_SMI_Gevent8, 0, 24}, |
| 116 | // {SMI_BASE >> 8, FCH_SMI_AzaliaPme, 0, 27}, |
| 117 | {SMI_BASE >> 8, FCH_SMI_SataGevent0, 0, 30}, |
| 118 | {SMI_BASE >> 8, FCH_SMI_SataGevent1, 0, 31}, |
| 119 | {SMI_BASE >> 8, FCH_SMI_REG08, 0xE7, 0}, |
| 120 | {SMI_BASE >> 8, FCH_SMI_REG0C + 2, (UINT8)~BIT3, BIT3}, |
| 121 | {SMI_BASE >> 8, FCH_SMI_TWARN, 0, 9}, |
| 122 | {0xFF, 0xFF, 0xFF, 0xFF}, |
| 123 | }; |
| 124 | |
| 125 | /** |
| 126 | * FchYangtzeInitEnvHwAcpiPciTable - PCI device registers initial |
| 127 | * during early POST. |
| 128 | * |
| 129 | */ |
| 130 | REG8_MASK FchYangtzeInitEnvHwAcpiPciTable[] = |
| 131 | { |
| 132 | // |
| 133 | // SMBUS Device (Bus 0, Dev 20, Func 0) |
| 134 | // |
| 135 | {0x00, SMBUS_BUS_DEV_FUN, 0}, |
| 136 | {FCH_CFG_REG10, 0X00, (FCH_VERSION & 0xFF)}, ///Program the version information |
| 137 | {FCH_CFG_REG11, 0X00, (FCH_VERSION >> 8)}, |
| 138 | {0xFF, 0xFF, 0xFF}, |
| 139 | }; |
| 140 | |
| 141 | |
| 142 | /** |
| 143 | * ProgramEnvPFchAcpiMmio - Config HwAcpi MMIO registers |
| 144 | * Acpi S3 resume won't execute this procedure (POST only) |
| 145 | * |
| 146 | * @param[in] FchDataPtr Fch configuration structure pointer. |
| 147 | * |
| 148 | */ |
| 149 | VOID |
| 150 | ProgramEnvPFchAcpiMmio ( |
| 151 | IN VOID *FchDataPtr |
| 152 | ) |
| 153 | { |
| 154 | FCH_DATA_BLOCK *LocalCfgPtr; |
| 155 | AMD_CONFIG_PARAMS *StdHeader; |
| 156 | |
| 157 | LocalCfgPtr = (FCH_DATA_BLOCK *) FchDataPtr; |
| 158 | StdHeader = LocalCfgPtr->StdHeader; |
| 159 | |
| 160 | ProgramFchAcpiMmioTbl ((ACPI_REG_WRITE*) (&FchYangtzeInitEnvHwAcpiMmioTable[0]), StdHeader); |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * ProgramFchEnvHwAcpiPciReg - Config HwAcpi PCI controller |
| 165 | * before PCI emulation |
| 166 | * |
| 167 | * |
| 168 | * |
| 169 | * @param[in] FchDataPtr Fch configuration structure pointer. |
| 170 | * |
| 171 | */ |
| 172 | VOID |
| 173 | ProgramFchEnvHwAcpiPciReg ( |
| 174 | IN VOID *FchDataPtr |
| 175 | ) |
| 176 | { |
| 177 | FCH_DATA_BLOCK *LocalCfgPtr; |
| 178 | AMD_CONFIG_PARAMS *StdHeader; |
| 179 | |
| 180 | LocalCfgPtr = (FCH_DATA_BLOCK *) FchDataPtr; |
| 181 | StdHeader = LocalCfgPtr->StdHeader; |
| 182 | |
| 183 | // |
| 184 | //Early post initialization of pci config space |
| 185 | // |
| 186 | ProgramPciByteTable ((REG8_MASK*) (&FchYangtzeInitEnvHwAcpiPciTable[0]), sizeof (FchYangtzeInitEnvHwAcpiPciTable) / sizeof (REG8_MASK), StdHeader); |
| 187 | |
| 188 | if ( LocalCfgPtr->Smbus.SmbusSsid != 0 ) { |
| 189 | RwPci ((SMBUS_BUS_DEV_FUN << 16) + FCH_CFG_REG2C, AccessWidth32, 0x00, LocalCfgPtr->Smbus.SmbusSsid, StdHeader); |
| 190 | } |
WANG Siyuan | 7b6d412 | 2013-07-31 16:55:26 +0800 | [diff] [blame] | 191 | if ( LocalCfgPtr->Misc.NoneSioKbcSupport ) { |
| 192 | RwMem (ACPI_MMIO_BASE + PMIO_BASE + FCH_PMIOA_REGED, AccessWidth8, ~(UINT32) ( BIT2 + BIT1), BIT2 + BIT1); |
| 193 | } else { |
| 194 | RwMem (ACPI_MMIO_BASE + PMIO_BASE + FCH_PMIOA_REGED, AccessWidth8, ~(UINT32) ( BIT2 + BIT1), BIT2); |
| 195 | } |
Siyuan Wang | affe85f | 2013-07-25 15:14:15 +0800 | [diff] [blame] | 196 | ProgramPcieNativeMode (FchDataPtr); |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * FchVgaInit - Config VGA CODEC |
| 201 | * |
| 202 | * @param[in] VOID empty |
| 203 | * |
| 204 | */ |
| 205 | VOID |
| 206 | FchVgaInit ( |
| 207 | OUT VOID |
| 208 | ) |
| 209 | { |
| 210 | } |
| 211 | |
| 212 | /** |
| 213 | * ProgramSpecificFchInitEnvAcpiMmio - Config HwAcpi MMIO before |
| 214 | * PCI emulation |
| 215 | * |
| 216 | * |
| 217 | * |
| 218 | * @param[in] FchDataPtr Fch configuration structure pointer. |
| 219 | * |
| 220 | */ |
| 221 | VOID |
| 222 | ProgramSpecificFchInitEnvAcpiMmio ( |
| 223 | IN VOID *FchDataPtr |
| 224 | ) |
| 225 | { |
| 226 | CPUID_DATA CpuId; |
| 227 | FCH_DATA_BLOCK *LocalCfgPtr; |
| 228 | AMD_CONFIG_PARAMS *StdHeader; |
| 229 | |
| 230 | LocalCfgPtr = (FCH_DATA_BLOCK *) FchDataPtr; |
| 231 | StdHeader = LocalCfgPtr->StdHeader; |
| 232 | |
| 233 | ProgramFchAcpiMmioTbl ((ACPI_REG_WRITE*) (&FchYangtzeInitEnvSpecificHwAcpiMmioTable[0]), StdHeader); |
| 234 | |
| 235 | LibAmdCpuidRead (AMD_CPUID_APICID_LPC_BID, &CpuId, StdHeader); |
| 236 | |
| 237 | if ((LocalCfgPtr->HwAcpi.AnyHt200MhzLink) || ((CpuId.EAX_Reg & 0x00ff00f0) == 0x100080) || ((CpuId.EAX_Reg & 0x00ff00f0) == 0x100090) || ((CpuId.EAX_Reg & 0x00ff00f0) == 0x1000A0)) { |
| 238 | RwMem (ACPI_MMIO_BASE + PMIO_BASE + FCH_PMIOA_REG94, AccessWidth8, 0, 0x0A); |
| 239 | RwMem (ACPI_MMIO_BASE + PMIO_BASE + 0x80 + 3, AccessWidth8, 0xFE, 0x28); |
| 240 | } else { |
| 241 | RwMem (ACPI_MMIO_BASE + PMIO_BASE + FCH_PMIOA_REG94, AccessWidth8, 0, 0x01); |
| 242 | RwMem (ACPI_MMIO_BASE + PMIO_BASE + 0x80 + 3, AccessWidth8, 0xFE, 0x20); |
| 243 | } |
| 244 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG6C + 2, AccessWidth8, 0x5F, 0xA0); |
| 245 | // |
| 246 | // Ac Loss Control |
| 247 | // |
| 248 | AcLossControl ((UINT8) LocalCfgPtr->HwAcpi.PwrFailShadow); |
| 249 | // |
| 250 | // FCH VGA Init |
| 251 | // |
| 252 | FchVgaInit (); |
| 253 | |
| 254 | // |
| 255 | // Set ACPIMMIO by OEM Input table |
| 256 | // |
| 257 | ProgramFchAcpiMmioTbl ((ACPI_REG_WRITE *) (LocalCfgPtr->HwAcpi.OemProgrammingTablePtr), StdHeader); |
| 258 | } |
| 259 | |
| 260 | /** |
| 261 | * ValidateFchVariant - Validate FCH Variant |
| 262 | * |
| 263 | * |
| 264 | * |
| 265 | * @param[in] FchDataPtr |
| 266 | * |
| 267 | */ |
| 268 | VOID |
| 269 | ValidateFchVariant ( |
| 270 | IN VOID *FchDataPtr |
| 271 | ) |
| 272 | { |
| 273 | CPUID_DATA CpuId; |
| 274 | FCH_DATA_BLOCK *LocalCfgPtr; |
| 275 | AMD_CONFIG_PARAMS *StdHeader; |
| 276 | |
| 277 | LocalCfgPtr = (FCH_DATA_BLOCK *) FchDataPtr; |
| 278 | StdHeader = LocalCfgPtr->StdHeader; |
| 279 | LibAmdCpuidRead (CPUID_FMF, &CpuId, StdHeader); |
| 280 | LocalCfgPtr->Misc.FchCpuId = ( UINT32 ) (CpuId.EAX_Reg & 0xFFFFFFFF); |
| 281 | } |
| 282 | |
| 283 | /** |
| 284 | * IsExternalClockMode - Is External Clock Mode? |
| 285 | * |
| 286 | * |
| 287 | * @retval TRUE or FALSE |
| 288 | * |
| 289 | */ |
| 290 | BOOLEAN |
| 291 | IsExternalClockMode ( |
| 292 | IN VOID *FchDataPtr |
| 293 | ) |
| 294 | { |
| 295 | UINT8 MISC80; |
| 296 | ReadMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG80 + 2, AccessWidth8, &MISC80); |
| 297 | return ( (BOOLEAN) ((MISC80 & BIT1) == 0) ); |
| 298 | } |
| 299 | |
| 300 | |
| 301 | /** |
| 302 | * ProgramFchEnvSpreadSpectrum - Config SpreadSpectrum before |
| 303 | * PCI emulation |
| 304 | * |
| 305 | * |
| 306 | * |
| 307 | * @param[in] FchDataPtr Fch configuration structure pointer. |
| 308 | * |
| 309 | */ |
| 310 | VOID |
| 311 | ProgramFchEnvSpreadSpectrum ( |
| 312 | IN VOID *FchDataPtr |
| 313 | ) |
| 314 | { |
| 315 | UINT8 PortStatus; |
| 316 | UINT8 FchSpreadSpectrum; |
| 317 | |
| 318 | FCH_DATA_BLOCK *LocalCfgPtr; |
| 319 | AMD_CONFIG_PARAMS *StdHeader; |
| 320 | |
| 321 | LocalCfgPtr = (FCH_DATA_BLOCK *) FchDataPtr; |
| 322 | StdHeader = LocalCfgPtr->StdHeader; |
| 323 | |
| 324 | FchSpreadSpectrum = LocalCfgPtr->HwAcpi.SpreadSpectrum; |
| 325 | |
| 326 | if ( FchSpreadSpectrum ) { |
| 327 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG08, AccessWidth8, 0xFE, 0x00); |
| 328 | if ( LocalCfgPtr->HwAcpi.SpreadSpectrumOptions == 0 ) { |
| 329 | /// -0.362% |
| 330 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG18 + 1, AccessWidth8, 0xF0, 0x01); |
| 331 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG14 + 2, AccessWidth16, 0, 0xCF5C); |
| 332 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG14, AccessWidth16, 0, 0x0137); |
| 333 | } |
| 334 | if ( LocalCfgPtr->HwAcpi.SpreadSpectrumOptions == 1 ) { |
| 335 | /// -0.375% |
| 336 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG18 + 1, AccessWidth8, 0xF0, 0x01); |
| 337 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG14 + 2, AccessWidth16, 0, 0xE000); |
| 338 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG14, AccessWidth16, 0, 0x0142); |
| 339 | } |
| 340 | if ( LocalCfgPtr->HwAcpi.SpreadSpectrumOptions == 2 ) { |
| 341 | /// -0.4% |
| 342 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG18 + 1, AccessWidth8, 0xF0, 0x02); |
| 343 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG14 + 2, AccessWidth16, 0, 0); |
| 344 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG14, AccessWidth16, 0, 0x0158); |
| 345 | } |
| 346 | if ( LocalCfgPtr->HwAcpi.SpreadSpectrumOptions == 3 ) { |
| 347 | /// -0.425% |
| 348 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG18 + 1, AccessWidth8, 0xF0, 0x02); |
| 349 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG14 + 2, AccessWidth16, 0, 0x1FFF); |
| 350 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG14, AccessWidth16, 0, 0x016D); |
| 351 | } |
| 352 | if ( LocalCfgPtr->HwAcpi.SpreadSpectrumOptions == 4 ) { |
| 353 | /// -0.45% |
| 354 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG18 + 1, AccessWidth8, 0xF0, 0x02); |
| 355 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG14 + 2, AccessWidth16, 0, 0x4000); |
| 356 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG14, AccessWidth16, 0, 0x0183); |
| 357 | } |
| 358 | if ( LocalCfgPtr->HwAcpi.SpreadSpectrumOptions == 5 ) { |
| 359 | /// -0.475% |
| 360 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG18 + 1, AccessWidth8, 0xF0, 0x02); |
| 361 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG14 + 2, AccessWidth16, 0, 0x6000); |
| 362 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG14, AccessWidth16, 0, 0x0198); |
| 363 | } |
| 364 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG08, AccessWidth8, 0xFE, BIT0); |
| 365 | } else { |
| 366 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG08, AccessWidth8, 0xFE, 0x00); |
| 367 | } |
| 368 | |
| 369 | // |
| 370 | // PLL 100Mhz Reference Clock Buffer setting for internal clock generator mode (BIT5) |
| 371 | // OSC Clock setting for internal clock generator mode (BIT6) |
| 372 | // |
| 373 | GetChipSysMode (&PortStatus, StdHeader); |
| 374 | if ( ((PortStatus & ChipSysIntClkGen) == ChipSysIntClkGen) ) { |
| 375 | RwMem (ACPI_MMIO_BASE + MISC_BASE + FCH_MISC_REG04 + 1, AccessWidth8, (UINT32)~(BIT5 + BIT6), BIT5 + BIT6); |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | /** |
| 380 | * TurnOffCG2 |
| 381 | * |
| 382 | * |
| 383 | * @retval VOID |
| 384 | * |
| 385 | */ |
| 386 | VOID |
| 387 | TurnOffCG2 ( |
| 388 | OUT VOID |
| 389 | ) |
| 390 | { |
| 391 | } |
| 392 | |
| 393 | /** |
| 394 | * BackUpCG2 |
| 395 | * |
| 396 | * |
| 397 | * @retval VOID |
| 398 | * |
| 399 | */ |
| 400 | VOID |
| 401 | BackUpCG2 ( |
| 402 | OUT VOID |
| 403 | ) |
| 404 | { |
| 405 | } |
| 406 | |
| 407 | /** |
| 408 | * HpetInit - Program Fch HPET function |
| 409 | * |
| 410 | * |
| 411 | * |
| 412 | * @param[in] FchDataPtr Fch configuration structure pointer. |
| 413 | * |
| 414 | */ |
| 415 | VOID |
| 416 | HpetInit ( |
| 417 | IN VOID *FchDataPtr |
| 418 | ) |
| 419 | { |
| 420 | DESCRIPTION_HEADER *HpetTable; |
| 421 | UINT8 FchHpetTimer; |
| 422 | UINT8 FchHpetMsiDis; |
| 423 | FCH_DATA_BLOCK *LocalCfgPtr; |
| 424 | |
| 425 | LocalCfgPtr = (FCH_DATA_BLOCK *) FchDataPtr; |
| 426 | FchHpetTimer = (UINT8) LocalCfgPtr->Hpet.HpetEnable; |
| 427 | FchHpetMsiDis = (UINT8) LocalCfgPtr->Hpet.HpetMsiDis; |
| 428 | |
| 429 | HpetTable = NULL; |
| 430 | if ( FchHpetTimer == TRUE ) { |
| 431 | // |
| 432 | //Program the HPET BAR address |
| 433 | // |
| 434 | RwMem (ACPI_MMIO_BASE + PMIO_BASE + FCH_PMIOA_REG50, AccessWidth32, FCH_HPET_REG_MASK, LocalCfgPtr->Hpet.HpetBase); |
| 435 | |
| 436 | // |
| 437 | //Enabling decoding of HPET MMIO |
| 438 | //Enable HPET MSI support |
| 439 | //Enable High Precision Event Timer (also called Multimedia Timer) interrupt |
| 440 | // |
| 441 | if ( FchHpetMsiDis == FALSE ) { |
| 442 | RwMem (ACPI_MMIO_BASE + PMIO_BASE + FCH_PMIOA_REG50, AccessWidth32, FCH_HPET_REG_MASK, BIT0 + BIT1 + BIT2 + BIT3 + BIT4); |
| 443 | #ifdef FCH_TIMER_TICK_INTERVAL_WA |
| 444 | RwMem (ACPI_MMIO_BASE + PMIO_BASE + FCH_PMIOA_REG50, AccessWidth32, FCH_HPET_REG_MASK, BIT0 + BIT1); |
| 445 | #endif |
| 446 | } else { |
| 447 | RwMem (ACPI_MMIO_BASE + PMIO_BASE + FCH_PMIOA_REG50, AccessWidth32, FCH_HPET_REG_MASK, BIT0 + BIT1); |
| 448 | } |
| 449 | |
| 450 | } else { |
| 451 | if ( ! (LocalCfgPtr->Misc.S3Resume) ) { |
| 452 | HpetTable = (DESCRIPTION_HEADER*) AcpiLocateTable (Int32FromChar('H','P','E','T'));//'TEPH' |
| 453 | } |
| 454 | if ( HpetTable != NULL ) { |
| 455 | HpetTable->Signature = Int32FromChar('T','E','P','H');//'HPET' |
| 456 | } |
| 457 | } |
| 458 | } |
| 459 | |
| 460 | /** |
| 461 | * ProgramPcieNativeMode - Config Pcie Native Mode |
| 462 | * |
| 463 | * |
| 464 | * |
| 465 | * @param[in] FchDataPtr Fch configuration structure pointer. |
| 466 | * |
| 467 | */ |
| 468 | VOID |
| 469 | ProgramPcieNativeMode ( |
| 470 | IN VOID *FchDataPtr |
| 471 | ) |
| 472 | { |
| 473 | UINT8 FchNativepciesupport; |
| 474 | FCH_DATA_BLOCK *LocalCfgPtr; |
| 475 | |
| 476 | LocalCfgPtr = (FCH_DATA_BLOCK *) FchDataPtr; |
| 477 | FchNativepciesupport = (UINT8) LocalCfgPtr->Misc.NativePcieSupport; |
| 478 | |
| 479 | // |
| 480 | // PCIE Native setting |
| 481 | // |
| 482 | RwMem (ACPI_MMIO_BASE + PMIO_BASE + FCH_PMIOA_REGBA + 1, AccessWidth8, (UINT32)~BIT6, 0); |
| 483 | if ( FchNativepciesupport == 1) { |
| 484 | RwMem (ACPI_MMIO_BASE + PMIO_BASE + 0x74 + 3, AccessWidth8, (UINT32)~(BIT3 + BIT1 + BIT0), BIT3 + BIT0); |
| 485 | } else { |
| 486 | RwMem (ACPI_MMIO_BASE + PMIO_BASE + 0x74 + 3, AccessWidth8, (UINT32)~(BIT3 + BIT1 + BIT0), BIT3); |
| 487 | } |
| 488 | } |