5 * AMD CPU L3 Features Initialization functions.
7 * Contains code that declares the AGESA CPU L3 dependent feature related APIs
9 * @xrefitem bom "File Content Label" "Release Content"
11 * @e sub-project: CPU/Feature
12 * @e \$Revision: 60552 $ @e \$Date: 2011-10-17 18:50:55 -0600 (Mon, 17 Oct 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_L3_FEATURES_H_
47 #define _CPU_L3_FEATIRES_H_
50 /*----------------------------------------------------------------------------------------
51 * M I X E D (Definitions And Macros / Typedefs, Structures, Enums)
52 *----------------------------------------------------------------------------------------
54 // Forward declaration needed for multi-structure mutual references
55 AGESA_FORWARD_DECLARATION (L3_FEATURE_FAMILY_SERVICES);
57 /*----------------------------------------------------------------------------------------
58 * D E F I N I T I O N S A N D M A C R O S
59 *----------------------------------------------------------------------------------------
61 #define AP_LATE_TASK_DISABLE_CACHE (0x00000000 | PROC_CPU_FEATURE_CPUL3FEATURES_FILECODE)
62 #define AP_LATE_TASK_ENABLE_CACHE (0x00010000 | PROC_CPU_FEATURE_CPUL3FEATURES_FILECODE)
64 /*----------------------------------------------------------------------------------------
65 * T Y P E D E F S A N D S T R U C T U R E S
66 *----------------------------------------------------------------------------------------
68 #define L3_SCRUBBER_CONTEXT_ARRAY_SIZE 4
70 /*---------------------------------------------------------------------------------------*/
72 * Family specific call to check if L3 Features are supported.
74 * @param[in] L3FeatureServices L3 Feature family services.
75 * @param[in] Socket Processor socket to check.
76 * @param[in] StdHeader Config Handle for library, services.
77 * @param[in] PlatformConfig Contains the runtime modifiable feature input data.
79 * @retval TRUE L3 dependent features are supported
80 * @retval FALSE L3 dependent features are not supported
83 typedef BOOLEAN F_L3_FEATURE_IS_SUPPORTED (
84 IN L3_FEATURE_FAMILY_SERVICES *L3FeatureServices,
86 IN AMD_CONFIG_PARAMS *StdHeader,
87 IN PLATFORM_CONFIGURATION *PlatformConfig
90 /// Reference to a Method.
91 typedef F_L3_FEATURE_IS_SUPPORTED *PF_L3_FEATURE_IS_SUPPORTED;
93 /*---------------------------------------------------------------------------------------*/
95 * Family specific hook before L3 features are initialized.
97 * @param[in] L3FeatureServices L3 Feature family services.
98 * @param[in] Socket Processor socket to check.
99 * @param[in] StdHeader Config Handle for library, services.
102 typedef VOID F_L3_FEATURE_BEFORE_INIT (
103 IN L3_FEATURE_FAMILY_SERVICES *L3FeatureServices,
105 IN AMD_CONFIG_PARAMS *StdHeader
108 /// Reference to a Method.
109 typedef F_L3_FEATURE_BEFORE_INIT *PF_L3_FEATURE_BEFORE_INIT;
111 /*---------------------------------------------------------------------------------------*/
113 * Family specific call to disable cache.
115 * @param[in] L3FeatureServices L3 Feature family services.
116 * @param[in] HtAssistEnabled Indicates whether Ht Assist is enabled.
117 * @param[in] StdHeader Config Handle for library, services.
120 typedef VOID F_L3_FEATURE_DISABLE_CACHE (
121 IN L3_FEATURE_FAMILY_SERVICES *L3FeatureServices,
122 IN BOOLEAN HtAssistEnabled,
123 IN AMD_CONFIG_PARAMS *StdHeader
126 /// Reference to a Method.
127 typedef F_L3_FEATURE_DISABLE_CACHE *PF_L3_FEATURE_DISABLE_CACHE;
129 /*---------------------------------------------------------------------------------------*/
131 * Family specific call to disable cache.
133 * @param[in] L3FeatureServices L3 Feature family services.
134 * @param[in] StdHeader Config Handle for library, services.
136 * @return Family specific error value.
139 typedef VOID F_L3_FEATURE_ENABLE_CACHE (
140 IN L3_FEATURE_FAMILY_SERVICES *L3FeatureServices,
141 IN AMD_CONFIG_PARAMS *StdHeader
144 /// Reference to a Method.
145 typedef F_L3_FEATURE_ENABLE_CACHE *PF_L3_FEATURE_ENABLE_CACHE;
147 /*---------------------------------------------------------------------------------------*/
149 * Family specific call to Initialize L3 Features
151 * @param[in] L3FeatureServices L3 Feature family services.
152 * @param[in] Socket Processor socket to enable.
153 * @param[in] StdHeader Config Handle for library, services.
156 typedef VOID F_L3_FEATURE_INIT (
157 IN L3_FEATURE_FAMILY_SERVICES *L3FeatureServices,
159 IN AMD_CONFIG_PARAMS *StdHeader
162 /// Reference to a Method.
163 typedef F_L3_FEATURE_INIT *PF_L3_FEATURE_INIT;
165 /*---------------------------------------------------------------------------------------*/
167 * Family specific hook after L3 Features are initialized.
169 * @param[in] L3FeatureServices L3 Features family services.
170 * @param[in] Socket Processor socket to check.
171 * @param[in] StdHeader Config Handle for library, services.
174 typedef VOID F_L3_FEATURE_AFTER_INIT (
175 IN L3_FEATURE_FAMILY_SERVICES *L3FeatureServices,
177 IN AMD_CONFIG_PARAMS *StdHeader
180 /// Reference to a Method.
181 typedef F_L3_FEATURE_AFTER_INIT *PF_L3_FEATURE_AFTER_INIT;
183 /*---------------------------------------------------------------------------------------*/
185 * Family specific call to save the L3 scrubber.
187 * @param[in] L3FeatureServices L3 Feature family services.
188 * @param[in] Socket Processor socket to check.
189 * @param[in] ScrubSettings Location to store current L3 scrubber settings.
190 * @param[in] StdHeader Config Handle for library, services.
193 typedef VOID F_L3_FEATURE_GET_L3_SCRUB_CTRL (
194 IN L3_FEATURE_FAMILY_SERVICES *L3FeatureServices,
196 IN UINT32 ScrubSettings[L3_SCRUBBER_CONTEXT_ARRAY_SIZE],
197 IN AMD_CONFIG_PARAMS *StdHeader
200 /// Reference to a Method.
201 typedef F_L3_FEATURE_GET_L3_SCRUB_CTRL *PF_L3_FEATURE_GET_L3_SCRUB_CTRL;
203 /*---------------------------------------------------------------------------------------*/
205 * Family specific call to restore the L3 scrubber.
207 * @param[in] L3FeatureServices L3 Feature family services.
208 * @param[in] Socket Processor socket to check.
209 * @param[in] ScrubSettings Contains L3 scrubber settings to restore.
210 * @param[in] StdHeader Config Handle for library, services.
213 typedef VOID F_L3_FEATURE_SET_L3_SCRUB_CTRL (
214 IN L3_FEATURE_FAMILY_SERVICES *L3FeatureServices,
216 IN UINT32 ScrubSettings[L3_SCRUBBER_CONTEXT_ARRAY_SIZE],
217 IN AMD_CONFIG_PARAMS *StdHeader
220 /// Reference to a Method.
221 typedef F_L3_FEATURE_SET_L3_SCRUB_CTRL *PF_L3_FEATURE_SET_L3_SCRUB_CTRL;
223 /*---------------------------------------------------------------------------------------*/
225 * Family specific call to check if HT Assist is supported.
227 * @param[in] L3FeatureServices L3 Feature family services.
228 * @param[in] PlatformConfig Contains the runtime modifiable feature input data
229 * @param[in] StdHeader Config Handle for library, services.
231 * @retval TRUE HT Assist is supported.
232 * @retval FALSE HT Assist is not supported.
235 typedef BOOLEAN F_HT_ASSIST_IS_SUPPORTED (
236 IN L3_FEATURE_FAMILY_SERVICES *L3FeatureServices,
237 IN PLATFORM_CONFIGURATION *PlatformConfig,
238 IN AMD_CONFIG_PARAMS *StdHeader
241 /// Reference to a Method.
242 typedef F_HT_ASSIST_IS_SUPPORTED *PF_HT_ASSIST_IS_SUPPORTED;
244 /*---------------------------------------------------------------------------------------*/
246 * Family specific call to Initialize HT Assist
248 * @param[in] L3FeatureServices L3 Features family services.
249 * @param[in] Socket Processor socket to enable.
250 * @param[in] StdHeader Config Handle for library, services.
253 typedef VOID F_HT_ASSIST_INIT (
254 IN L3_FEATURE_FAMILY_SERVICES *L3FeatureServices,
256 IN AMD_CONFIG_PARAMS *StdHeader
259 /// Reference to a Method.
260 typedef F_HT_ASSIST_INIT *PF_HT_ASSIST_INIT;
262 /*---------------------------------------------------------------------------------------*/
264 * Family specific call to provide non_optimal HT Assist support
266 * @param[in] L3FeatureServices L3 Feature family services.
267 * @param[in] Socket Processor socket to check.
268 * @param[in] StdHeader Config Handle for library, services.
270 * @return TRUE The system may be running with non-optimal settings.
271 * @return FALSE The system may is running optimally.
274 typedef BOOLEAN F_HT_ASSIST_IS_NONOPTIMAL (
275 IN L3_FEATURE_FAMILY_SERVICES *L3FeatureServices,
277 IN AMD_CONFIG_PARAMS *StdHeader
280 /// Reference to a Method.
281 typedef F_HT_ASSIST_IS_NONOPTIMAL *PF_HT_ASSIST_IS_NONOPTIMAL;
283 /*---------------------------------------------------------------------------------------*/
285 * Family specific call to check if ATM Mode is supported.
287 * @param[in] L3FeatureServices L3 Features family services.
288 * @param[in] PlatformConfig Contains the runtime modifiable feature input data.
289 * @param[in] StdHeader Config Handle for library, services.
291 * @retval TRUE ATM Mode is supported.
292 * @retval FALSE ATM Mode is not supported.
295 typedef BOOLEAN F_ATM_MODE_IS_SUPPORTED (
296 IN L3_FEATURE_FAMILY_SERVICES *L3FeatureServices,
297 IN PLATFORM_CONFIGURATION *PlatformConfig,
298 IN AMD_CONFIG_PARAMS *StdHeader
301 /// Reference to a Method.
302 typedef F_ATM_MODE_IS_SUPPORTED *PF_ATM_MODE_IS_SUPPORTED;
304 /*---------------------------------------------------------------------------------------*/
306 * Family specific call to Initialize ATM mode
308 * @param[in] L3FeatureServices L3 Features family services.
309 * @param[in] Socket Processor socket to enable.
310 * @param[in] StdHeader Config Handle for library, services.
313 typedef VOID F_ATM_MODE_INIT (
314 IN L3_FEATURE_FAMILY_SERVICES *L3FeatureServices,
316 IN AMD_CONFIG_PARAMS *StdHeader
319 /// Reference to a Method.
320 typedef F_ATM_MODE_INIT *PF_ATM_MODE_INIT;
323 * Provide the interface to the L3 dependent features Family Specific Services.
325 * Use the methods or data in this struct to adapt the feature code to a specific cpu family or model (or stepping!).
326 * Each supported Family must provide an implementation for all methods in this interface, even if the
327 * implementation is a CommonReturn().
329 struct _L3_FEATURE_FAMILY_SERVICES {
330 UINT16 Revision; ///< Interface version
332 PF_L3_FEATURE_IS_SUPPORTED IsL3FeatureSupported; ///< Method: Check if L3 dependent features are supported.
333 PF_L3_FEATURE_GET_L3_SCRUB_CTRL GetL3ScrubCtrl; ///< Method: Save/disable the L3 scrubber.
334 PF_L3_FEATURE_SET_L3_SCRUB_CTRL SetL3ScrubCtrl; ///< Method: Restore the L3 scrubber.
335 PF_L3_FEATURE_BEFORE_INIT HookBeforeInit; ///< Method: Hook before enabling L3 dependent features.
336 PF_L3_FEATURE_AFTER_INIT HookAfterInit; ///< Method: Hook after enabling L3 dependent features.
337 PF_L3_FEATURE_DISABLE_CACHE HookDisableCache; ///< Method: Core hook just before disabling cache.
338 PF_L3_FEATURE_ENABLE_CACHE HookEnableCache; ///< Method: Core hook just after enabling cache.
339 PF_HT_ASSIST_IS_SUPPORTED IsHtAssistSupported; ///< Method: Check if HT Assist is supported.
340 PF_HT_ASSIST_INIT HtAssistInit; ///< Method: Enable HT Assist.
341 PF_HT_ASSIST_IS_NONOPTIMAL IsNonOptimalConfig; ///< Method: Check if HT Assist is running optimally.
342 PF_ATM_MODE_IS_SUPPORTED IsAtmModeSupported; ///< Method: Check if ATM Mode is supported.
343 PF_ATM_MODE_INIT AtmModeInit; ///< Method: Enable ATM Mode.
347 /*----------------------------------------------------------------------------------------
348 * F U N C T I O N S P R O T O T Y P E
349 *----------------------------------------------------------------------------------------
353 IN AP_EXE_PARAMS *ApExeParams
358 IN AP_EXE_PARAMS *ApExeParams
361 #endif // _CPU_L3_FEATURES_H_