zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 1 | /* $NoKeywords:$ */ |
| 2 | /** |
| 3 | * @file |
| 4 | * |
| 5 | * AMD CPU Family Translation functions. |
| 6 | * |
| 7 | * |
| 8 | * @xrefitem bom "File Content Label" "Release Content" |
| 9 | * @e project: AGESA |
| 10 | * @e sub-project: CPU |
| 11 | * @e \$Revision: 63425 $ @e \$Date: 2011-12-22 11:24:10 -0600 (Thu, 22 Dec 2011) $ |
| 12 | * |
| 13 | */ |
| 14 | /* |
| 15 | ****************************************************************************** |
| 16 | * |
Siyuan Wang | 641f00c | 2013-06-08 11:50:55 +0800 | [diff] [blame] | 17 | * Copyright (c) 2008 - 2012, Advanced Micro Devices, Inc. |
| 18 | * All rights reserved. |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 19 | * |
Siyuan Wang | 641f00c | 2013-06-08 11:50:55 +0800 | [diff] [blame] | 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. |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 30 | * |
Siyuan Wang | 641f00c | 2013-06-08 11:50:55 +0800 | [diff] [blame] | 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. |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 41 | ****************************************************************************** |
| 42 | */ |
| 43 | |
| 44 | #ifndef _CPU_FAMILY_TRANSLATION_H_ |
| 45 | #define _CPU_FAMILY_TRANSLATION_H_ |
| 46 | |
| 47 | /** |
| 48 | * @page cpuimplfss CPU Family Specific Services Implementation Guide |
| 49 | * |
| 50 | * CPU Family Specific Services provides access to supported family service functions and data, |
| 51 | * in a manner that isolates calling code from knowledge about particular families or which |
| 52 | * families are supported in the current build. |
| 53 | * |
| 54 | * @par Adding a Method to Family Specific Services |
| 55 | * |
| 56 | * To add a new method to Family Specific Services, follow these steps. |
| 57 | * <ul> |
| 58 | * <li> Create a typedef for the Method with the correct parameters and return type. |
| 59 | * |
| 60 | * <ul> |
| 61 | * <li> Name the method typedef (*PF_METHOD_NAME)(), where METHOD_NAME is the same name as the method table item, |
| 62 | * but with "_"'s and UPPERCASE, rather than mixed case. |
| 63 | * @n <tt> typedef VOID (*PF_METHOD_NAME)(); </tt> @n |
| 64 | * |
| 65 | * <li> [Optionally make the type F_<name> and provide a separate: |
| 66 | * @n <tt> typedef F_METHOD_NAME *PF_METHOD_NAME> </tt> @n |
| 67 | * and provide a single line "///" doxygen comment brief description on the PF_ type.] |
| 68 | * </ul> |
| 69 | * |
| 70 | * <li> The first parameter to @b all Family Specific Service Methods is @b required to be a reference to |
| 71 | * their Family Service struct. |
| 72 | * @n <tt> IN CPU_SPECIFIC_SERVICES *FamilySpecificServices </tt> @n |
| 73 | * |
| 74 | * <li> Provide a standard doxygen function preamble for the Method typedef. Begin the |
| 75 | * detailed description by provide a reference to the method instances page by including |
| 76 | * the lines below: |
| 77 | * @code |
| 78 | * * |
| 79 | * * @CpuServiceInstances |
| 80 | * * |
| 81 | * @endcode |
| 82 | * @note It is important to provide documentation for the method type, because the method may not |
| 83 | * have an implementation in any families supported by the current package. @n |
| 84 | * |
| 85 | * <li> Add to the CPU_SPECIFIC_SERVICES struct an item for the Method: |
| 86 | * @n <tt> PF_METHOD_NAME MethodName; ///< Method: description. </tt> @n |
| 87 | * </ul> |
| 88 | * |
| 89 | * @par Implementing a Family Specific Instance of the method. |
| 90 | * |
| 91 | * To implement an instance of a method for a specific family follow these steps. |
| 92 | * |
| 93 | * - In appropriate files in the family specific directory, implement the method with the return type |
| 94 | * and parameters matching the method typedef. |
| 95 | * |
| 96 | * - Name the function FnnMethodName(), where nn is the family number. |
| 97 | * |
| 98 | * - Create a doxygen function preamble for the method instance. Begin the detailed description with |
| 99 | * an Implements command to reference the method type and add this instance to the Method Instances page. |
| 100 | * @code |
| 101 | * * |
| 102 | * * @CpuServiceMethod{::F_METHOD_NAME}. |
| 103 | * * |
| 104 | * @endcode |
| 105 | * |
| 106 | * - To access other family specific services as part of the method implementation, the function |
| 107 | * @b must use FamilySpecificServices->OtherMethod(). Do not directly call other family specific |
| 108 | * routines, because in the table there may be overrides or this routine may be shared by multiple families. |
| 109 | * |
| 110 | * - Do @b not call Family translation services from a family specific instance. Use the parameter. |
| 111 | * |
| 112 | * - Add the instance to the family specific CPU_SPECIFIC_SERVICES instance. |
| 113 | * |
| 114 | * - If a family does not need an instance of the method use one of the CommonReturns from |
| 115 | * CommonReturns.h with the same return type. |
| 116 | * |
| 117 | * @par Invoking Family Specific Services. |
| 118 | * |
| 119 | * The following example shows how to invoke a family specific method. |
| 120 | * @n @code |
| 121 | * CPU_SPECIFIC_SERVICES *FamilyServices; |
| 122 | * |
| 123 | * GetCpuServicesOfCurrentCore (&FamilyServices, StdHeader); |
| 124 | * ASSERT (FamilyServices != NULL); |
| 125 | * FamilyServices->MethodName (FamilyServices, StdHeader); |
| 126 | * @endcode |
| 127 | * |
| 128 | */ |
| 129 | |
| 130 | |
| 131 | /*--------------------------------------------------------------------------------------- |
| 132 | * M I X E D (Definitions And Macros / Typedefs, Structures, Enums) |
| 133 | *--------------------------------------------------------------------------------------- |
| 134 | */ |
| 135 | #include "cpuPostInit.h" |
| 136 | #include "cpuEnvInit.h" |
| 137 | #include "cpuRegisters.h" |
| 138 | #include "cpuServices.h" |
| 139 | #include "Table.h" |
| 140 | #include "Ids.h" |
| 141 | #include "Topology.h" |
| 142 | |
| 143 | // Forward declaration needed for multi-structure mutual references. |
| 144 | AGESA_FORWARD_DECLARATION (CPU_SPECIFIC_SERVICES); |
| 145 | /*--------------------------------------------------------------------------------------- |
| 146 | * D E F I N I T I O N S A N D M A C R O S |
| 147 | *--------------------------------------------------------------------------------------- |
| 148 | */ |
| 149 | |
| 150 | /*--------------------------------------------------------------------------------------- |
| 151 | * T Y P E D E F S, S T R U C T U R E S, E N U M S |
| 152 | *--------------------------------------------------------------------------------------- |
| 153 | */ |
| 154 | |
| 155 | /** |
| 156 | * Disable the desired P-state. |
| 157 | * |
| 158 | * @CpuServiceInstances |
| 159 | * |
| 160 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 161 | * @param[in] StateNumber Hardware P-state number. |
| 162 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 163 | * |
| 164 | */ |
| 165 | typedef AGESA_STATUS F_CPU_DISABLE_PSTATE ( |
| 166 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 167 | IN UINT8 StateNumber, |
| 168 | IN AMD_CONFIG_PARAMS *StdHeader |
| 169 | ); |
| 170 | |
| 171 | /// Reference to a Method. |
| 172 | typedef F_CPU_DISABLE_PSTATE *PF_CPU_DISABLE_PSTATE; |
| 173 | |
| 174 | /** |
| 175 | * Transition the current core to the desired P-state. |
| 176 | * |
| 177 | * @CpuServiceInstances |
| 178 | * |
| 179 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 180 | * @param[in] StateNumber Software P-state number. |
| 181 | * @param[in] WaitForChange Wait/don't wait for P-state change to complete. |
| 182 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 183 | * |
| 184 | */ |
| 185 | typedef AGESA_STATUS F_CPU_TRANSITION_PSTATE ( |
| 186 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 187 | IN UINT8 StateNumber, |
| 188 | IN BOOLEAN WaitForChange, |
| 189 | IN AMD_CONFIG_PARAMS *StdHeader |
| 190 | ); |
| 191 | |
| 192 | /// Reference to a Method. |
| 193 | typedef F_CPU_TRANSITION_PSTATE *PF_CPU_TRANSITION_PSTATE; |
| 194 | |
| 195 | /** |
| 196 | * Get the desired P-state's maximum current required in milliamps. |
| 197 | * |
| 198 | * @CpuServiceInstances |
| 199 | * |
| 200 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 201 | * @param[in] StateNumber The desired hardware P-state number. |
| 202 | * @param[out] ProcIddMax The P-state's maximum current. |
| 203 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 204 | * |
| 205 | * @retval TRUE The P-state is enabled, and ProcIddMax is valid. |
| 206 | * @retval FALSE The P-state is disabled. |
| 207 | * |
| 208 | */ |
| 209 | typedef BOOLEAN F_CPU_GET_IDD_MAX ( |
| 210 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 211 | IN UINT8 StateNumber, |
| 212 | OUT UINT32 *ProcIddMax, |
| 213 | IN AMD_CONFIG_PARAMS *StdHeader |
| 214 | ); |
| 215 | |
| 216 | /// Reference to a Method. |
| 217 | typedef F_CPU_GET_IDD_MAX *PF_CPU_GET_IDD_MAX; |
| 218 | |
| 219 | |
| 220 | /** |
| 221 | * Returns the rate at which the current core's timestamp counter increments in megahertz. |
| 222 | * |
| 223 | * @CpuServiceInstances |
| 224 | * |
| 225 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 226 | * @param[out] FreqInMHz The rate at which the TSC increments in megahertz. |
| 227 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 228 | * |
| 229 | */ |
| 230 | typedef AGESA_STATUS F_CPU_GET_TSC_RATE ( |
| 231 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 232 | OUT UINT32 *FreqInMHz, |
| 233 | IN AMD_CONFIG_PARAMS *StdHeader |
| 234 | ); |
| 235 | |
| 236 | /// Reference to a Method. |
| 237 | typedef F_CPU_GET_TSC_RATE *PF_CPU_GET_TSC_RATE; |
| 238 | |
| 239 | /** |
| 240 | * Returns the processor north bridge's clock rate in megahertz. |
| 241 | * |
| 242 | * @CpuServiceInstances |
| 243 | * |
| 244 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 245 | * @param[out] FreqInMHz The desired node's frequency in megahertz. |
| 246 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 247 | * |
| 248 | * @retval AGESA_SUCCESS FreqInMHz is valid. |
| 249 | */ |
| 250 | typedef AGESA_STATUS F_CPU_GET_NB_FREQ ( |
| 251 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 252 | OUT UINT32 *FreqInMHz, |
| 253 | IN AMD_CONFIG_PARAMS *StdHeader |
| 254 | ); |
| 255 | |
| 256 | /// Reference to a Method. |
| 257 | typedef F_CPU_GET_NB_FREQ *PF_CPU_GET_NB_FREQ; |
| 258 | |
| 259 | /** |
| 260 | * Returns the node's minimum and maximum northbridge frequency. |
| 261 | * |
| 262 | * @CpuServiceInstances |
| 263 | * |
| 264 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 265 | * @param[in] PlatformConfig Platform profile/build option config structure. |
| 266 | * @param[in] PciAddress The segment, bus, and device numbers of the CPU in question. |
| 267 | * @param[out] MinFreqInMHz The minimum north bridge frequency. |
| 268 | * @param[out] MaxFreqInMHz The maximum north bridge frequency. |
| 269 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 270 | * |
| 271 | * @retval AGESA_STATUS Northbridge frequency is valid |
| 272 | */ |
| 273 | typedef AGESA_STATUS F_CPU_GET_MIN_MAX_NB_FREQ ( |
| 274 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 275 | IN PLATFORM_CONFIGURATION *PlatformConfig, |
| 276 | IN PCI_ADDR *PciAddress, |
| 277 | OUT UINT32 *MinFreqInMHz, |
| 278 | OUT UINT32 *MaxFreqInMHz, |
| 279 | IN AMD_CONFIG_PARAMS *StdHeader |
| 280 | ); |
| 281 | |
| 282 | /// Reference to a Method. |
| 283 | typedef F_CPU_GET_MIN_MAX_NB_FREQ *PF_CPU_GET_MIN_MAX_NB_FREQ; |
| 284 | |
| 285 | /** |
| 286 | * Returns the processor north bridge's P-state settings. |
| 287 | * |
| 288 | * @CpuServiceInstances |
| 289 | * |
| 290 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 291 | * @param[in] PlatformConfig Platform profile/build option config structure. |
| 292 | * @param[in] PciAddress The segment, bus, and device numbers of the CPU in question. |
| 293 | * @param[in] NbPstate The NB P-state number to check. |
| 294 | * @param[out] FreqNumeratorInMHz The desired node's frequency numerator in megahertz. |
| 295 | * @param[out] FreqDivisor The desired node's frequency divisor. |
| 296 | * @param[out] VoltageInuV The desired node's voltage in microvolts. |
| 297 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 298 | * |
| 299 | * @retval TRUE NbPstate is valid |
| 300 | * @retval FALSE NbPstate is disabled or invalid |
| 301 | */ |
| 302 | typedef BOOLEAN F_CPU_GET_NB_PSTATE_INFO ( |
| 303 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 304 | IN PLATFORM_CONFIGURATION *PlatformConfig, |
| 305 | IN PCI_ADDR *PciAddress, |
| 306 | IN UINT32 NbPstate, |
| 307 | OUT UINT32 *FreqNumeratorInMHz, |
| 308 | OUT UINT32 *FreqDivisor, |
| 309 | OUT UINT32 *VoltageInuV, |
| 310 | IN AMD_CONFIG_PARAMS *StdHeader |
| 311 | ); |
| 312 | |
| 313 | /// Reference to a Method. |
| 314 | typedef F_CPU_GET_NB_PSTATE_INFO *PF_CPU_GET_NB_PSTATE_INFO; |
| 315 | |
| 316 | /** |
| 317 | * Returns whether or not the NB frequency initialization sequence is required |
| 318 | * to be performed by the BIOS. |
| 319 | * |
| 320 | * @CpuServiceInstances |
| 321 | * |
| 322 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 323 | * @param[in] PciAddress The northbridge to query by pci base address. |
| 324 | * @param[out] NbVidUpdateAll Do all NbVids need to be updated as well. |
| 325 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 326 | * |
| 327 | */ |
| 328 | typedef BOOLEAN F_CPU_IS_NBCOF_INIT_NEEDED ( |
| 329 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 330 | IN PCI_ADDR *PciAddress, |
| 331 | OUT BOOLEAN *NbVidUpdateAll, |
| 332 | IN AMD_CONFIG_PARAMS *StdHeader |
| 333 | ); |
| 334 | |
| 335 | /// Reference to a Method. |
| 336 | typedef F_CPU_IS_NBCOF_INIT_NEEDED *PF_CPU_IS_NBCOF_INIT_NEEDED; |
| 337 | |
| 338 | /** |
| 339 | * Get the desired NB P-state's maximum current required in milliamps. |
| 340 | * |
| 341 | * @CpuServiceInstances |
| 342 | * |
| 343 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 344 | * @param[in] StateNumber The desired hardware P-state number. |
| 345 | * @param[out] NbIddMax The NB P-state's maximum current. |
| 346 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 347 | * |
| 348 | * @retval TRUE The NB P-state is enabled, and NbIddMax is valid. |
| 349 | * @retval FALSE The NB P-state is disabled. |
| 350 | * |
| 351 | */ |
| 352 | typedef BOOLEAN F_CPU_GET_NB_IDD_MAX ( |
| 353 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 354 | IN UINT8 StateNumber, |
| 355 | OUT UINT32 *NbIddMax, |
| 356 | IN AMD_CONFIG_PARAMS *StdHeader |
| 357 | ); |
| 358 | |
| 359 | /// Reference to a Method. |
| 360 | typedef F_CPU_GET_NB_IDD_MAX *PF_CPU_GET_NB_IDD_MAX; |
| 361 | |
| 362 | /** |
| 363 | * Launches the desired core from the reset vector. |
| 364 | * |
| 365 | * @CpuServiceInstances |
| 366 | * |
| 367 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 368 | * @param[in] SocketNumber The desired core's socket number. |
| 369 | * @param[in] ModuleNumber The desired core's die number. |
| 370 | * @param[in] CoreNumber The desired core's die relative core number. |
| 371 | * @param[in] PrimaryCoreNumber SocketNumber / ModuleNumber's primary core number. |
| 372 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 373 | * |
| 374 | * @retval TRUE The core was launched successfully. |
| 375 | * @retval FALSE The core was previously launched, or has a problem. |
| 376 | */ |
| 377 | typedef BOOLEAN F_CPU_AP_INITIAL_LAUNCH ( |
| 378 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 379 | IN UINT32 SocketNumber, |
| 380 | IN UINT32 ModuleNumber, |
| 381 | IN UINT32 CoreNumber, |
| 382 | IN UINT32 PrimaryCoreNumber, |
| 383 | IN AMD_CONFIG_PARAMS *StdHeader |
| 384 | ); |
| 385 | |
| 386 | /// Reference to a Method. |
| 387 | typedef F_CPU_AP_INITIAL_LAUNCH *PF_CPU_AP_INITIAL_LAUNCH; |
| 388 | |
| 389 | /** |
| 390 | * Returns the appropriate number of physical processor cores |
| 391 | * |
| 392 | * @CpuServiceInstances |
| 393 | * |
| 394 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 395 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 396 | * |
| 397 | * @return One-based number of physical cores on current processor |
| 398 | */ |
| 399 | typedef UINT8 F_CPU_NUMBER_OF_PHYSICAL_CORES ( |
| 400 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 401 | IN AMD_CONFIG_PARAMS *StdHeader |
| 402 | ); |
| 403 | |
| 404 | /// Reference to a Method. |
| 405 | typedef F_CPU_NUMBER_OF_PHYSICAL_CORES *PF_CPU_NUMBER_OF_PHYSICAL_CORES; |
| 406 | |
| 407 | /** |
| 408 | * Returns a family specific table of information pointer and size. |
| 409 | * |
| 410 | * @CpuServiceInstances |
| 411 | * |
| 412 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 413 | * @param[out] FamilySpecificArray Pointer to the appropriate list for the core. |
| 414 | * @param[out] NumberOfElements Number of valid entries FamilySpecificArray. |
| 415 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 416 | * |
| 417 | */ |
| 418 | typedef VOID F_CPU_GET_FAMILY_SPECIFIC_ARRAY ( |
| 419 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 420 | OUT CONST VOID **FamilySpecificArray, |
| 421 | OUT UINT8 *NumberOfElements, |
| 422 | IN AMD_CONFIG_PARAMS *StdHeader |
| 423 | ); |
| 424 | |
| 425 | /// Reference to a Method. |
| 426 | typedef F_CPU_GET_FAMILY_SPECIFIC_ARRAY *PF_CPU_GET_FAMILY_SPECIFIC_ARRAY; |
| 427 | |
| 428 | /** |
| 429 | * Returns a model specific list of logical IDs. |
| 430 | * |
| 431 | * @param[out] LogicalIdXlat Installed logical ID table. |
| 432 | * @param[out] NumberOfElements Number of entries in the Logical ID translate table. |
| 433 | * @param[out] LogicalFamily Base logical family bit mask. |
| 434 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 435 | * |
| 436 | */ |
| 437 | typedef VOID F_CPU_GET_SUBFAMILY_ID_ARRAY ( |
| 438 | OUT CONST CPU_LOGICAL_ID_XLAT **LogicalIdXlat, |
| 439 | OUT UINT8 *NumberOfElements, |
| 440 | OUT UINT64 *LogicalFamily, |
| 441 | IN AMD_CONFIG_PARAMS *StdHeader |
| 442 | ); |
| 443 | |
| 444 | /// Reference to a method. |
| 445 | typedef F_CPU_GET_SUBFAMILY_ID_ARRAY *PF_CPU_GET_SUBFAMILY_ID_ARRAY; |
| 446 | |
| 447 | /** |
| 448 | * Use the Mailbox Register to get the Ap Mailbox info for the current core. |
| 449 | * |
| 450 | * @CpuServiceInstances |
| 451 | * |
| 452 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 453 | * @param[out] ApMailboxInfo The AP Mailbox info |
| 454 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 455 | * |
| 456 | */ |
| 457 | typedef VOID (F_CPU_AMD_GET_AP_MAILBOX_FROM_HARDWARE) ( |
| 458 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 459 | OUT AP_MAILBOXES *ApMailboxInfo, |
| 460 | IN AMD_CONFIG_PARAMS *StdHeader |
| 461 | ); |
| 462 | |
| 463 | /// Reference to a method |
| 464 | typedef F_CPU_AMD_GET_AP_MAILBOX_FROM_HARDWARE *PF_CPU_AMD_GET_AP_MAILBOX_FROM_HARDWARE; |
| 465 | |
| 466 | /** |
| 467 | * Set the AP core number in the AP's Mailbox. |
| 468 | * |
| 469 | * @CpuServiceInstances |
| 470 | * |
| 471 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 472 | * @param[in] Socket The AP's socket |
| 473 | * @param[in] Module The AP's module |
| 474 | * @param[in] ApCoreNumber The AP's unique core number |
| 475 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 476 | * |
| 477 | */ |
| 478 | typedef VOID (F_CPU_SET_AP_CORE_NUMBER) ( |
| 479 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 480 | IN UINT32 Socket, |
| 481 | IN UINT32 Module, |
| 482 | IN UINT32 ApCoreNumber, |
| 483 | IN AMD_CONFIG_PARAMS *StdHeader |
| 484 | ); |
| 485 | |
| 486 | /// Reference to a method |
| 487 | typedef F_CPU_SET_AP_CORE_NUMBER *PF_CPU_SET_AP_CORE_NUMBER; |
| 488 | |
| 489 | /** |
| 490 | * Get the AP core number from hardware. |
| 491 | * |
| 492 | * @CpuServiceInstances |
| 493 | * |
| 494 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 495 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 496 | * |
| 497 | * @return The AP's unique core number |
| 498 | */ |
| 499 | typedef UINT32 (F_CPU_GET_AP_CORE_NUMBER) ( |
| 500 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 501 | IN AMD_CONFIG_PARAMS *StdHeader |
| 502 | ); |
| 503 | |
| 504 | /// Reference to a method |
| 505 | typedef F_CPU_GET_AP_CORE_NUMBER *PF_CPU_GET_AP_CORE_NUMBER; |
| 506 | |
| 507 | /** |
| 508 | * Move the AP's core number from the mailbox to hardware. |
| 509 | * |
| 510 | * @CpuServiceInstances |
| 511 | * |
| 512 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 513 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 514 | * |
| 515 | * @return The AP's unique core number |
| 516 | */ |
| 517 | typedef VOID (F_CPU_TRANSFER_AP_CORE_NUMBER) ( |
| 518 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 519 | IN AMD_CONFIG_PARAMS *StdHeader |
| 520 | ); |
| 521 | |
| 522 | /// Reference to a method |
| 523 | typedef F_CPU_TRANSFER_AP_CORE_NUMBER *PF_CPU_TRANSFER_AP_CORE_NUMBER; |
| 524 | |
| 525 | /** |
| 526 | * Core ID position in the initial APIC ID, reflected as a number zero or one. |
| 527 | */ |
| 528 | typedef enum { |
| 529 | CoreIdPositionZero, ///< Zero, the Core Id bits are the Most Significant bits. |
| 530 | CoreIdPositionOne, ///< One, the Core Id bits are the Least Significant bits. |
| 531 | CoreIdPositionMax ///< Limit check. |
| 532 | } CORE_ID_POSITION; |
| 533 | |
| 534 | /** |
| 535 | * Return a number zero or one, based on the Core ID position in the initial APIC Id. |
| 536 | * |
| 537 | * @CpuServiceInstances |
| 538 | * |
| 539 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 540 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 541 | * |
| 542 | * @retval CoreIdPositionZero Core Id is not low |
| 543 | * @retval CoreIdPositionOne Core Id is low |
| 544 | */ |
| 545 | typedef CORE_ID_POSITION F_CORE_ID_POSITION_IN_INITIAL_APIC_ID ( |
| 546 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 547 | IN AMD_CONFIG_PARAMS *StdHeader |
| 548 | ); |
| 549 | |
| 550 | /// Reference to a method |
| 551 | typedef F_CORE_ID_POSITION_IN_INITIAL_APIC_ID *PF_CORE_ID_POSITION_IN_INITIAL_APIC_ID; |
| 552 | |
| 553 | /** |
| 554 | * Get least common features set of all CPUs and save them to CPU_FEATURES_LIST |
| 555 | * |
| 556 | * @CpuServiceInstances |
| 557 | * |
| 558 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 559 | * @param[in,out] cpuFeatureListPtr The CPU Features List |
| 560 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 561 | * |
| 562 | */ |
| 563 | typedef VOID (F_CPU_SAVE_FEATURES) ( |
| 564 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 565 | IN OUT CPU_FEATURES_LIST *cpuFeatureListPtr, |
| 566 | IN AMD_CONFIG_PARAMS *StdHeader |
| 567 | ); |
| 568 | |
| 569 | /// Reference to a method |
| 570 | typedef F_CPU_SAVE_FEATURES *PF_CPU_SAVE_FEATURES; |
| 571 | |
| 572 | /** |
| 573 | * Get least common features from CPU_FEATURES_LIST and write them to CPU |
| 574 | * |
| 575 | * @CpuServiceInstances |
| 576 | * |
| 577 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 578 | * @param[in,out] cpuFeatureListPtr The CPU Features List |
| 579 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 580 | * |
| 581 | */ |
| 582 | typedef VOID (F_CPU_WRITE_FEATURES) ( |
| 583 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 584 | IN OUT CPU_FEATURES_LIST *cpuFeatureListPtr, |
| 585 | IN AMD_CONFIG_PARAMS *StdHeader |
| 586 | ); |
| 587 | |
| 588 | /// Reference to a method |
| 589 | typedef F_CPU_WRITE_FEATURES *PF_CPU_WRITE_FEATURES; |
| 590 | |
| 591 | /** |
| 592 | * Set Warm Reset Flag |
| 593 | * |
| 594 | * @CpuServiceInstances |
| 595 | * |
| 596 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 597 | * @param[in] StdHeader Header for library and services. |
| 598 | * @param[in] Request Value to set the flags to. |
| 599 | * |
| 600 | */ |
| 601 | typedef VOID (F_CPU_SET_WARM_RESET_FLAG) ( |
| 602 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 603 | IN AMD_CONFIG_PARAMS *StdHeader, |
| 604 | IN WARM_RESET_REQUEST *Request |
| 605 | ); |
| 606 | |
| 607 | /// Reference to a method |
| 608 | typedef F_CPU_SET_WARM_RESET_FLAG *PF_CPU_SET_WARM_RESET_FLAG; |
| 609 | |
| 610 | /** |
| 611 | * Get Warm Reset Flag |
| 612 | * |
| 613 | * @CpuServiceInstances |
| 614 | * |
| 615 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 616 | * @param[in] StdHeader Header for library and services. |
| 617 | * @param[out] BiosRstDet Indicate warm reset status. |
| 618 | * |
| 619 | */ |
| 620 | typedef VOID (F_CPU_GET_WARM_RESET_FLAG) ( |
| 621 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 622 | IN AMD_CONFIG_PARAMS *StdHeader, |
| 623 | OUT WARM_RESET_REQUEST *Request |
| 624 | ); |
| 625 | |
| 626 | /// Reference to a method |
| 627 | typedef F_CPU_GET_WARM_RESET_FLAG *PF_CPU_GET_WARM_RESET_FLAG; |
| 628 | |
| 629 | |
| 630 | /** |
| 631 | * Get CPU Specific Platform Type Info. |
| 632 | * |
| 633 | * @CpuServiceInstances |
| 634 | * |
| 635 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 636 | * @param[in,out] FeaturesUnion The Features supported by this platform. |
| 637 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 638 | * |
| 639 | */ |
| 640 | typedef AGESA_STATUS F_CPU_GET_PLATFORM_TYPE_SPECIFIC_INFO ( |
| 641 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 642 | IN OUT PLATFORM_FEATS *FeaturesUnion, |
| 643 | IN AMD_CONFIG_PARAMS *StdHeader |
| 644 | ); |
| 645 | |
| 646 | /// Reference to a Method. |
| 647 | typedef F_CPU_GET_PLATFORM_TYPE_SPECIFIC_INFO *PF_CPU_GET_PLATFORM_TYPE_SPECIFIC_INFO; |
| 648 | |
| 649 | /** |
| 650 | * Is the Northbridge PState feature enabled? |
| 651 | * |
| 652 | * @CpuServiceInstances |
| 653 | * |
| 654 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 655 | * @param[in] PlatformConfig Platform profile/build option config structure. |
| 656 | * @param[in] StdHeader Handle of Header for calling lib functions and services. |
| 657 | * |
| 658 | * @retval TRUE The NB PState feature is enabled. |
| 659 | * @retval FALSE The NB PState feature is not enabled. |
| 660 | */ |
| 661 | typedef BOOLEAN F_IS_NB_PSTATE_ENABLED ( |
| 662 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 663 | IN PLATFORM_CONFIGURATION *PlatformConfig, |
| 664 | IN AMD_CONFIG_PARAMS *StdHeader |
| 665 | ); |
| 666 | |
| 667 | /// Reference to a method |
| 668 | typedef F_IS_NB_PSTATE_ENABLED *PF_IS_NB_PSTATE_ENABLED; |
| 669 | |
| 670 | /** |
| 671 | * Gets the next link with features matching the HT phy register table entry type features. |
| 672 | * |
| 673 | * @CpuServiceInstances |
| 674 | * |
| 675 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 676 | * @param[in,out] HtHostCapability Initially the PCI bus, device, function=0, offset=0; |
| 677 | * Each call returns the HT Host Capability function and offset; |
| 678 | * Caller may use it to access registers, but must @b not modify it; |
| 679 | * Each new call passes the previous value as input. |
| 680 | * @param[in,out] Link Initially zero, each call returns the link number; caller passes it back unmodified each call. |
| 681 | * @param[in] HtPhyLinkType Link type field from a register table entry to compare against |
| 682 | * @param[out] MatchedSublink1 TRUE: It is actually just sublink 1 that matches, FALSE: any other condition. |
| 683 | * @param[out] Frequency0 The frequency of sublink0 (200 MHz if not connected). |
| 684 | * @param[out] Frequency1 The frequency of sublink1 (200 MHz if not connected). |
| 685 | * @param[in] StdHeader Standard Head Pointer |
| 686 | * |
| 687 | * @retval TRUE Link matches |
| 688 | * @retval FALSE No more links |
| 689 | * |
| 690 | */ |
| 691 | typedef BOOLEAN F_NEXT_LINK_HAS_HTFPY_FEATS ( |
| 692 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 693 | IN OUT PCI_ADDR *HtHostCapability, |
| 694 | IN OUT UINT32 *Link, |
| 695 | IN HT_PHY_LINK_FEATS *HtPhyLinkType, |
| 696 | OUT BOOLEAN *MatchedSublink1, |
| 697 | OUT HT_FREQUENCIES *Frequency0, |
| 698 | OUT HT_FREQUENCIES *Frequency1, |
| 699 | IN AMD_CONFIG_PARAMS *StdHeader |
| 700 | ); |
| 701 | /// Reference to a Method. |
| 702 | typedef F_NEXT_LINK_HAS_HTFPY_FEATS *PF_NEXT_LINK_HAS_HTFPY_FEATS; |
| 703 | |
| 704 | /** |
| 705 | * Applies an HT Phy read-modify-write based on an HT Phy register table entry. |
| 706 | * |
| 707 | * @CpuServiceInstances |
| 708 | * |
| 709 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 710 | * @param[in] HtPhyEntry HT Phy register table entry to apply |
| 711 | * @param[in] CapabilitySet The link's HT Host base address. |
| 712 | * @param[in] Link Zero based, node, link number (not package link), always a sublink0 link. |
| 713 | * @param[in] StdHeader Config handle for library and services |
| 714 | * |
| 715 | */ |
| 716 | typedef VOID F_SET_HT_PHY_REGISTER ( |
| 717 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 718 | IN HT_PHY_TYPE_ENTRY_DATA *HtPhyEntry, |
| 719 | IN PCI_ADDR CapabilitySet, |
| 720 | IN UINT32 Link, |
| 721 | IN AMD_CONFIG_PARAMS *StdHeader |
| 722 | ); |
| 723 | /// Reference to a Method. |
| 724 | typedef F_SET_HT_PHY_REGISTER *PF_SET_HT_PHY_REGISTER; |
| 725 | |
| 726 | /** |
| 727 | * Performs an early initialization function on the executing core. |
| 728 | * |
| 729 | * @param[in] FamilyServices The current Family Specific Services. |
| 730 | * @param[in] EarlyParams CPU module early paramters. |
| 731 | * @param[in] StdHeader Config handle for library and services |
| 732 | * |
| 733 | */ |
| 734 | typedef VOID F_PERFORM_EARLY_INIT_ON_CORE ( |
| 735 | IN CPU_SPECIFIC_SERVICES *FamilyServices, |
| 736 | IN AMD_CPU_EARLY_PARAMS *EarlyParams, |
| 737 | IN AMD_CONFIG_PARAMS *StdHeader |
| 738 | ); |
| 739 | /// Reference to a Method. |
| 740 | typedef F_PERFORM_EARLY_INIT_ON_CORE *PF_PERFORM_EARLY_INIT_ON_CORE; |
| 741 | |
| 742 | /** |
| 743 | * A struct that contains function pointer and function flag |
| 744 | * |
| 745 | * the flag indicates if the function need to be run. |
| 746 | */ |
| 747 | typedef struct _S_PERFORM_EARLY_INIT_ON_CORE { |
| 748 | PF_PERFORM_EARLY_INIT_ON_CORE PerformEarlyInitOnCore; ///< Function Pointer, which points to the function need to be run at early stage |
| 749 | UINT32 PerformEarlyInitFlag; ///< Function Flag, which indicates if the function need to be run. |
| 750 | } S_PERFORM_EARLY_INIT_ON_CORE; |
| 751 | |
| 752 | /** |
| 753 | * Returns the initialization steps that the executing core should |
| 754 | * perform at AmdInitEarly. |
| 755 | * |
| 756 | * @CpuServiceInstances |
| 757 | * |
| 758 | * @param[in] FamilyServices The current Family Specific Services. |
| 759 | * @param[out] Table Table of appropriate init steps for the executing core. |
| 760 | * @param[in] EarlyParams CPU module early paramters. |
| 761 | * @param[in] StdHeader Config handle for library and services |
| 762 | * |
| 763 | */ |
| 764 | typedef VOID F_GET_EARLY_INIT_TABLE ( |
| 765 | IN CPU_SPECIFIC_SERVICES *FamilyServices, |
| 766 | OUT CONST S_PERFORM_EARLY_INIT_ON_CORE **Table, |
| 767 | IN AMD_CPU_EARLY_PARAMS *EarlyParams, |
| 768 | IN AMD_CONFIG_PARAMS *StdHeader |
| 769 | ); |
| 770 | /// Reference to a Method. |
| 771 | typedef F_GET_EARLY_INIT_TABLE *PF_GET_EARLY_INIT_TABLE; |
| 772 | |
| 773 | /** |
| 774 | * Provide the features of the next HT link. |
| 775 | * |
| 776 | * @CpuServiceInstances |
| 777 | * |
| 778 | * This method is different than the HT Phy Features method, because for the phy registers |
| 779 | * sublink 1 matches and should be programmed if the link is ganged but for PCI config |
| 780 | * registers sublink 1 is reserved if the link is ganged. |
| 781 | * |
| 782 | * @param[in] FamilySpecificServices The current Family Specific Services. |
| 783 | * @param[in,out] Link The link number, for accessing non-capability set registers. |
| 784 | * Zero on initial call, and passed back unmodified on each subsequent call. |
| 785 | * @param[in,out] LinkBase IN: initially the node's PCI config base address, passed back on each call. |
| 786 | * OUT: the base HT Host capability PCI address for the link. |
| 787 | * @param[out] HtHostFeats The link's features. |
| 788 | * @param[in] StdHeader Standard Head Pointer |
| 789 | * |
| 790 | * @retval TRUE Valid link and features found. |
| 791 | * @retval FALSE No more links. |
| 792 | */ |
| 793 | typedef BOOLEAN F_GET_NEXT_HT_LINK_FEATURES ( |
| 794 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 795 | IN OUT UINTN *Link, |
| 796 | IN OUT PCI_ADDR *LinkBase, |
| 797 | OUT HT_HOST_FEATS *HtHostFeats, |
| 798 | IN AMD_CONFIG_PARAMS *StdHeader |
| 799 | ); |
| 800 | /// Reference to a Method. |
| 801 | typedef F_GET_NEXT_HT_LINK_FEATURES *PF_GET_NEXT_HT_LINK_FEATURES; |
| 802 | |
| 803 | /// Cache Enable / Disable policy before giving control back to OS. |
| 804 | typedef enum { |
| 805 | InitCacheDisabled, ///<Disable cache CR0.CD bit |
| 806 | InitCacheEnabled ///<Enable cache CR0.CD bit |
| 807 | } FAMILY_CACHE_INIT_POLICY; |
| 808 | |
| 809 | |
| 810 | /*---------------------------------------------------------------------------------------*/ |
| 811 | /** |
| 812 | * Provide the interface to all cpu Family Specific Services. |
| 813 | * |
| 814 | * Use the methods or data in this struct to adapt the feature code to a specific cpu family or model (or stepping!). |
| 815 | * Each supported Family must provide an implementation for all methods in this interface, even if the |
| 816 | * implementation is a CommonReturn(). |
| 817 | * See CPU Family Specific Services Implementation Guide for adding new services. |
| 818 | */ |
| 819 | struct _CPU_SPECIFIC_SERVICES { // See the Forwaqrd Declaration above |
| 820 | UINT16 Revision; ///< Interface version |
| 821 | // Public Methods. |
| 822 | PF_CPU_DISABLE_PSTATE DisablePstate; ///< Method: Disable the desired P-state. |
| 823 | PF_CPU_TRANSITION_PSTATE TransitionPstate; ///< Method: Transition the current core to the desired P-state. |
| 824 | PF_CPU_GET_IDD_MAX GetProcIddMax; ///< Method: Gets P-state maximum current required |
| 825 | PF_CPU_GET_TSC_RATE GetTscRate; ///< Method: Returns the rate at which the current core's timestamp counter increments in megahertz. |
| 826 | PF_CPU_GET_NB_FREQ GetCurrentNbFrequency; ///< Method: Returns the processor north bridge's clock rate in megahertz. |
| 827 | PF_CPU_GET_MIN_MAX_NB_FREQ GetMinMaxNbFrequency; ///< Method: Returns the node's minimum and maximum northbridge frequency. |
| 828 | PF_CPU_GET_NB_PSTATE_INFO GetNbPstateInfo; ///< Method: Returns information about the processor north bridge's P-states. |
| 829 | PF_CPU_IS_NBCOF_INIT_NEEDED IsNbCofInitNeeded; ///< Method: Returns whether or not the NB frequency initialization sequence is required to be performed by the BIOS. |
| 830 | PF_CPU_GET_NB_IDD_MAX GetNbIddMax; ///< Method: Gets NB P-state maximum current required |
| 831 | PF_CPU_AP_INITIAL_LAUNCH LaunchApCore; ///< Method: Launches the desired core from the reset vector. |
| 832 | PF_CPU_NUMBER_OF_PHYSICAL_CORES GetNumberOfPhysicalCores; ///< Method: Get the number of physical cores of current processor. |
| 833 | PF_CPU_AMD_GET_AP_MAILBOX_FROM_HARDWARE GetApMailboxFromHardware; ///< Method: Get the AP's topology info from the hardware mailbox. |
| 834 | PF_CPU_SET_AP_CORE_NUMBER SetApCoreNumber; ///< Method: Set the AP's core number to the hardware mailbox. |
| 835 | PF_CPU_GET_AP_CORE_NUMBER GetApCoreNumber; ///< Method: Get the AP's core number from hardware. |
| 836 | PF_CPU_TRANSFER_AP_CORE_NUMBER TransferApCoreNumber; ///< Method: Move the AP's core number from the mailbox to hardware. |
| 837 | PF_CORE_ID_POSITION_IN_INITIAL_APIC_ID CoreIdPositionInInitialApicId; ///< Method: Which bits in initial APIC Id are the Core Id. |
| 838 | PF_CPU_SAVE_FEATURES SaveFeatures; ///< Method: Get least common features set of all CPUs and save them to CPU_FEATURES_LIST |
| 839 | PF_CPU_WRITE_FEATURES WriteFeatures; ///< Method: Get least common features from CPU_FEATURES_LIST and write them to CPU |
| 840 | PF_CPU_SET_WARM_RESET_FLAG SetWarmResetFlag; ///< Method: Set Warm Reset Flag |
| 841 | PF_CPU_GET_WARM_RESET_FLAG GetWarmResetFlag; ///< Method: Get Warm Reset Flag |
| 842 | PF_CPU_GET_FAMILY_SPECIFIC_ARRAY GetBrandString1; ///< Method: Get a Brand String table |
| 843 | PF_CPU_GET_FAMILY_SPECIFIC_ARRAY GetBrandString2; ///< Method: Get a Brand String table |
| 844 | PF_CPU_GET_FAMILY_SPECIFIC_ARRAY GetMicroCodePatchesStruct; ///< Method: Get microcode patches |
| 845 | PF_CPU_GET_FAMILY_SPECIFIC_ARRAY GetMicrocodeEquivalenceTable; ///< Method: Get CPU equivalence for loading microcode patches. |
| 846 | PF_CPU_GET_FAMILY_SPECIFIC_ARRAY GetCacheInfo; ///< Method: Get setup for cache use and initialization. |
| 847 | PF_CPU_GET_FAMILY_SPECIFIC_ARRAY GetSysPmTableStruct; ///< Method: Get Power Management settings. |
| 848 | PF_CPU_GET_FAMILY_SPECIFIC_ARRAY GetWheaInitData; ///< Method: Get Whea Initial Data. |
| 849 | PF_CPU_GET_PLATFORM_TYPE_SPECIFIC_INFO GetPlatformTypeSpecificInfo; ///< Method: Get Specific platform Type features. |
| 850 | PF_IS_NB_PSTATE_ENABLED IsNbPstateEnabled; ///< Method: Get whether Northbridge PStates feature is enabled. |
| 851 | PF_NEXT_LINK_HAS_HTFPY_FEATS NextLinkHasHtPhyFeats; ///< Method: Iterate over HT Links matching features, for HT PHY entries. |
| 852 | PF_SET_HT_PHY_REGISTER SetHtPhyRegister; ///< Method: Set an Ht Phy register based on table entry. |
| 853 | PF_GET_NEXT_HT_LINK_FEATURES GetNextHtLinkFeatures; ///< Method: Iterate over HT links, returning link features. |
Arthur Heymans | 8d3640d | 2022-05-16 12:27:36 +0200 | [diff] [blame] | 854 | CONST REGISTER_TABLE **RegisterTableList; ///< Public Data: The available register tables. |
zbao | 7d94cf9 | 2012-07-02 14:19:14 +0800 | [diff] [blame] | 855 | TABLE_ENTRY_TYPE_DESCRIPTOR *TableEntryTypeDescriptors; ///< Public Data: implemented register table entry types. |
| 856 | PACKAGE_HTLINK_MAP PackageLinkMap; ///< Public Data: translate northbridge HT links to package level links, or NULL. |
| 857 | CORE_PAIR_MAP *CorePairMap; ///< Public Data: translate compute unit core pairing, or NULL. |
| 858 | FAMILY_CACHE_INIT_POLICY InitCacheDisabled; ///< public Data: Family related information. |
| 859 | PF_GET_EARLY_INIT_TABLE GetEarlyInitOnCoreTable; ///< Method: Get the initialization steps needed at AmdInitEarly. |
| 860 | }; |
| 861 | |
| 862 | /** |
| 863 | * A Family Id and an interface to it's implementations of Family Specific Services. |
| 864 | * |
| 865 | * Note that this is a logical family id, which may specify family, model (or even stepping). |
| 866 | */ |
| 867 | typedef struct { |
| 868 | UINT64 Family; ///< The Family to which this interface belongs. |
| 869 | CONST VOID *TablePtr; ///< The interface to its Family Specific Services. |
| 870 | } CPU_SPECIFIC_SERVICES_XLAT; |
| 871 | |
| 872 | /** |
| 873 | * A collection of Family specific interfaces to Family Specific services. |
| 874 | */ |
| 875 | typedef struct { |
| 876 | UINT8 Elements; ///< The number of tables to search. |
| 877 | CONST CPU_SPECIFIC_SERVICES_XLAT *FamilyTable; ///< The family interfaces. |
| 878 | } CPU_FAMILY_SUPPORT_TABLE; |
| 879 | |
| 880 | /** |
| 881 | * Implement the translation of a logical CPU id to an id that can be used to get Family specific services. |
| 882 | */ |
| 883 | typedef struct { |
| 884 | UINT32 Family; ///< Provide translation for this family |
| 885 | CPU_LOGICAL_ID UnknownRevision; ///< In this family, unrecognized models (or steppings) are treated as though they were this model and stepping. |
| 886 | CONST PF_CPU_GET_SUBFAMILY_ID_ARRAY *SubFamilyIdTable; ///< Method: Get family specific model (and stepping) resolution. |
| 887 | UINT8 Elements; ///< The number of family specific model tables pointed to by SubFamilyIdTable |
| 888 | } CPU_LOGICAL_ID_FAMILY_XLAT; |
| 889 | |
| 890 | /** |
| 891 | * A collection of all available family id translations. |
| 892 | */ |
| 893 | typedef struct { |
| 894 | UINT8 Elements; ///< The number of family translation items to search. |
| 895 | CONST CPU_LOGICAL_ID_FAMILY_XLAT *FamilyIdTable; ///< The family translation items. |
| 896 | } CPU_FAMILY_ID_XLAT_TABLE; |
| 897 | |
| 898 | /*--------------------------------------------------------------------------------------- |
| 899 | * F U N C T I O N P R O T O T Y P E |
| 900 | *--------------------------------------------------------------------------------------- |
| 901 | */ |
| 902 | |
| 903 | /** |
| 904 | * Get a logical identifier for the specified processor, based on CPUID, but independent of CPUID formatting. |
| 905 | */ |
| 906 | VOID |
| 907 | GetLogicalIdOfSocket ( |
| 908 | IN UINT32 Socket, |
| 909 | OUT CPU_LOGICAL_ID *LogicalId, |
| 910 | IN AMD_CONFIG_PARAMS *StdHeader |
| 911 | ); |
| 912 | |
| 913 | /** |
| 914 | * Get a logical identifier for the executing core, based on CPUID, but independent of CPUID formatting. |
| 915 | */ |
| 916 | VOID |
| 917 | GetLogicalIdOfCurrentCore ( |
| 918 | OUT CPU_LOGICAL_ID *LogicalId, |
| 919 | IN AMD_CONFIG_PARAMS *StdHeader |
| 920 | ); |
| 921 | |
| 922 | /** |
| 923 | * Get a logical identifier for the specified CPUID value. |
| 924 | */ |
| 925 | VOID |
| 926 | GetLogicalIdFromCpuid ( |
| 927 | IN UINT32 RawCpuid, |
| 928 | OUT CPU_LOGICAL_ID *LogicalId, |
| 929 | IN AMD_CONFIG_PARAMS *StdHeader |
| 930 | ); |
| 931 | |
| 932 | /** |
| 933 | * Retrieves a pointer to the desired processor's family specific services structure. |
| 934 | */ |
| 935 | VOID |
| 936 | GetCpuServicesOfSocket ( |
| 937 | IN UINT32 Socket, |
| 938 | OUT CONST CPU_SPECIFIC_SERVICES **FunctionTable, |
| 939 | IN AMD_CONFIG_PARAMS *StdHeader |
| 940 | ); |
| 941 | |
| 942 | /** |
| 943 | * Retrieves a pointer to the desired processor's family specific services structure. |
| 944 | */ |
| 945 | VOID |
| 946 | GetFeatureServicesOfSocket ( |
| 947 | IN CPU_FAMILY_SUPPORT_TABLE *FamilyTable, |
| 948 | IN UINT32 Socket, |
| 949 | OUT CONST VOID **CpuServices, |
| 950 | IN AMD_CONFIG_PARAMS *StdHeader |
| 951 | ); |
| 952 | |
| 953 | /** |
| 954 | * Retrieves a pointer to the executing core's family specific services structure. |
| 955 | */ |
| 956 | VOID |
| 957 | GetCpuServicesOfCurrentCore ( |
| 958 | OUT CONST CPU_SPECIFIC_SERVICES **FunctionTable, |
| 959 | IN AMD_CONFIG_PARAMS *StdHeader |
| 960 | ); |
| 961 | |
| 962 | /** |
| 963 | * Retrieves a pointer to the executing core's family specific services structure. |
| 964 | */ |
| 965 | VOID |
| 966 | GetFeatureServicesOfCurrentCore ( |
| 967 | IN CPU_FAMILY_SUPPORT_TABLE *FamilyTable, |
| 968 | OUT CONST VOID **CpuServices, |
| 969 | IN AMD_CONFIG_PARAMS *StdHeader |
| 970 | ); |
| 971 | |
| 972 | /** |
| 973 | * Retrieves a pointer to the family specific services structure for a processor |
| 974 | * with the given logical ID. |
| 975 | */ |
| 976 | VOID |
| 977 | GetCpuServicesFromLogicalId ( |
| 978 | IN CPU_LOGICAL_ID *LogicalId, |
| 979 | OUT CONST CPU_SPECIFIC_SERVICES **FunctionTable, |
| 980 | IN AMD_CONFIG_PARAMS *StdHeader |
| 981 | ); |
| 982 | |
| 983 | /** |
| 984 | * Retrieves a pointer to the family specific services structure for a processor |
| 985 | * with the given logical ID. |
| 986 | */ |
| 987 | VOID |
| 988 | GetFeatureServicesFromLogicalId ( |
| 989 | IN CPU_FAMILY_SUPPORT_TABLE *FamilyTable, |
| 990 | IN CPU_LOGICAL_ID *LogicalId, |
| 991 | OUT CONST VOID **CpuServices, |
| 992 | IN AMD_CONFIG_PARAMS *StdHeader |
| 993 | ); |
| 994 | |
| 995 | /** |
| 996 | * Used by logical families which don't need a certain register setting table or other data array. |
| 997 | */ |
| 998 | VOID |
| 999 | GetEmptyArray ( |
| 1000 | IN CPU_SPECIFIC_SERVICES *FamilySpecificServices, |
| 1001 | OUT CONST VOID **Empty, |
| 1002 | OUT UINT8 *NumberOfElements, |
| 1003 | IN AMD_CONFIG_PARAMS *StdHeader |
| 1004 | ); |
| 1005 | |
| 1006 | #endif // _CPU_FAMILY_TRANSLATION_H_ |