5 * AMD AGESA Basic Level Public APIs
7 * Contains basic Level Initialization routines.
9 * @xrefitem bom "File Content Label" "Release Content"
11 * @e sub-project: Interface
12 * @e \$Revision: 56279 $ @e \$Date: 2011-07-11 13:11:28 -0600 (Mon, 11 Jul 2011) $
15 /*****************************************************************************
17 * Copyright (C) 2012 Advanced Micro Devices, Inc.
18 * All rights reserved.
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.
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.
42 ******************************************************************************
46 /*----------------------------------------------------------------------------------------
47 * M O D U L E S U S E D
48 *----------------------------------------------------------------------------------------
52 #include "cpuFeatures.h"
53 #include "CommonInits.h"
54 #include "GnbInterface.h"
57 #include "heapManager.h"
58 #include "CreateStruct.h"
62 #define FILECODE PROC_COMMON_AMDINITMID_FILECODE
64 extern BLDOPT_FCH_FUNCTION BldoptFchFunction;
66 /*----------------------------------------------------------------------------------------
67 * D E F I N I T I O N S A N D M A C R O S
68 *----------------------------------------------------------------------------------------
72 /*----------------------------------------------------------------------------------------
73 * T Y P E D E F S A N D S T R U C T U R E S
74 *----------------------------------------------------------------------------------------
78 /*----------------------------------------------------------------------------------------
79 * 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
80 *----------------------------------------------------------------------------------------
84 /*----------------------------------------------------------------------------------------
85 * E X P O R T E D F U N C T I O N S
86 *----------------------------------------------------------------------------------------
89 *---------------------------------------------------------------------------------------
91 * Initializer routine that will be invoked by the wrapper
92 * to initialize the input structure for the AmdInitMid
94 * @param[in,out] MidParamsPtr Newly created interface parameters for AmdInitMid
96 * @retval AGESA_SUCCESS Always succeeds
98 *---------------------------------------------------------------------------------------
101 AmdInitMidInitializer (
102 IN AMD_CONFIG_PARAMS *StdHeader,
103 IN OUT AMD_MID_PARAMS *MidParamsPtr
106 ASSERT (StdHeader != NULL);
107 ASSERT (MidParamsPtr != NULL);
109 MidParamsPtr->StdHeader = *StdHeader;
110 CommonPlatformConfigInit (&MidParamsPtr->PlatformConfig, &MidParamsPtr->StdHeader);
111 BldoptFchFunction.InitMidConstructor (MidParamsPtr);
113 return AGESA_SUCCESS;
117 /*---------------------------------------------------------------------------------------*/
119 * Main entry point for the AMD_INIT_MID function.
121 * This entry point is responsible for performing any necessary functions needed
122 * after PCI bus enumeration and just before control is passed to the video option ROM.
124 * @param[in,out] MidParams Required input parameters for the AMD_INIT_MID
127 * @return Aggregated status across all internal AMD mid calls invoked.
132 IN OUT AMD_MID_PARAMS *MidParams
135 AGESA_STATUS AgesaStatus;
136 AGESA_STATUS CalledStatus;
137 IDS_HDT_CONSOLE (MAIN_FLOW, "AmdInitMid: Start\n\n");
138 AGESA_TESTPOINT (TpIfAmdInitMidEntry, &MidParams->StdHeader);
139 IDS_PERF_TIME_MEASURE (&MidParams->StdHeader);
141 AgesaStatus = AGESA_SUCCESS;
143 ASSERT (MidParams != NULL);
144 IDS_OPTION_HOOK (IDS_INIT_MID_BEFORE, MidParams, &MidParams->StdHeader);
146 IDS_HDT_CONSOLE (MAIN_FLOW, "DispatchCpuFeatures: MidStart\n");
147 CalledStatus = DispatchCpuFeatures (CPU_FEAT_INIT_MID_END, &MidParams->PlatformConfig, &MidParams->StdHeader);
148 IDS_HDT_CONSOLE (MAIN_FLOW, "DispatchCpuFeatures: MidEnd\n");
149 if (CalledStatus > AgesaStatus) {
150 AgesaStatus = CalledStatus;
153 CalledStatus = BldoptFchFunction.InitMid (MidParams);
154 AgesaStatus = (CalledStatus > AgesaStatus) ? CalledStatus : AgesaStatus;
156 CalledStatus = GnbInitAtMid (MidParams);
157 if (CalledStatus > AgesaStatus) {
158 AgesaStatus = CalledStatus;
161 IDS_OPTION_HOOK (IDS_INIT_MID_AFTER, MidParams, &MidParams->StdHeader);
163 IDS_PERF_TIME_MEASURE (&MidParams->StdHeader);
164 AGESA_TESTPOINT (TpIfAmdInitMidExit, &MidParams->StdHeader);
165 IDS_HDT_CONSOLE (MAIN_FLOW, "\nAmdInitMid: End\n\n");
166 IDS_HDT_CONSOLE_FLUSH_BUFFER (&MidParams->StdHeader);