Siyuan Wang | affe85f | 2013-07-25 15:14:15 +0800 | [diff] [blame] | 1 | /* $NoKeywords:$ */ |
| 2 | /** |
| 3 | * @file |
| 4 | * |
| 5 | * Install of build option: PState |
| 6 | * |
| 7 | * Contains AMD AGESA install macros and test conditions. Output is the |
| 8 | * defaults tables reflecting the User's build options selection. |
| 9 | * |
| 10 | * @xrefitem bom "File Content Label" "Release Content" |
| 11 | * @e project: AGESA |
| 12 | * @e sub-project: Options |
| 13 | * @e \$Revision: 84150 $ @e \$Date: 2012-12-12 15:46:25 -0600 (Wed, 12 Dec 2012) $ |
| 14 | */ |
| 15 | /***************************************************************************** |
| 16 | * |
| 17 | * Copyright (c) 2008 - 2013, Advanced Micro Devices, Inc. |
| 18 | * All rights reserved. |
| 19 | * |
| 20 | * Redistribution and use in source and binary forms, with or without |
| 21 | * modification, are permitted provided that the following conditions are met: |
| 22 | * * Redistributions of source code must retain the above copyright |
| 23 | * notice, this list of conditions and the following disclaimer. |
| 24 | * * Redistributions in binary form must reproduce the above copyright |
| 25 | * notice, this list of conditions and the following disclaimer in the |
| 26 | * documentation and/or other materials provided with the distribution. |
| 27 | * * Neither the name of Advanced Micro Devices, Inc. nor the names of |
| 28 | * its contributors may be used to endorse or promote products derived |
| 29 | * from this software without specific prior written permission. |
| 30 | * |
| 31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 32 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 33 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 34 | * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY |
| 35 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 36 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 37 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 38 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 39 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 40 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 41 | * |
| 42 | ***************************************************************************/ |
| 43 | |
| 44 | #ifndef _OPTION_PSTATE_INSTALL_H_ |
| 45 | #define _OPTION_PSTATE_INSTALL_H_ |
| 46 | |
| 47 | #include "cpuPstateTables.h" |
| 48 | |
| 49 | /* This option is designed to be included into the platform solution install |
| 50 | * file. The platform solution install file will define the options status. |
| 51 | * Check to validate the definition |
| 52 | */ |
| 53 | |
| 54 | #define F15_TN_PSTATE_SERVICE_SUPPORT |
| 55 | #define F16_KB_PSTATE_SERVICE_SUPPORT |
| 56 | |
| 57 | #if ((AGESA_ENTRY_INIT_LATE == TRUE) || (AGESA_ENTRY_INIT_POST == TRUE)) |
| 58 | // |
| 59 | //Define Pstate CPU Family service |
| 60 | // |
| 61 | #ifdef OPTION_FAMILY15H |
| 62 | #if OPTION_FAMILY15H == TRUE |
| 63 | #ifdef OPTION_FAMILY15H_TN |
| 64 | #if OPTION_FAMILY15H_TN == TRUE |
| 65 | extern CONST PSTATE_CPU_FAMILY_SERVICES ROMDATA F15TnPstateServices; |
| 66 | #undef F15_TN_PSTATE_SERVICE_SUPPORT |
| 67 | #define F15_TN_PSTATE_SERVICE_SUPPORT {AMD_FAMILY_15_TN, &F15TnPstateServices}, |
| 68 | #endif |
| 69 | #endif |
| 70 | #endif |
| 71 | #endif |
| 72 | |
| 73 | #ifdef OPTION_FAMILY16H |
| 74 | #if OPTION_FAMILY16H == TRUE |
| 75 | #ifdef OPTION_FAMILY16H_KB |
| 76 | #if OPTION_FAMILY16H_KB == TRUE |
| 77 | extern CONST PSTATE_CPU_FAMILY_SERVICES ROMDATA F16KbPstateServices; |
| 78 | #undef F16_KB_PSTATE_SERVICE_SUPPORT |
| 79 | #define F16_KB_PSTATE_SERVICE_SUPPORT {AMD_FAMILY_16_KB, &F16KbPstateServices}, |
| 80 | #endif |
| 81 | #endif |
| 82 | #endif |
| 83 | #endif |
| 84 | // |
| 85 | //Define ACPI Pstate objects. |
| 86 | // |
| 87 | #ifndef OPTION_ACPI_PSTATES |
| 88 | #error BLDOPT: Option not defined: "OPTION_ACPI_PSTATES" |
| 89 | #endif |
| 90 | #if (OPTION_ACPI_PSTATES == TRUE) |
| 91 | OPTION_SSDT_FEATURE GenerateSsdt; |
| 92 | #define USER_SSDT_MAIN GenerateSsdt |
| 93 | #ifndef OPTION_MULTISOCKET |
| 94 | #error BLDOPT: Option not defined: "OPTION_MULTISOCKET" |
| 95 | #endif |
| 96 | |
| 97 | OPTION_ACPI_FEATURE CreatePStateAcpiTables; |
| 98 | OPTION_PSTATE_GATHER PStateGatherMain; |
| 99 | #if ((OPTION_MULTISOCKET == TRUE) && (AGESA_ENTRY_INIT_POST == TRUE)) |
| 100 | OPTION_PSTATE_LEVELING PStateLevelingMain; |
| 101 | #define USER_PSTATE_OPTION_LEVEL PStateLevelingMain |
| 102 | #else |
| 103 | OPTION_PSTATE_LEVELING PStateLevelingStub; |
| 104 | #define USER_PSTATE_OPTION_LEVEL PStateLevelingStub |
| 105 | #endif |
| 106 | #if AGESA_ENTRY_INIT_LATE == TRUE |
| 107 | #define USER_PSTATE_OPTION_MAIN CreatePStateAcpiTables |
| 108 | #else |
| 109 | OPTION_ACPI_FEATURE CreateAcpiTablesStub; |
| 110 | #define USER_PSTATE_OPTION_MAIN CreateAcpiTablesStub |
| 111 | #endif |
| 112 | #if AGESA_ENTRY_INIT_POST == TRUE |
| 113 | #define USER_PSTATE_OPTION_GATHER PStateGatherMain |
| 114 | #else |
| 115 | OPTION_PSTATE_GATHER PStateGatherStub; |
| 116 | #define USER_PSTATE_OPTION_GATHER PStateGatherStub |
| 117 | #endif |
| 118 | #if CFG_ACPI_PSTATES_PPC == TRUE |
| 119 | #define USER_PSTATE_CFG_PPC TRUE |
| 120 | #else |
| 121 | #define USER_PSTATE_CFG_PPC FALSE |
| 122 | #endif |
| 123 | #if CFG_ACPI_PSTATES_PCT == TRUE |
| 124 | #define USER_PSTATE_CFG_PCT TRUE |
| 125 | #else |
| 126 | #define USER_PSTATE_CFG_PCT FALSE |
| 127 | #endif |
| 128 | #if CFG_ACPI_PSTATES_PSD == TRUE |
| 129 | #define USER_PSTATE_CFG_PSD TRUE |
| 130 | #else |
| 131 | #define USER_PSTATE_CFG_PSD FALSE |
| 132 | #endif |
| 133 | #if CFG_ACPI_PSTATES_PSS == TRUE |
| 134 | #define USER_PSTATE_CFG_PSS TRUE |
| 135 | #else |
| 136 | #define USER_PSTATE_CFG_PSS FALSE |
| 137 | #endif |
| 138 | #if CFG_ACPI_PSTATES_XPSS == TRUE |
| 139 | #define USER_PSTATE_CFG_XPSS TRUE |
| 140 | #else |
| 141 | #define USER_PSTATE_CFG_XPSS FALSE |
| 142 | #endif |
| 143 | |
| 144 | #if OPTION_IO_CSTATE == TRUE |
| 145 | OPTION_ACPI_FEATURE CreateCStateAcpiTables; |
| 146 | #define USER_CSTATE_OPTION_MAIN CreateCStateAcpiTables |
| 147 | #else |
| 148 | OPTION_ACPI_FEATURE CreateAcpiTablesStub; |
| 149 | #define USER_CSTATE_OPTION_MAIN CreateAcpiTablesStub |
| 150 | #endif |
| 151 | #else |
| 152 | OPTION_SSDT_FEATURE GenerateSsdtStub; |
| 153 | OPTION_ACPI_FEATURE CreateAcpiTablesStub; |
| 154 | OPTION_PSTATE_GATHER PStateGatherStub; |
| 155 | OPTION_PSTATE_LEVELING PStateLevelingStub; |
| 156 | #define USER_SSDT_MAIN GenerateSsdtStub |
| 157 | #define USER_PSTATE_OPTION_MAIN CreateAcpiTablesStub |
| 158 | #define USER_CSTATE_OPTION_MAIN CreateAcpiTablesStub |
| 159 | #define USER_PSTATE_OPTION_GATHER PStateGatherStub |
| 160 | #define USER_PSTATE_OPTION_LEVEL PStateLevelingStub |
| 161 | #define USER_PSTATE_CFG_PPC FALSE |
| 162 | #define USER_PSTATE_CFG_PCT FALSE |
| 163 | #define USER_PSTATE_CFG_PSD FALSE |
| 164 | #define USER_PSTATE_CFG_PSS FALSE |
| 165 | #define USER_PSTATE_CFG_XPSS FALSE |
| 166 | |
| 167 | // If ACPI Objects are disabled for PStates, we still need to check |
| 168 | // whether ACPI Objects are enabled for CStates |
| 169 | #if OPTION_IO_CSTATE == TRUE |
| 170 | OPTION_SSDT_FEATURE GenerateSsdt; |
| 171 | OPTION_PSTATE_GATHER PStateGatherMain; |
| 172 | OPTION_ACPI_FEATURE CreateCStateAcpiTables; |
| 173 | #undef USER_SSDT_MAIN |
| 174 | #define USER_SSDT_MAIN GenerateSsdt |
| 175 | #undef USER_PSTATE_OPTION_GATHER |
| 176 | #define USER_PSTATE_OPTION_GATHER PStateGatherMain |
| 177 | #undef USER_CSTATE_OPTION_MAIN |
| 178 | #define USER_CSTATE_OPTION_MAIN CreateCStateAcpiTables |
| 179 | #endif |
| 180 | #endif |
| 181 | #else |
| 182 | OPTION_SSDT_FEATURE GenerateSsdtStub; |
| 183 | OPTION_ACPI_FEATURE CreateAcpiTablesStub; |
| 184 | OPTION_PSTATE_GATHER PStateGatherStub; |
| 185 | OPTION_PSTATE_LEVELING PStateLevelingStub; |
| 186 | #define USER_SSDT_MAIN GenerateSsdtStub |
| 187 | #define USER_PSTATE_OPTION_MAIN CreateAcpiTablesStub |
| 188 | #define USER_CSTATE_OPTION_MAIN CreateAcpiTablesStub |
| 189 | #define USER_PSTATE_OPTION_GATHER PStateGatherStub |
| 190 | #define USER_PSTATE_OPTION_LEVEL PStateLevelingStub |
| 191 | #define USER_PSTATE_CFG_PPC FALSE |
| 192 | #define USER_PSTATE_CFG_PCT FALSE |
| 193 | #define USER_PSTATE_CFG_PSD FALSE |
| 194 | #define USER_PSTATE_CFG_PSS FALSE |
| 195 | #define USER_PSTATE_CFG_XPSS FALSE |
| 196 | #endif |
| 197 | |
| 198 | /* Declare the instance of the PSTATE option configuration structure */ |
Arthur Heymans | 8d3640d | 2022-05-16 12:27:36 +0200 | [diff] [blame^] | 199 | CONST OPTION_PSTATE_POST_CONFIGURATION OptionPstatePostConfiguration = { |
Siyuan Wang | affe85f | 2013-07-25 15:14:15 +0800 | [diff] [blame] | 200 | PSTATE_STRUCT_VERSION, |
| 201 | USER_PSTATE_OPTION_GATHER, |
| 202 | USER_PSTATE_OPTION_LEVEL |
| 203 | }; |
| 204 | |
Arthur Heymans | 8d3640d | 2022-05-16 12:27:36 +0200 | [diff] [blame^] | 205 | CONST OPTION_PSTATE_LATE_CONFIGURATION OptionPstateLateConfiguration = { |
Siyuan Wang | affe85f | 2013-07-25 15:14:15 +0800 | [diff] [blame] | 206 | PSTATE_STRUCT_VERSION, |
| 207 | USER_SSDT_MAIN, |
| 208 | USER_PSTATE_OPTION_MAIN, |
| 209 | USER_CSTATE_OPTION_MAIN, |
| 210 | USER_PSTATE_CFG_PPC, |
| 211 | USER_PSTATE_CFG_PCT, |
| 212 | USER_PSTATE_CFG_PSD, |
| 213 | USER_PSTATE_CFG_PSS, |
| 214 | USER_PSTATE_CFG_XPSS, |
| 215 | {CFG_ACPI_SET_OEM_ID}, |
| 216 | {CFG_ACPI_SET_OEM_TABLE_ID} |
| 217 | }; |
| 218 | |
| 219 | CONST CPU_SPECIFIC_SERVICES_XLAT ROMDATA PstateCpuFamilyServiceArray[] = |
| 220 | { |
| 221 | F15_TN_PSTATE_SERVICE_SUPPORT |
| 222 | F16_KB_PSTATE_SERVICE_SUPPORT |
| 223 | {0, NULL} |
| 224 | }; |
| 225 | CONST CPU_FAMILY_SUPPORT_TABLE ROMDATA PstateFamilyServiceTable = |
| 226 | { |
| 227 | (sizeof (PstateCpuFamilyServiceArray) / sizeof (CPU_SPECIFIC_SERVICES_XLAT)), |
| 228 | &PstateCpuFamilyServiceArray[0] |
| 229 | }; |
| 230 | #endif // _OPTION_PSTATE_INSTALL_H_ |