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