5 * AMD AGESA CPU Pstate Table Functions declarations.
7 * Contains code that declares the AGESA CPU _PSS related APIs
9 * @xrefitem bom "File Content Label" "Release Content"
11 * @e sub-project: CPU/Feature
12 * @e \$Revision: 44702 $ @e \$Date: 2011-01-04 15:54:00 -0700 (Tue, 04 Jan 2011) $
16 ******************************************************************************
18 * Copyright (C) 2012 Advanced Micro Devices, Inc.
19 * All rights reserved.
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.
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.
43 ******************************************************************************
46 #ifndef _CPU_PSTATE_TABLES_H_
47 #define _CPU_PSTATE_TABLES_H_
49 /*----------------------------------------------------------------------------------------
50 * M I X E D (Definitions And Macros / Typedefs, Structures, Enums)
51 *----------------------------------------------------------------------------------------
53 // Forward declaration needed for multi-structure mutual references
54 AGESA_FORWARD_DECLARATION (PSTATE_CPU_FAMILY_SERVICES);
56 /*----------------------------------------------------------------------------------------
57 * D E F I N I T I O N S A N D M A C R O S
58 *----------------------------------------------------------------------------------------
61 /*----------------------------------------------------------------------------------------
62 * T Y P E D E F S A N D S T R U C T U R E S
63 *----------------------------------------------------------------------------------------
65 /// P-state structure for each state
67 IN OUT UINT32 PStateEnable; ///< Pstate enable
68 IN OUT UINT32 CoreFreq; ///< MHz
69 IN OUT UINT32 Power; ///< milliWatts
70 IN OUT UINT32 IddValue; ///< Current value field
71 IN OUT UINT32 IddDiv; ///< Current divisor field
72 IN OUT UINT32 SwPstateNumber; ///< Software P-state number
75 /// P-state structure for each core
77 IN OUT UINT8 PStateMaxValue; ///< Max p-state number in this core
78 IN OUT UINT8 HtcPstateLimit; ///< Htc limit
79 IN OUT UINT8 HtcCapable; ///< Htc capable
80 IN OUT UINT8 LocalApicId; ///< Local Apic Id
81 IN OUT UINT8 NumberOfBoostedStates; ///< Number of boost P-states
82 IN OUT S_PSTATE_VALUES PStateStruct[1]; ///< P state struc
85 /// P-state structure for each node
87 IN UINT8 SetPState0; ///< If value = 0x55 (Don't set PState0)
88 IN UINT8 TotalCoresInNode; ///< core number per node
89 IN UINT16 PStateLevelingSizeOfBytes; ///< Size
90 IN BOOLEAN OnlyOneEnabledPState; ///< Only P0
91 IN UINT8 InitStruct; ///< Init struc
92 IN BOOLEAN AllCpusHaveIdenticalPStates; ///< Have Identical p state
93 IN UINT8 CreateAcpiTables; ///< Create table flag
94 IN UINT8 SocketNumber; ///< Physical socket number of this socket
95 IN UINT8 Reserved[2]; ///< Reserved.
96 IN OUT S_PSTATE PStateCoreStruct[1]; ///< P state core struc
99 /// P-state structure for whole system
101 IN OUT UINT32 TotalSocketInSystem; ///< Total node number in system
102 IN OUT UINT32 SizeOfBytes; ///< Structure size
103 IN OUT PSTATE_LEVELING PStateLevelingStruc[1]; ///< P state level structure
106 /*---------------------------------------------------------------------------------------*/
108 * Family specific call to check if PSD need to be generated.
110 * @param[in] PstateCpuFamilyServices Pstate CPU services.
111 * @param[in,out] PlatformConfig Contains the runtime modifiable feature input data.
112 * @param[in] StdHeader Config Handle for library, services.
114 * @retval TRUE PSD need to be generated
115 * @retval FALSE PSD does NOT need to be generated
118 typedef BOOLEAN F_PSTATE_PSD_IS_NEEDED (
119 IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices,
120 IN OUT PLATFORM_CONFIGURATION *PlatformConfig,
121 IN AMD_CONFIG_PARAMS *StdHeader
124 /// Reference to a Method.
125 typedef F_PSTATE_PSD_IS_NEEDED *PF_PSTATE_PSD_IS_NEEDED;
128 /*---------------------------------------------------------------------------------------*/
130 * Family specific call to check if Pstate PSD is dependent.
132 * @param[in] PstateCpuFamilyServices Pstate CPU services.
133 * @param[in,out] PlatformConfig Contains the runtime modifiable feature input data.
134 * @param[in] StdHeader Config Handle for library, services.
136 * @retval TRUE PSD is dependent.
137 * @retval FALSE PSD is independent.
140 typedef BOOLEAN F_PSTATE_PSD_IS_DEPENDENT (
141 IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices,
142 IN OUT PLATFORM_CONFIGURATION *PlatformConfig,
143 IN AMD_CONFIG_PARAMS *StdHeader
146 /// Reference to a Method.
147 typedef F_PSTATE_PSD_IS_DEPENDENT *PF_PSTATE_PSD_IS_DEPENDENT;
150 * Family specific call to set core TscFreqSel.
152 * @param[in] PstateCpuFamilyServices Pstate CPU services.
153 * @param[in] StdHeader Config Handle for library, services.
156 typedef VOID F_PSTATE_SET_TSC_FREQ_SEL (
157 IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices,
158 IN AMD_CONFIG_PARAMS *StdHeader
161 /// Reference to a Method.
162 typedef F_PSTATE_SET_TSC_FREQ_SEL *PF_PSTATE_SET_TSC_FREQ_SEL;
165 * Family specific call to get CPU pstate transition latency for current socket.
167 * @param[in] PstateCpuFamilyServices Pstate CPU services.
168 * @param[in] PStateLevelingBufferStructPtr Pstate row data buffer pointer.
169 * @param[in] PciAddress Pci address struct.
170 * @param[out] TransitionLatency Pstate Transition latency result.
171 * @param[in] StdHeader Handle of Header for calling lib functions and services.
174 typedef AGESA_STATUS F_CPU_PSTATE_TRANSITION_LATENCY (
175 IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices,
176 IN PSTATE_LEVELING *PStateLevelingBufferStructPtr,
177 IN PCI_ADDR *PciAddress,
178 OUT UINT32 *TransitionLatency,
179 IN AMD_CONFIG_PARAMS *StdHeader
182 /// Reference to a Method.
183 typedef F_CPU_PSTATE_TRANSITION_LATENCY *PF_CPU_PSTATE_TRANSITION_LATENCY;
186 * Family specific call to get the desired P-state's frequency in megahertz.
188 * @param[in] PstateCpuFamilyServices Pstate CPU services.
189 * @param[in] StateNumber P-state number.
190 * @param[out] PowerInMw P-state frequency in megahertz.
191 * @param[in] StdHeader Handle of Header for calling lib functions and services.
194 typedef AGESA_STATUS F_CPU_GET_PSTATE_FREQ (
195 IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices,
196 IN UINT8 StateNumber,
197 OUT UINT32 *FreqInMHz,
198 IN AMD_CONFIG_PARAMS *StdHeader
201 /// Reference to a Method.
202 typedef F_CPU_GET_PSTATE_FREQ *PF_CPU_GET_PSTATE_FREQ;
205 * Family specific call to set the system wide P-state settings on the current core.
207 * @param[in] PstateCpuFamilyServices Pstate CPU services.
208 * @param[in] CpuAmdPState The current core's P-state data.
209 * @param[in] StdHeader Handle of Header for calling lib functions and services.
212 typedef AGESA_STATUS F_CPU_SET_PSTATE_LEVELING_REG (
213 IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices,
214 IN S_CPU_AMD_PSTATE *CpuAmdPState,
215 IN AMD_CONFIG_PARAMS *StdHeader
218 /// Reference to a Method.
219 typedef F_CPU_SET_PSTATE_LEVELING_REG *PF_CPU_SET_PSTATE_LEVELING_REG;
222 * Family specific call to get the desired P-state's rated power in milliwatts.
224 * @param[in] PstateCpuFamilyServices Pstate CPU services.
225 * @param[in] StateNumber P-state number.
226 * @param[out] PowerInMw P-state power in milliwatts.
227 * @param[in] StdHeader Handle of Header for calling lib functions and services.
230 typedef AGESA_STATUS F_CPU_GET_PSTATE_POWER (
231 IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices,
232 IN UINT8 StateNumber,
233 OUT UINT32 *PowerInMw,
234 IN AMD_CONFIG_PARAMS *StdHeader
237 /// Reference to a Method.
238 typedef F_CPU_GET_PSTATE_POWER *PF_CPU_GET_PSTATE_POWER;
241 * Family specific call to get CPU Pstate Max State.
243 * @param[in] PstateCpuFamilyServices Pstate CPU services.
244 * @param[out] MaxPStateNumber The max hw pstate value on the current socket.
245 * @param[out] NumberOfBoostStates The number of boosted P-states on the current socket.
246 * @param[in] StdHeader Handle of Header for calling lib functions and services.
249 typedef AGESA_STATUS F_CPU_GET_PSTATE_MAX_STATE (
250 IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices,
251 OUT UINT32 *MaxPStateNumber,
252 OUT UINT8 *NumberOfBoostStates,
253 IN AMD_CONFIG_PARAMS *StdHeader
256 /// Reference to a Method.
257 typedef F_CPU_GET_PSTATE_MAX_STATE *PF_CPU_GET_PSTATE_MAX_STATE;
260 * Family specific call to get CPU pstate register information.
262 * @param[in] PstateCpuFamilyServices Pstate CPU services.
263 * @param[in] PState Input hardware Pstate number for query.
264 * @param[out] PStateEnabled Boolean flag return pstate enable.
265 * @param[in,out] IddVal Pstate current value.
266 * @param[in,out] IddDiv Pstate current divisor.
267 * @param[out] SwPstateNumber Software P-state number.
268 * @param[in] StdHeader Handle of Header for calling lib functions and services.
271 typedef AGESA_STATUS F_CPU_GET_PSTATE_REGISTER_INFO (
272 IN PSTATE_CPU_FAMILY_SERVICES *PstateCpuServices,
274 OUT BOOLEAN *PStateEnabled,
275 IN OUT UINT32 *IddVal,
276 IN OUT UINT32 *IddDiv,
277 OUT UINT32 *SwPstateNumber,
278 IN AMD_CONFIG_PARAMS *StdHeader
281 /// Reference to a Method.
282 typedef F_CPU_GET_PSTATE_REGISTER_INFO *PF_CPU_GET_PSTATE_REGISTER_INFO;
285 * Provide the interface to the Pstate dependent Family Specific Services.
287 * Use the methods or data in this struct to adapt the feature code to a specific cpu family or model (or stepping!).
288 * Each supported Family must provide an implementation for all methods in this interface, even if the
289 * implementation is a CommonReturn().
291 struct _PSTATE_CPU_FAMILY_SERVICES {
292 UINT16 Revision; ///< Interface version
294 PF_PSTATE_PSD_IS_NEEDED IsPstatePsdNeeded; ///< Method: Family specific call to check if PSD need to be generated.
295 PF_PSTATE_PSD_IS_DEPENDENT IsPstatePsdDependent; ///< Method: Family specific call to check if PSD is dependent.
296 PF_PSTATE_SET_TSC_FREQ_SEL CpuSetTscFreqSel; ///< Method: Family specific call to set core TscFreqSel.
297 PF_CPU_PSTATE_TRANSITION_LATENCY GetPstateLatency; ///< Method: Family specific call to get pstate transition latency.
298 PF_CPU_GET_PSTATE_FREQ GetPstateFrequency; ///< Method: Family specific call to get the desired P-state's frequency in megahertz.
299 PF_CPU_SET_PSTATE_LEVELING_REG SetPStateLevelReg; ///< Method: Family specific call to set the system wide P-state settings on the current core.
300 PF_CPU_GET_PSTATE_POWER GetPstatePower; ///< Method: Family specific call to get the desired P-state's rated power in milliwatts.
301 PF_CPU_GET_PSTATE_MAX_STATE GetPstateMaxState; ///< Method: Family specific call to get pstate max state number.
302 PF_CPU_GET_PSTATE_REGISTER_INFO GetPstateRegisterInfo; ///< Method: Family specific call to get pstate register information.
306 /*----------------------------------------------------------------------------------------
307 * F U N C T I O N S P R O T O T Y P E
308 *----------------------------------------------------------------------------------------
312 IN PLATFORM_CONFIGURATION *PlatformConfig,
313 IN OUT S_CPU_AMD_PSTATE *PStateStrucPtr,
314 IN AMD_CONFIG_PARAMS *StdHeader
319 IN OUT S_CPU_AMD_PSTATE *PStateStrucPtr,
320 IN AMD_CONFIG_PARAMS *StdHeader
324 CpuGetPStateLevelStructure (
325 OUT PSTATE_LEVELING **PStateBufferPtr,
326 IN S_CPU_AMD_PSTATE *CpuAmdPState,
327 IN UINT32 LogicalSocketNumber,
328 IN AMD_CONFIG_PARAMS *StdHeader
331 #endif // _CPU_PSTATE_TABLES_H_