5 * AMD AGESA CPU Core performance boost feature support code.
7 * Contains code that declares the AGESA CPU CPB related APIs
9 * @xrefitem bom "File Content Label" "Release Content"
11 * @e sub-project: CPU/Feature
12 * @e \$Revision: 56279 $ @e \$Date: 2011-07-11 13:11:28 -0600 (Mon, 11 Jul 2011) $
16 ******************************************************************************
18 * Copyright (C) 2012 Advanced Micro Devices, Inc.
19 * All rights reserved.
21 * Redistribution and use in source and binary forms, with or without
22 * modification, are permitted provided that the following conditions are met:
23 * * Redistributions of source code must retain the above copyright
24 * notice, this list of conditions and the following disclaimer.
25 * * Redistributions in binary form must reproduce the above copyright
26 * notice, this list of conditions and the following disclaimer in the
27 * documentation and/or other materials provided with the distribution.
28 * * Neither the name of Advanced Micro Devices, Inc. nor the names of
29 * its contributors may be used to endorse or promote products derived
30 * from this software without specific prior written permission.
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
33 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
35 * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY
36 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
37 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
38 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
39 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
43 ******************************************************************************
46 /*----------------------------------------------------------------------------------------
47 * M O D U L E S U S E D
48 *----------------------------------------------------------------------------------------
51 #include "cpuFamilyTranslation.h"
52 #include "cpuFeatures.h"
58 #define FILECODE PROC_CPU_FEATURE_CPUCPB_FILECODE
60 /*----------------------------------------------------------------------------------------
61 * D E F I N I T I O N S A N D M A C R O S
62 *----------------------------------------------------------------------------------------
65 /*----------------------------------------------------------------------------------------
66 * T Y P E D E F S A N D S T R U C T U R E S
67 *----------------------------------------------------------------------------------------
70 /*----------------------------------------------------------------------------------------
71 * P R O T O T Y P E S O F L O C A L F U N C T I O N S
72 *----------------------------------------------------------------------------------------
75 /*----------------------------------------------------------------------------------------
76 * E X P O R T E D F U N C T I O N S
77 *----------------------------------------------------------------------------------------
79 extern CPU_FAMILY_SUPPORT_TABLE CpbFamilyServiceTable;
81 /*---------------------------------------------------------------------------------------*/
83 * Should CPB be enabled
85 * @param[in] PlatformConfig Contains the runtime modifiable feature input data.
86 * @param[in] StdHeader Config Handle for library, services.
88 * @retval TRUE CPB is supported.
89 * @retval FALSE CPB cannot be enabled.
95 IN PLATFORM_CONFIGURATION *PlatformConfig,
96 IN AMD_CONFIG_PARAMS *StdHeader
101 CPB_FAMILY_SERVICES *FamilyServices;
105 ASSERT (PlatformConfig->CpbMode < MaxCpbMode);
107 if (PlatformConfig->CpbMode == CpbModeAuto) {
108 for (Socket = 0; Socket < GetPlatformNumberOfSockets (); Socket++) {
109 if (IsProcessorPresent (Socket, StdHeader)) {
110 GetFeatureServicesOfSocket (&CpbFamilyServiceTable, Socket, (CONST VOID **)&FamilyServices, StdHeader);
111 if (FamilyServices != NULL) {
112 if (FamilyServices->IsCpbSupported (FamilyServices, PlatformConfig, Socket, StdHeader)) {
123 /*---------------------------------------------------------------------------------------*/
125 * Enable core performance boost
127 * @param[in] EntryPoint Timepoint designator.
128 * @param[in] PlatformConfig Contains the runtime modifiable feature input data.
129 * @param[in] StdHeader Config Handle for library, services.
131 * @retval AGESA_SUCCESS Always succeeds.
136 InitializeCpbFeature (
137 IN UINT64 EntryPoint,
138 IN PLATFORM_CONFIGURATION *PlatformConfig,
139 IN AMD_CONFIG_PARAMS *StdHeader
143 AGESA_STATUS AgesaStatus;
144 AGESA_STATUS CalledStatus;
145 CPB_FAMILY_SERVICES *FamilyServices;
147 AgesaStatus = AGESA_SUCCESS;
148 CalledStatus = AGESA_SUCCESS;
150 IDS_HDT_CONSOLE (CPU_TRACE, " Boost is enabled\n");
152 for (Socket = 0; Socket < GetPlatformNumberOfSockets (); Socket++) {
153 if (IsProcessorPresent (Socket, StdHeader)) {
154 GetFeatureServicesOfSocket (&CpbFamilyServiceTable, Socket, (CONST VOID **)&FamilyServices, StdHeader);
155 if (FamilyServices != NULL) {
156 if (FamilyServices->IsCpbSupported (FamilyServices, PlatformConfig, Socket, StdHeader)) {
157 CalledStatus = FamilyServices->EnableCpbOnSocket (FamilyServices, PlatformConfig, EntryPoint, Socket, StdHeader);
158 if (CalledStatus > AgesaStatus) {
159 AgesaStatus = CalledStatus;
170 CONST CPU_FEATURE_DESCRIPTOR ROMDATA CpuFeatureCpb =
173 (CPU_FEAT_BEFORE_PM_INIT | CPU_FEAT_AFTER_PM_INIT | CPU_FEAT_INIT_LATE_END | CPU_FEAT_AFTER_POST_MTRR_SYNC | CPU_FEAT_S3_LATE_RESTORE_END | CPU_FEAT_AFTER_RESUME_MTRR_SYNC),