AGESA F15: AMD family15 AGESA code
[coreboot.git] / src / vendorcode / amd / agesa / f15 / Include / OptionPstateInstall.h
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: 52904 $   @e \$Date: 2011-05-12 16:42:35 -0600 (Thu, 12 May 2011) $
14  */
15 /*****************************************************************************
16  *
17  * Copyright (C) 2012 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
45 #ifndef _OPTION_PSTATE_INSTALL_H_
46 #define _OPTION_PSTATE_INSTALL_H_
47
48 #include "cpuPstateTables.h"
49
50 /*  This option is designed to be included into the platform solution install
51  *  file. The platform solution install file will define the options status.
52  *  Check to validate the definition
53  */
54
55 #define F10_PSTATE_SERVICE_SUPPORT
56 #define F12_PSTATE_SERVICE_SUPPORT
57 #define F14_PSTATE_SERVICE_SUPPORT
58 #define F15_OR_PSTATE_SERVICE_SUPPORT
59 #define F15_TN_PSTATE_SERVICE_SUPPORT
60 #define F15_KM_PSTATE_SERVICE_SUPPORT
61
62
63 #if ((AGESA_ENTRY_INIT_LATE == TRUE) || (AGESA_ENTRY_INIT_POST == TRUE))
64   //
65   //Define Pstate CPU Family service
66   //
67   #ifdef OPTION_FAMILY10H
68     #if OPTION_FAMILY10H == TRUE
69       extern CONST PSTATE_CPU_FAMILY_SERVICES ROMDATA F10PstateServices;
70       #undef F10_PSTATE_SERVICE_SUPPORT
71       #define F10_PSTATE_SERVICE_SUPPORT {AMD_FAMILY_10, &F10PstateServices},
72     #endif
73   #endif
74
75   #ifdef OPTION_FAMILY12H
76     #if OPTION_FAMILY12H == TRUE
77       extern CONST PSTATE_CPU_FAMILY_SERVICES ROMDATA F12PstateServices;
78       #undef F12_PSTATE_SERVICE_SUPPORT
79       #define F12_PSTATE_SERVICE_SUPPORT {AMD_FAMILY_12, &F12PstateServices},
80     #endif
81   #endif
82
83   #ifdef OPTION_FAMILY14H
84     #if OPTION_FAMILY14H == TRUE
85       extern CONST PSTATE_CPU_FAMILY_SERVICES ROMDATA F14PstateServices;
86       #undef F14_PSTATE_SERVICE_SUPPORT
87       #define F14_PSTATE_SERVICE_SUPPORT {AMD_FAMILY_14, &F14PstateServices},
88     #endif
89   #endif
90
91   #ifdef OPTION_FAMILY15H
92     #if OPTION_FAMILY15H == TRUE
93       #ifdef OPTION_FAMILY15H_OR
94         #if OPTION_FAMILY15H_OR == TRUE
95           extern CONST PSTATE_CPU_FAMILY_SERVICES ROMDATA F15OrPstateServices;
96           #undef F15_OR_PSTATE_SERVICE_SUPPORT
97           #define F15_OR_PSTATE_SERVICE_SUPPORT {AMD_FAMILY_15_OR, &F15OrPstateServices},
98         #endif
99       #endif
100       #ifdef OPTION_FAMILY15H_TN
101         #if OPTION_FAMILY15H_TN == TRUE
102           extern CONST PSTATE_CPU_FAMILY_SERVICES ROMDATA F15TnPstateServices;
103           #undef F15_TN_PSTATE_SERVICE_SUPPORT
104           #define F15_TN_PSTATE_SERVICE_SUPPORT {AMD_FAMILY_15_TN, &F15TnPstateServices},
105         #endif
106       #endif
107       #ifdef OPTION_FAMILY15H_KM
108         #if OPTION_FAMILY15H_KM == TRUE
109           extern CONST PSTATE_CPU_FAMILY_SERVICES ROMDATA F15KmPstateServices;
110           #undef F15_KM_PSTATE_SERVICE_SUPPORT
111           #define F15_KM_PSTATE_SERVICE_SUPPORT {AMD_FAMILY_15_KM, &F15KmPstateServices},
112         #endif
113       #endif
114     #endif
115   #endif
116   //
117   //Define ACPI Pstate objects.
118   //
119   #ifndef OPTION_ACPI_PSTATES
120     #error  BLDOPT: Option not defined: "OPTION_ACPI_PSTATES"
121   #endif
122   #if (OPTION_ACPI_PSTATES == TRUE)
123     OPTION_SSDT_FEATURE               GenerateSsdt;
124     #define USER_SSDT_MAIN            GenerateSsdt
125     #ifndef OPTION_MULTISOCKET
126       #error  BLDOPT: Option not defined: "OPTION_MULTISOCKET"
127     #endif
128
129     OPTION_ACPI_FEATURE               CreatePStateAcpiTables;
130     OPTION_PSTATE_GATHER              PStateGatherMain;
131     #if ((OPTION_MULTISOCKET == TRUE) && (AGESA_ENTRY_INIT_POST == TRUE))
132       OPTION_PSTATE_LEVELING          PStateLevelingMain;
133       #define USER_PSTATE_OPTION_LEVEL  PStateLevelingMain
134     #else
135       OPTION_PSTATE_LEVELING            PStateLevelingStub;
136       #define USER_PSTATE_OPTION_LEVEL  PStateLevelingStub
137     #endif
138     #if AGESA_ENTRY_INIT_LATE == TRUE
139       #define USER_PSTATE_OPTION_MAIN   CreatePStateAcpiTables
140     #else
141       OPTION_ACPI_FEATURE               CreateAcpiTablesStub;
142       #define USER_PSTATE_OPTION_MAIN   CreateAcpiTablesStub
143     #endif
144     #if AGESA_ENTRY_INIT_POST == TRUE
145       #define USER_PSTATE_OPTION_GATHER PStateGatherMain
146     #else
147       OPTION_PSTATE_GATHER              PStateGatherStub;
148       #define USER_PSTATE_OPTION_GATHER PStateGatherStub
149     #endif
150     #if CFG_ACPI_PSTATES_PPC == TRUE
151       #define USER_PSTATE_CFG_PPC   TRUE
152     #else
153       #define USER_PSTATE_CFG_PPC   FALSE
154     #endif
155     #if CFG_ACPI_PSTATES_PCT == TRUE
156       #define USER_PSTATE_CFG_PCT   TRUE
157     #else
158       #define USER_PSTATE_CFG_PCT   FALSE
159     #endif
160     #if CFG_ACPI_PSTATES_PSD == TRUE
161       #define USER_PSTATE_CFG_PSD   TRUE
162     #else
163       #define USER_PSTATE_CFG_PSD   FALSE
164     #endif
165     #if CFG_ACPI_PSTATES_PSS == TRUE
166       #define USER_PSTATE_CFG_PSS   TRUE
167     #else
168       #define USER_PSTATE_CFG_PSS   FALSE
169     #endif
170     #if CFG_ACPI_PSTATES_XPSS == TRUE
171       #define USER_PSTATE_CFG_XPSS   TRUE
172     #else
173       #define USER_PSTATE_CFG_XPSS   FALSE
174     #endif
175
176     #if OPTION_IO_CSTATE == TRUE
177       OPTION_ACPI_FEATURE             CreateCStateAcpiTables;
178       #define USER_CSTATE_OPTION_MAIN CreateCStateAcpiTables
179     #else
180       OPTION_ACPI_FEATURE             CreateAcpiTablesStub;
181       #define USER_CSTATE_OPTION_MAIN CreateAcpiTablesStub
182     #endif
183   #else
184     OPTION_SSDT_FEATURE               GenerateSsdtStub;
185     OPTION_ACPI_FEATURE               CreateAcpiTablesStub;
186     OPTION_PSTATE_GATHER              PStateGatherStub;
187     OPTION_PSTATE_LEVELING            PStateLevelingStub;
188     #define USER_SSDT_MAIN            GenerateSsdtStub
189     #define USER_PSTATE_OPTION_MAIN   CreateAcpiTablesStub
190     #define USER_CSTATE_OPTION_MAIN   CreateAcpiTablesStub
191     #define USER_PSTATE_OPTION_GATHER PStateGatherStub
192     #define USER_PSTATE_OPTION_LEVEL  PStateLevelingStub
193     #define USER_PSTATE_CFG_PPC    FALSE
194     #define USER_PSTATE_CFG_PCT    FALSE
195     #define USER_PSTATE_CFG_PSD    FALSE
196     #define USER_PSTATE_CFG_PSS    FALSE
197     #define USER_PSTATE_CFG_XPSS   FALSE
198
199     // If ACPI Objects are disabled for PStates, we still need to check
200     // whether ACPI Objects are enabled for CStates
201     #if OPTION_IO_CSTATE == TRUE
202       OPTION_SSDT_FEATURE               GenerateSsdt;
203       OPTION_PSTATE_GATHER              PStateGatherMain;
204       OPTION_ACPI_FEATURE               CreateCStateAcpiTables;
205       #undef  USER_SSDT_MAIN
206       #define USER_SSDT_MAIN            GenerateSsdt
207       #undef  USER_PSTATE_OPTION_GATHER
208       #define USER_PSTATE_OPTION_GATHER PStateGatherMain
209       #undef  USER_CSTATE_OPTION_MAIN
210       #define USER_CSTATE_OPTION_MAIN   CreateCStateAcpiTables
211     #endif
212   #endif
213 #else
214   OPTION_SSDT_FEATURE               GenerateSsdtStub;
215   OPTION_ACPI_FEATURE               CreateAcpiTablesStub;
216   OPTION_PSTATE_GATHER              PStateGatherStub;
217   OPTION_PSTATE_LEVELING            PStateLevelingStub;
218   #define USER_SSDT_MAIN            GenerateSsdtStub
219   #define USER_PSTATE_OPTION_MAIN   CreateAcpiTablesStub
220   #define USER_CSTATE_OPTION_MAIN   CreateAcpiTablesStub
221   #define USER_PSTATE_OPTION_GATHER PStateGatherStub
222   #define USER_PSTATE_OPTION_LEVEL  PStateLevelingStub
223   #define USER_PSTATE_CFG_PPC    FALSE
224   #define USER_PSTATE_CFG_PCT    FALSE
225   #define USER_PSTATE_CFG_PSD    FALSE
226   #define USER_PSTATE_CFG_PSS    FALSE
227   #define USER_PSTATE_CFG_XPSS   FALSE
228 #endif
229
230 /*  Declare the instance of the PSTATE option configuration structure  */
231 OPTION_PSTATE_POST_CONFIGURATION      OptionPstatePostConfiguration = {
232   PSTATE_STRUCT_VERSION,
233   USER_PSTATE_OPTION_GATHER,
234   USER_PSTATE_OPTION_LEVEL
235 };
236
237 OPTION_PSTATE_LATE_CONFIGURATION      OptionPstateLateConfiguration = {
238   PSTATE_STRUCT_VERSION,
239   USER_SSDT_MAIN,
240   USER_PSTATE_OPTION_MAIN,
241   USER_CSTATE_OPTION_MAIN,
242   USER_PSTATE_CFG_PPC,
243   USER_PSTATE_CFG_PCT,
244   USER_PSTATE_CFG_PSD,
245   USER_PSTATE_CFG_PSS,
246   USER_PSTATE_CFG_XPSS
247 };
248
249 CONST CPU_SPECIFIC_SERVICES_XLAT ROMDATA PstateCpuFamilyServiceArray[] =
250 {
251   F10_PSTATE_SERVICE_SUPPORT
252   F12_PSTATE_SERVICE_SUPPORT
253   F14_PSTATE_SERVICE_SUPPORT
254   F15_OR_PSTATE_SERVICE_SUPPORT
255   F15_TN_PSTATE_SERVICE_SUPPORT
256   F15_KM_PSTATE_SERVICE_SUPPORT
257   {0, NULL}
258 };
259 CONST CPU_FAMILY_SUPPORT_TABLE ROMDATA PstateFamilyServiceTable =
260 {
261   (sizeof (PstateCpuFamilyServiceArray) / sizeof (CPU_SPECIFIC_SERVICES_XLAT)),
262   &PstateCpuFamilyServiceArray[0]
263 };
264 #endif  // _OPTION_PSTATE_INSTALL_H_