Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 1 | /* $NoKeywords:$ */ |
| 2 | /** |
| 3 | * @file |
| 4 | * |
| 5 | * AMD AGESA CPU HT Assist Function declarations. |
| 6 | * |
| 7 | * Contains code that declares the AGESA CPU Probe filter related APIs |
| 8 | * |
| 9 | * @xrefitem bom "File Content Label" "Release Content" |
| 10 | * @e project: AGESA |
| 11 | * @e sub-project: CPU/Feature |
| 12 | * @e \$Revision: 36567 $ @e \$Date: 2010-08-21 02:35:15 +0800 (Sat, 21 Aug 2010) $ |
| 13 | * |
| 14 | */ |
| 15 | /* |
| 16 | ***************************************************************************** |
| 17 | * |
| 18 | * Copyright (c) 2011, Advanced Micro Devices, Inc. |
| 19 | * All rights reserved. |
Edward O'Callaghan | e963b38 | 2014-07-06 19:27:14 +1000 | [diff] [blame] | 20 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 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. |
Edward O'Callaghan | e963b38 | 2014-07-06 19:27:14 +1000 | [diff] [blame] | 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 |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 30 | * from this software without specific prior written permission. |
Edward O'Callaghan | e963b38 | 2014-07-06 19:27:14 +1000 | [diff] [blame] | 31 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 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. |
Edward O'Callaghan | e963b38 | 2014-07-06 19:27:14 +1000 | [diff] [blame] | 42 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 43 | * *************************************************************************** |
| 44 | * |
| 45 | */ |
| 46 | |
| 47 | #ifndef _CPU_HT_ASSIST_H_ |
| 48 | #define _CPU_HT_ASSIST_H_ |
| 49 | |
| 50 | #include "Filecode.h" |
| 51 | /*---------------------------------------------------------------------------------------- |
| 52 | * M I X E D (Definitions And Macros / Typedefs, Structures, Enums) |
| 53 | *---------------------------------------------------------------------------------------- |
| 54 | */ |
| 55 | // Forward declaration needed for multi-structure mutual references |
| 56 | AGESA_FORWARD_DECLARATION (HT_ASSIST_FAMILY_SERVICES); |
| 57 | |
| 58 | /*---------------------------------------------------------------------------------------- |
| 59 | * D E F I N I T I O N S A N D M A C R O S |
| 60 | *---------------------------------------------------------------------------------------- |
| 61 | */ |
| 62 | #define AP_LATE_TASK_DISABLE_CACHE (0x00000000 | PROC_CPU_FEATURE_CPUHTASSIST_FILECODE) |
| 63 | #define AP_LATE_TASK_ENABLE_CACHE (0x00010000 | PROC_CPU_FEATURE_CPUHTASSIST_FILECODE) |
| 64 | |
| 65 | /*---------------------------------------------------------------------------------------- |
| 66 | * T Y P E D E F S A N D S T R U C T U R E S |
| 67 | *---------------------------------------------------------------------------------------- |
| 68 | */ |
| 69 | #define L3_SCRUBBER_CONTEXT_ARRAY_SIZE 4 |
| 70 | |
| 71 | /*---------------------------------------------------------------------------------------*/ |
| 72 | /** |
| 73 | * Family specific call to check if HT Assist is supported. |
| 74 | * |
| 75 | * @param[in] HtAssistServices HT Assist family services. |
| 76 | * @param[in] Socket Processor socket to check. |
| 77 | * @param[in] StdHeader Config Handle for library, services. |
| 78 | * |
| 79 | * @retval TRUE HT Assist is supported. |
| 80 | * @retval FALSE HT Assist is not supported. |
| 81 | * |
| 82 | */ |
| 83 | typedef BOOLEAN F_HT_ASSIST_IS_SUPPORTED ( |
| 84 | IN HT_ASSIST_FAMILY_SERVICES *HtAssistServices, |
| 85 | IN UINT32 Socket, |
| 86 | IN AMD_CONFIG_PARAMS *StdHeader |
| 87 | ); |
| 88 | |
| 89 | /// Reference to a Method. |
| 90 | typedef F_HT_ASSIST_IS_SUPPORTED *PF_HT_ASSIST_IS_SUPPORTED; |
| 91 | |
| 92 | /*---------------------------------------------------------------------------------------*/ |
| 93 | /** |
| 94 | * Family specific hook before HT Assist is initialized. |
| 95 | * |
| 96 | * @param[in] HtAssistServices HT Assist family services. |
| 97 | * @param[in] Socket Processor socket to check. |
| 98 | * @param[in] StdHeader Config Handle for library, services. |
| 99 | * |
| 100 | */ |
| 101 | typedef VOID F_HT_ASSIST_BEFORE_INIT ( |
| 102 | IN HT_ASSIST_FAMILY_SERVICES *HtAssistServices, |
| 103 | IN UINT32 Socket, |
| 104 | IN AMD_CONFIG_PARAMS *StdHeader |
| 105 | ); |
| 106 | |
| 107 | /// Reference to a Method. |
| 108 | typedef F_HT_ASSIST_BEFORE_INIT *PF_HT_ASSIST_BEFORE_INIT; |
| 109 | |
| 110 | /*---------------------------------------------------------------------------------------*/ |
| 111 | /** |
| 112 | * Family specific call to disable cache. |
| 113 | * |
| 114 | * @param[in] HtAssistServices HT Assist family services. |
| 115 | * @param[in] StdHeader Config Handle for library, services. |
| 116 | * |
| 117 | */ |
| 118 | typedef VOID F_HT_ASSIST_DISABLE_CACHE ( |
| 119 | IN HT_ASSIST_FAMILY_SERVICES *HtAssistServices, |
| 120 | IN AMD_CONFIG_PARAMS *StdHeader |
| 121 | ); |
| 122 | |
| 123 | /// Reference to a Method. |
| 124 | typedef F_HT_ASSIST_DISABLE_CACHE *PF_HT_ASSIST_DISABLE_CACHE; |
| 125 | |
| 126 | /*---------------------------------------------------------------------------------------*/ |
| 127 | /** |
| 128 | * Family specific call to disable cache. |
| 129 | * |
| 130 | * @param[in] HtAssistServices HT Assist family services. |
| 131 | * @param[in] StdHeader Config Handle for library, services. |
| 132 | * |
| 133 | * @return Family specific error value. |
| 134 | * |
| 135 | */ |
| 136 | typedef VOID F_HT_ASSIST_ENABLE_CACHE ( |
| 137 | IN HT_ASSIST_FAMILY_SERVICES *HtAssistServices, |
| 138 | IN AMD_CONFIG_PARAMS *StdHeader |
| 139 | ); |
| 140 | |
| 141 | /// Reference to a Method. |
| 142 | typedef F_HT_ASSIST_ENABLE_CACHE *PF_HT_ASSIST_ENABLE_CACHE; |
| 143 | |
| 144 | |
| 145 | /*---------------------------------------------------------------------------------------*/ |
| 146 | /** |
| 147 | * Family specific call to Initialize HT Assist |
| 148 | * |
| 149 | * @param[in] HtAssistServices HT Assist family services. |
| 150 | * @param[in] Socket Processor socket to enable. |
| 151 | * @param[in] StdHeader Config Handle for library, services. |
| 152 | * |
| 153 | */ |
| 154 | typedef VOID F_HT_ASSIST_INIT ( |
| 155 | IN HT_ASSIST_FAMILY_SERVICES *HtAssistServices, |
| 156 | IN UINT32 Socket, |
| 157 | IN AMD_CONFIG_PARAMS *StdHeader |
| 158 | ); |
| 159 | |
| 160 | /// Reference to a Method. |
| 161 | typedef F_HT_ASSIST_INIT *PF_HT_ASSIST_INIT; |
| 162 | |
| 163 | |
| 164 | /*---------------------------------------------------------------------------------------*/ |
| 165 | /** |
| 166 | * Family specific call to Initialize ATM mode |
| 167 | * |
| 168 | * @param[in] HtAssistServices HT Assist family services. |
| 169 | * @param[in] Socket Processor socket to enable. |
| 170 | * @param[in] StdHeader Config Handle for library, services. |
| 171 | * |
| 172 | */ |
| 173 | typedef VOID F_ATM_MODE_INIT ( |
| 174 | IN HT_ASSIST_FAMILY_SERVICES *HtAssistServices, |
| 175 | IN UINT32 Socket, |
| 176 | IN AMD_CONFIG_PARAMS *StdHeader |
| 177 | ); |
| 178 | |
| 179 | /// Reference to a Method. |
| 180 | typedef F_ATM_MODE_INIT *PF_ATM_MODE_INIT; |
| 181 | |
| 182 | |
| 183 | /*---------------------------------------------------------------------------------------*/ |
| 184 | /** |
| 185 | * Family specific hook after HT Assist is initialized. |
| 186 | * |
| 187 | * @param[in] HtAssistServices HT Assist family services. |
| 188 | * @param[in] Socket Processor socket to check. |
| 189 | * @param[in] StdHeader Config Handle for library, services. |
| 190 | * |
| 191 | */ |
| 192 | typedef VOID F_HT_ASSIST_AFTER_INIT ( |
| 193 | IN HT_ASSIST_FAMILY_SERVICES *HtAssistServices, |
| 194 | IN UINT32 Socket, |
| 195 | IN AMD_CONFIG_PARAMS *StdHeader |
| 196 | ); |
| 197 | |
| 198 | /// Reference to a Method. |
| 199 | typedef F_HT_ASSIST_AFTER_INIT *PF_HT_ASSIST_AFTER_INIT; |
| 200 | |
| 201 | /*---------------------------------------------------------------------------------------*/ |
| 202 | /** |
| 203 | * Family specific call to save the L3 scrubber. |
| 204 | * |
| 205 | * @param[in] HtAssistServices HT Assist family services. |
| 206 | * @param[in] Socket Processor socket to check. |
| 207 | * @param[in] ScrubSettings Location to store current L3 scrubber settings. |
| 208 | * @param[in] StdHeader Config Handle for library, services. |
| 209 | * |
| 210 | */ |
| 211 | typedef VOID F_HT_ASSIST_GET_L3_SCRUB_CTRL ( |
| 212 | IN HT_ASSIST_FAMILY_SERVICES *HtAssistServices, |
| 213 | IN UINT32 Socket, |
| 214 | IN UINT32 ScrubSettings[L3_SCRUBBER_CONTEXT_ARRAY_SIZE], |
| 215 | IN AMD_CONFIG_PARAMS *StdHeader |
| 216 | ); |
| 217 | |
| 218 | /// Reference to a Method. |
| 219 | typedef F_HT_ASSIST_GET_L3_SCRUB_CTRL *PF_HT_ASSIST_GET_L3_SCRUB_CTRL; |
| 220 | |
| 221 | /*---------------------------------------------------------------------------------------*/ |
| 222 | /** |
| 223 | * Family specific call to restore the L3 scrubber. |
| 224 | * |
| 225 | * @param[in] HtAssistServices HT Assist family services. |
| 226 | * @param[in] Socket Processor socket to check. |
| 227 | * @param[in] ScrubSettings Contains L3 scrubber settings to restore. |
| 228 | * @param[in] StdHeader Config Handle for library, services. |
| 229 | * |
| 230 | */ |
| 231 | typedef VOID F_HT_ASSIST_SET_L3_SCRUB_CTRL ( |
| 232 | IN HT_ASSIST_FAMILY_SERVICES *HtAssistServices, |
| 233 | IN UINT32 Socket, |
| 234 | IN UINT32 ScrubSettings[L3_SCRUBBER_CONTEXT_ARRAY_SIZE], |
| 235 | IN AMD_CONFIG_PARAMS *StdHeader |
| 236 | ); |
| 237 | |
| 238 | /// Reference to a Method. |
| 239 | typedef F_HT_ASSIST_SET_L3_SCRUB_CTRL *PF_HT_ASSIST_SET_L3_SCRUB_CTRL; |
| 240 | |
| 241 | |
| 242 | /*---------------------------------------------------------------------------------------*/ |
| 243 | /** |
| 244 | * Family specific call to provide non_optimal HT Assist support |
| 245 | * |
| 246 | * @param[in] HtAssistServices HT Assist family services. |
| 247 | * @param[in] Socket Processor socket to check. |
| 248 | * @param[in] StdHeader Config Handle for library, services. |
| 249 | * |
| 250 | * @return TRUE The system may be running with non-optimal settings. |
| 251 | * @return FALSE The system may is running optimally. |
| 252 | * |
| 253 | */ |
| 254 | typedef BOOLEAN F_HT_ASSIST_IS_NONOPTIMAL ( |
| 255 | IN HT_ASSIST_FAMILY_SERVICES *HtAssistServices, |
| 256 | IN UINT32 Socket, |
| 257 | IN AMD_CONFIG_PARAMS *StdHeader |
| 258 | ); |
| 259 | |
| 260 | /// Reference to a Method. |
| 261 | typedef F_HT_ASSIST_IS_NONOPTIMAL *PF_HT_ASSIST_IS_NONOPTIMAL; |
| 262 | |
| 263 | |
| 264 | /** |
| 265 | * Provide the interface to the HT Assist Family Specific Services. |
| 266 | * |
| 267 | * Use the methods or data in this struct to adapt the feature code to a specific cpu family or model (or stepping!). |
| 268 | * Each supported Family must provide an implementation for all methods in this interface, even if the |
| 269 | * implementation is a CommonReturn(). |
| 270 | */ |
| 271 | struct _HT_ASSIST_FAMILY_SERVICES { |
| 272 | UINT16 Revision; ///< Interface version |
| 273 | // Public Methods. |
| 274 | PF_HT_ASSIST_IS_SUPPORTED IsHtAssistSupported; ///< Method: Check if HT Assist is supported. |
| 275 | PF_HT_ASSIST_INIT HtAssistInit; ///< Method: Enable HT Assist. |
| 276 | PF_ATM_MODE_INIT AtmModeInit; ///< Method: Enable ATM Mode |
| 277 | PF_HT_ASSIST_GET_L3_SCRUB_CTRL GetL3ScrubCtrl; ///< Method: Save/disable the L3 scrubber. |
| 278 | PF_HT_ASSIST_SET_L3_SCRUB_CTRL SetL3ScrubCtrl; ///< Method: Restore the L3 scrubber. |
| 279 | PF_HT_ASSIST_BEFORE_INIT HookBeforeInit; ///< Method: Hook before enabling HT Assist. |
| 280 | PF_HT_ASSIST_AFTER_INIT HookAfterInit; ///< Method: Hook after enabling HT Assist. |
| 281 | PF_HT_ASSIST_DISABLE_CACHE HookDisableCache; ///< Method: Core hook just before disabling cache. |
| 282 | PF_HT_ASSIST_ENABLE_CACHE HookEnableCache; ///< Method: Core hook just after enabling cache. |
| 283 | PF_HT_ASSIST_IS_NONOPTIMAL IsNonOptimalConfig; ///< Method: Check if HT Assist is running optimally. |
| 284 | }; |
| 285 | |
| 286 | |
| 287 | /*---------------------------------------------------------------------------------------- |
| 288 | * F U N C T I O N S P R O T O T Y P E |
| 289 | *---------------------------------------------------------------------------------------- |
| 290 | */ |
| 291 | AGESA_STATUS |
| 292 | DisableAllCaches ( |
| 293 | IN AP_EXE_PARAMS *ApExeParams |
| 294 | ); |
| 295 | |
| 296 | AGESA_STATUS |
| 297 | EnableAllCaches ( |
| 298 | IN AP_EXE_PARAMS *ApExeParams |
| 299 | ); |
| 300 | |
| 301 | #endif // _CPU_HT_ASSIST_H_ |