Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 1 | /* $NoKeywords:$ */ |
| 2 | /** |
| 3 | * @file |
| 4 | * |
| 5 | * AMD AGESA Basic Level Public APIs |
| 6 | * |
| 7 | * Contains basic Level Initialization routines. |
| 8 | * |
| 9 | * @xrefitem bom "File Content Label" "Release Content" |
| 10 | * @e project: AGESA |
| 11 | * @e sub-project: Interface |
| 12 | * @e \$Revision: 35136 $ @e \$Date: 2010-07-16 11:29:48 +0800 (Fri, 16 Jul 2010) $ |
| 13 | * |
| 14 | */ |
| 15 | /* |
| 16 | ***************************************************************************** |
| 17 | * |
| 18 | * Copyright (c) 2011, Advanced Micro Devices, Inc. |
| 19 | * All rights reserved. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 20 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 21 | * Redistribution and use in source and binary forms, with or without |
| 22 | * modification, are permitted provided that the following conditions are met: |
| 23 | * * Redistributions of source code must retain the above copyright |
| 24 | * notice, this list of conditions and the following disclaimer. |
| 25 | * * Redistributions in binary form must reproduce the above copyright |
| 26 | * notice, this list of conditions and the following disclaimer in the |
| 27 | * documentation and/or other materials provided with the distribution. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 28 | * * Neither the name of Advanced Micro Devices, Inc. nor the names of |
| 29 | * its contributors may be used to endorse or promote products derived |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 30 | * from this software without specific prior written permission. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 31 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 33 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 35 | * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY |
| 36 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 37 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 38 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 39 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 40 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 41 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 42 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 43 | * *************************************************************************** |
| 44 | * |
| 45 | */ |
| 46 | |
| 47 | |
| 48 | /*---------------------------------------------------------------------------------------- |
| 49 | * M O D U L E S U S E D |
| 50 | *---------------------------------------------------------------------------------------- |
| 51 | */ |
| 52 | #include "AGESA.h" |
| 53 | #include "Ids.h" |
| 54 | #include "cpuFeatures.h" |
| 55 | #include "CommonInits.h" |
efdesign98 | 84cbce2 | 2011-08-04 12:09:17 -0600 | [diff] [blame] | 56 | #include "CreateStruct.h" |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 57 | #include "GnbInterface.h" |
| 58 | #include "Filecode.h" |
| 59 | CODE_GROUP (G1_PEICC) |
| 60 | RDATA_GROUP (G1_PEICC) |
| 61 | |
| 62 | #define FILECODE PROC_COMMON_AMDINITMID_FILECODE |
| 63 | /*---------------------------------------------------------------------------------------- |
| 64 | * D E F I N I T I O N S A N D M A C R O S |
| 65 | *---------------------------------------------------------------------------------------- |
| 66 | */ |
| 67 | |
| 68 | |
| 69 | /*---------------------------------------------------------------------------------------- |
| 70 | * T Y P E D E F S A N D S T R U C T U R E S |
| 71 | *---------------------------------------------------------------------------------------- |
| 72 | */ |
| 73 | |
| 74 | |
| 75 | /*---------------------------------------------------------------------------------------- |
| 76 | * 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 |
| 77 | *---------------------------------------------------------------------------------------- |
| 78 | */ |
| 79 | |
| 80 | |
| 81 | /*---------------------------------------------------------------------------------------- |
| 82 | * E X P O R T E D F U N C T I O N S |
| 83 | *---------------------------------------------------------------------------------------- |
| 84 | */ |
| 85 | /* |
| 86 | *--------------------------------------------------------------------------------------- |
| 87 | * |
| 88 | * Initializer routine that will be invoked by the wrapper |
| 89 | * to initialize the input structure for the AmdInitMid |
| 90 | * |
| 91 | * @param[in,out] MidParamsPtr Newly created interface parameters for AmdInitMid |
| 92 | * |
| 93 | * @retval AGESA_SUCCESS Always succeeds |
| 94 | * |
| 95 | *--------------------------------------------------------------------------------------- |
| 96 | */ |
| 97 | AGESA_STATUS |
| 98 | AmdInitMidInitializer ( |
| 99 | IN AMD_CONFIG_PARAMS *StdHeader, |
| 100 | IN OUT AMD_MID_PARAMS *MidParamsPtr |
| 101 | ) |
| 102 | { |
| 103 | ASSERT (StdHeader != NULL); |
| 104 | ASSERT (MidParamsPtr != NULL); |
| 105 | |
| 106 | MidParamsPtr->StdHeader = *StdHeader; |
| 107 | CommonPlatformConfigInit (&MidParamsPtr->PlatformConfig, &MidParamsPtr->StdHeader); |
| 108 | |
| 109 | return AGESA_SUCCESS; |
| 110 | } |
| 111 | |
| 112 | |
| 113 | /*---------------------------------------------------------------------------------------*/ |
| 114 | /** |
| 115 | * Main entry point for the AMD_INIT_MID function. |
| 116 | * |
| 117 | * This entry point is responsible for performing any necessary functions needed |
| 118 | * after PCI bus enumeration and just before control is passed to the video option ROM. |
| 119 | * |
| 120 | * @param[in,out] MidParams Required input parameters for the AMD_INIT_MID |
| 121 | * entry point. |
| 122 | * |
| 123 | * @return Aggregated status across all internal AMD mid calls invoked. |
| 124 | * |
| 125 | */ |
| 126 | AGESA_STATUS |
| 127 | AmdInitMid ( |
| 128 | IN OUT AMD_MID_PARAMS *MidParams |
| 129 | ) |
| 130 | { |
| 131 | AGESA_STATUS AgesaStatus; |
| 132 | AGESA_STATUS CalledStatus; |
| 133 | IDS_HDT_CONSOLE (MAIN_FLOW, "AmdInitMid: Start\n\n"); |
| 134 | AGESA_TESTPOINT (TpIfAmdInitMidEntry, &MidParams->StdHeader); |
| 135 | IDS_PERF_TIME_MEASURE (&MidParams->StdHeader); |
| 136 | |
| 137 | AgesaStatus = AGESA_SUCCESS; |
| 138 | |
| 139 | ASSERT (MidParams != NULL); |
| 140 | IDS_OPTION_HOOK (IDS_INIT_MID_BEFORE, MidParams, &MidParams->StdHeader); |
| 141 | |
| 142 | IDS_HDT_CONSOLE (MAIN_FLOW, "DispatchCpuFeatures: MidStart\n"); |
| 143 | CalledStatus = DispatchCpuFeatures (CPU_FEAT_INIT_MID_END, &MidParams->PlatformConfig, &MidParams->StdHeader); |
| 144 | IDS_HDT_CONSOLE (MAIN_FLOW, "DispatchCpuFeatures: MidEnd\n"); |
| 145 | if (CalledStatus > AgesaStatus) { |
| 146 | AgesaStatus = CalledStatus; |
| 147 | } |
| 148 | |
| 149 | CalledStatus = GnbInitAtMid (MidParams); |
| 150 | if (CalledStatus > AgesaStatus) { |
| 151 | AgesaStatus = CalledStatus; |
| 152 | } |
| 153 | |
| 154 | IDS_OPTION_HOOK (IDS_INIT_MID_AFTER, MidParams, &MidParams->StdHeader); |
| 155 | |
| 156 | IDS_PERF_TIME_MEASURE (&MidParams->StdHeader); |
| 157 | AGESA_TESTPOINT (TpIfAmdInitMidExit, &MidParams->StdHeader); |
| 158 | IDS_HDT_CONSOLE (MAIN_FLOW, "\nAmdInitMid: End\n\n"); |
| 159 | IDS_HDT_CONSOLE_FLUSH_BUFFER (&MidParams->StdHeader); |
| 160 | return AgesaStatus; |
| 161 | } |
| 162 | |
| 163 | |