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 "Options.h" |
efdesign98 | 84cbce2 | 2011-08-04 12:09:17 -0600 | [diff] [blame] | 55 | #include "CreateStruct.h" |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 56 | #include "Filecode.h" |
| 57 | CODE_GROUP (G3_DXE) |
| 58 | RDATA_GROUP (G3_DXE) |
| 59 | |
| 60 | #define FILECODE PROC_COMMON_AMDLATERUNAPTASK_FILECODE |
| 61 | /*---------------------------------------------------------------------------------------- |
| 62 | * D E F I N I T I O N S A N D M A C R O S |
| 63 | *---------------------------------------------------------------------------------------- |
| 64 | */ |
| 65 | |
| 66 | |
| 67 | /*---------------------------------------------------------------------------------------- |
| 68 | * T Y P E D E F S A N D S T R U C T U R E S |
| 69 | *---------------------------------------------------------------------------------------- |
| 70 | */ |
| 71 | |
| 72 | |
| 73 | /*---------------------------------------------------------------------------------------- |
| 74 | * 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 |
| 75 | *---------------------------------------------------------------------------------------- |
| 76 | */ |
| 77 | |
| 78 | |
| 79 | /*---------------------------------------------------------------------------------------- |
| 80 | * E X P O R T E D F U N C T I O N S |
| 81 | *---------------------------------------------------------------------------------------- |
| 82 | */ |
| 83 | extern CONST DISPATCH_TABLE ApDispatchTable[]; |
| 84 | |
| 85 | /*---------------------------------------------------------------------------------------*/ |
| 86 | /** |
| 87 | * Application Processor perform a function as directed by the BSC. |
| 88 | * |
| 89 | * This is needed for an AP task that must run after AGESA has relinquished control |
| 90 | * of the APs to the IBV. |
| 91 | * |
| 92 | * @param[in] AmdApExeParams The interface struct for any required routine. |
| 93 | * |
| 94 | * @return The most severe AGESA_STATUS returned by any called service. Note |
| 95 | * that this will be the return value passed back to the BSC as the |
| 96 | * return value for the call out. |
| 97 | * |
| 98 | */ |
| 99 | AGESA_STATUS |
| 100 | AmdLateRunApTask ( |
| 101 | IN AP_EXE_PARAMS *AmdApExeParams |
| 102 | ) |
| 103 | { |
| 104 | AGESA_STATUS CalledAgesaStatus; |
| 105 | AGESA_STATUS ApLateTaskStatus; |
| 106 | DISPATCH_TABLE *Entry; |
| 107 | |
| 108 | AGESA_TESTPOINT (TpIfAmdLateRunApTaskEntry, &AmdApExeParams->StdHeader); |
| 109 | |
| 110 | ASSERT (AmdApExeParams != NULL); |
| 111 | ApLateTaskStatus = AGESA_SUCCESS; |
| 112 | CalledAgesaStatus = AGESA_UNSUPPORTED; |
| 113 | |
| 114 | // Dispatch, if valid |
| 115 | Entry = (DISPATCH_TABLE *) ApDispatchTable; |
| 116 | while (Entry->FunctionId != 0) { |
| 117 | if (AmdApExeParams->FunctionNumber == Entry->FunctionId) { |
| 118 | CalledAgesaStatus = Entry->EntryPoint (AmdApExeParams); |
| 119 | break; |
| 120 | } |
| 121 | Entry++; |
| 122 | } |
| 123 | |
| 124 | if (CalledAgesaStatus > ApLateTaskStatus) { |
| 125 | ApLateTaskStatus = CalledAgesaStatus; |
| 126 | } |
| 127 | |
| 128 | AGESA_TESTPOINT (TpIfAmdLateRunApTaskExit, &AmdApExeParams->StdHeader); |
| 129 | return ApLateTaskStatus; |
| 130 | } |
| 131 | |
| 132 | /*---------------------------------------------------------------------------------------*/ |
| 133 | /** |
| 134 | * Constructor for the AMD_LATE_RUN_AP_TASK function. |
| 135 | * |
| 136 | * This routine is responsible for setting default values for the |
| 137 | * input parameters needed by the AMD_S3_SAVE entry point. |
| 138 | * |
| 139 | * @param[in] StdHeader The standard header. |
| 140 | * @param[in,out] AmdApExeParams Required input parameters for the AMD_LATE_RUN_AP_TASK |
| 141 | * entry point. |
| 142 | * |
| 143 | * @retval AGESA_SUCCESS Always Succeeds. |
| 144 | * |
| 145 | */ |
| 146 | AGESA_STATUS |
| 147 | AmdLateRunApTaskInitializer ( |
| 148 | IN AMD_CONFIG_PARAMS *StdHeader, |
| 149 | IN OUT AP_EXE_PARAMS *AmdApExeParams |
| 150 | ) |
| 151 | { |
| 152 | ASSERT (StdHeader != NULL); |
| 153 | ASSERT (AmdApExeParams != NULL); |
| 154 | |
| 155 | AmdApExeParams->StdHeader = *StdHeader; |
| 156 | AmdApExeParams->FunctionNumber = 0; |
| 157 | AmdApExeParams->RelatedDataBlock = NULL; |
| 158 | AmdApExeParams->RelatedBlockLength = 0; |
| 159 | return AGESA_SUCCESS; |
| 160 | } |
| 161 | |