Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 1 | /* $NoKeywords:$ */ |
| 2 | /** |
| 3 | * @file |
| 4 | * |
| 5 | * External Interface implementation. |
| 6 | * |
| 7 | * Contains routines for implementing the interface to the client BIOS. |
| 8 | * This file includes the interface access constructor. |
| 9 | * This file implements build options using conditional compilation. |
| 10 | * |
| 11 | * @xrefitem bom "File Content Label" "Release Content" |
| 12 | * @e project: AGESA |
| 13 | * @e sub-project: HyperTransport |
| 14 | * @e \$Revision: 35136 $ @e \$Date: 2010-07-16 11:29:48 +0800 (Fri, 16 Jul 2010) $ |
| 15 | * |
| 16 | */ |
| 17 | /* |
| 18 | ***************************************************************************** |
| 19 | * |
| 20 | * Copyright (c) 2011, Advanced Micro Devices, Inc. |
| 21 | * All rights reserved. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 22 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 23 | * Redistribution and use in source and binary forms, with or without |
| 24 | * modification, are permitted provided that the following conditions are met: |
| 25 | * * Redistributions of source code must retain the above copyright |
| 26 | * notice, this list of conditions and the following disclaimer. |
| 27 | * * Redistributions in binary form must reproduce the above copyright |
| 28 | * notice, this list of conditions and the following disclaimer in the |
| 29 | * documentation and/or other materials provided with the distribution. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 30 | * * Neither the name of Advanced Micro Devices, Inc. nor the names of |
| 31 | * its contributors may be used to endorse or promote products derived |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 32 | * from this software without specific prior written permission. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 33 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 34 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 35 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 36 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 37 | * DISCLAIMED. IN NO EVENT SHALL ADVANCED MICRO DEVICES, INC. BE LIABLE FOR ANY |
| 38 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 39 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 40 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 41 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 42 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 43 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Edward O'Callaghan | 1542a6f | 2014-07-06 19:24:06 +1000 | [diff] [blame] | 44 | * |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 45 | * *************************************************************************** |
| 46 | * |
| 47 | */ |
| 48 | |
| 49 | /* |
| 50 | *---------------------------------------------------------------------------- |
| 51 | * MODULES USED |
| 52 | * |
| 53 | *---------------------------------------------------------------------------- |
| 54 | */ |
| 55 | |
| 56 | |
| 57 | |
| 58 | #include "AGESA.h" |
| 59 | #include "AdvancedApi.h" |
| 60 | #include "amdlib.h" |
| 61 | #include "OptionsHt.h" |
| 62 | #include "Ids.h" |
| 63 | #include "Topology.h" |
| 64 | #include "htFeat.h" |
| 65 | #include "htInterface.h" |
| 66 | #include "CommonReturns.h" |
| 67 | #include "htInterfaceGeneral.h" |
| 68 | #include "htInterfaceCoherent.h" |
| 69 | #include "htInterfaceNonCoherent.h" |
| 70 | #include "Filecode.h" |
| 71 | CODE_GROUP (G1_PEICC) |
| 72 | RDATA_GROUP (G1_PEICC) |
| 73 | |
| 74 | #define FILECODE PROC_HT_HTINTERFACE_FILECODE |
| 75 | /*---------------------------------------------------------------------------- |
| 76 | * DEFINITIONS AND MACROS |
| 77 | * |
| 78 | *---------------------------------------------------------------------------- |
| 79 | */ |
| 80 | |
| 81 | extern CONST OPTION_HT_CONFIGURATION OptionHtConfiguration; |
| 82 | |
| 83 | /*---------------------------------------------------------------------------- |
| 84 | * TYPEDEFS AND STRUCTURES |
| 85 | * |
| 86 | *---------------------------------------------------------------------------- |
| 87 | */ |
| 88 | |
| 89 | /** |
| 90 | * The default initializer for the HT internal interface, full features. |
| 91 | */ |
| 92 | CONST HT_INTERFACE ROMDATA HtInterfaceDefault = |
| 93 | { |
| 94 | GetCpu2CpuPcbLimits, |
| 95 | GetSkipRegang, |
| 96 | NewHopCountTable, |
| 97 | GetOverrideBusNumbers, |
| 98 | GetManualBuidSwapList, |
| 99 | GetDeviceCapOverride, |
| 100 | GetIoPcbLimits, |
| 101 | GetSocketFromMap, |
| 102 | GetIgnoreLink, |
| 103 | PostMapToAp, |
| 104 | NewNodeAndSocketTables, |
| 105 | CleanMapsAfterError, |
| 106 | SetNodeToSocketMap, |
| 107 | GetMinNbCoreFreq |
| 108 | }; |
| 109 | |
| 110 | /** |
| 111 | * The non-coherent only build option initializer for the HT internal interface. |
| 112 | */ |
| 113 | CONST HT_INTERFACE ROMDATA HtInterfaceNonCoherentOnly = |
| 114 | { |
| 115 | (PF_GET_CPU_2_CPU_PCB_LIMITS)CommonVoid, |
| 116 | (PF_GET_SKIP_REGANG)CommonReturnFalse, |
| 117 | (PF_NEW_HOP_COUNT_TABLE)CommonVoid, |
| 118 | GetOverrideBusNumbers, |
| 119 | GetManualBuidSwapList, |
| 120 | GetDeviceCapOverride, |
| 121 | GetIoPcbLimits, |
| 122 | GetSocketFromMap, |
| 123 | GetIgnoreLink, |
| 124 | PostMapToAp, |
| 125 | NewNodeAndSocketTables, |
| 126 | (PF_CLEAN_MAPS_AFTER_ERROR)CommonVoid, |
| 127 | SetNodeToSocketMap, |
| 128 | GetMinNbCoreFreq |
| 129 | }; |
| 130 | |
| 131 | /** |
| 132 | * Topology Maps only feature build option initializer for the HT internal interface. |
| 133 | */ |
| 134 | CONST HT_INTERFACE ROMDATA HtInterfaceMapsOnly = |
| 135 | { |
| 136 | (PF_GET_CPU_2_CPU_PCB_LIMITS)CommonVoid, |
| 137 | (PF_GET_SKIP_REGANG)CommonReturnFalse, |
| 138 | (PF_NEW_HOP_COUNT_TABLE)CommonVoid, |
| 139 | (PF_GET_OVERRIDE_BUS_NUMBERS)CommonReturnFalse, |
| 140 | (PF_GET_MANUAL_BUID_SWAP_LIST)CommonReturnFalse, |
| 141 | (PF_GET_DEVICE_CAP_OVERRIDE)CommonVoid, |
| 142 | (PF_GET_IO_PCB_LIMITS)CommonVoid, |
| 143 | (PF_GET_SOCKET_FROM_MAP)CommonReturnZero8, |
| 144 | (PF_GET_IGNORE_LINK)CommonReturnFalse, |
| 145 | PostMapToAp, |
| 146 | NewNodeAndSocketTables, |
| 147 | (PF_CLEAN_MAPS_AFTER_ERROR)CommonVoid, |
| 148 | SetNodeToSocketMap, |
| 149 | (PF_GET_MIN_NB_CORE_FREQ)CommonReturnZero8 |
| 150 | }; |
| 151 | |
| 152 | /** |
| 153 | * No features build option initializer for the HT internal interface. |
| 154 | */ |
| 155 | CONST HT_INTERFACE ROMDATA HtInterfaceNone = |
| 156 | { |
| 157 | (PF_GET_CPU_2_CPU_PCB_LIMITS)CommonVoid, |
| 158 | (PF_GET_SKIP_REGANG)CommonReturnFalse, |
| 159 | (PF_NEW_HOP_COUNT_TABLE)CommonVoid, |
| 160 | (PF_GET_OVERRIDE_BUS_NUMBERS)CommonReturnFalse, |
| 161 | (PF_GET_MANUAL_BUID_SWAP_LIST)CommonReturnFalse, |
| 162 | (PF_GET_DEVICE_CAP_OVERRIDE)CommonVoid, |
| 163 | (PF_GET_IO_PCB_LIMITS)CommonVoid, |
| 164 | (PF_GET_SOCKET_FROM_MAP)CommonReturnZero8, |
| 165 | (PF_GET_IGNORE_LINK)CommonReturnFalse, |
| 166 | (PF_POST_MAP_TO_AP)CommonVoid, |
| 167 | (PF_NEW_NODE_AND_SOCKET_TABLES)CommonVoid, |
| 168 | (PF_CLEAN_MAPS_AFTER_ERROR)CommonVoid, |
| 169 | (PF_SET_NODE_TO_SOCKET_MAP)CommonVoid, |
| 170 | (PF_GET_MIN_NB_CORE_FREQ)CommonReturnZero8 |
| 171 | }; |
| 172 | |
| 173 | /*---------------------------------------------------------------------------- |
| 174 | * PROTOTYPES OF LOCAL FUNCTIONS |
| 175 | * |
| 176 | *---------------------------------------------------------------------------- |
| 177 | */ |
| 178 | |
| 179 | /*---------------------------------------------------------------------------- |
| 180 | * EXPORTED FUNCTIONS |
| 181 | * |
| 182 | *---------------------------------------------------------------------------- |
| 183 | */ |
| 184 | |
| 185 | /*---------------------------------------------------------------------------- |
| 186 | * LOCAL FUNCTIONS |
| 187 | * |
| 188 | *---------------------------------------------------------------------------- |
| 189 | */ |
| 190 | |
| 191 | /*----------------------------------------------------------------------------------------*/ |
| 192 | /** |
| 193 | * A constructor for the internal Ht Interface. |
| 194 | * |
| 195 | * The install has a reference to the initializer appropriate to the user selected build |
| 196 | * options. Use the selected initializer to construct the internal interface. |
| 197 | * |
| 198 | * @param[in,out] HtInterface Contains pointer to HT Interface structure to initialize. |
| 199 | * @param[in] StdHeader Opaque handle to standard config header |
| 200 | * |
| 201 | */ |
| 202 | VOID |
| 203 | NewHtInterface ( |
| 204 | OUT HT_INTERFACE *HtInterface, |
| 205 | IN AMD_CONFIG_PARAMS *StdHeader |
| 206 | ) |
| 207 | { |
| 208 | LibAmdMemCopy ( |
| 209 | (VOID *) HtInterface, |
| 210 | (VOID *) OptionHtConfiguration.HtOptionInternalInterface, |
| 211 | (sizeof (HT_INTERFACE)), |
| 212 | StdHeader |
| 213 | ); |
| 214 | } |
| 215 | |
| 216 | /*----------------------------------------------------------------------------------------*/ |
| 217 | /** |
| 218 | * A "constructor" for the HyperTransport external interface. |
| 219 | * |
| 220 | * Sets inputs to valid, basic level, defaults. |
| 221 | * |
| 222 | * Copy the initial default values from the build options tables to the interface struct. |
| 223 | * |
| 224 | * @param[in] StdHeader Opaque handle to standard config header |
| 225 | * @param[in] AmdHtInterface HT Interface structure to initialize. |
| 226 | * |
| 227 | * @retval AGESA_SUCCESS Constructors are not allowed to fail |
| 228 | */ |
| 229 | AGESA_STATUS |
| 230 | AmdHtInterfaceConstructor ( |
| 231 | IN AMD_CONFIG_PARAMS *StdHeader, |
| 232 | IN AMD_HT_INTERFACE *AmdHtInterface |
| 233 | ) |
| 234 | { |
| 235 | LibAmdMemCopy ( |
| 236 | (VOID *) AmdHtInterface, |
| 237 | (VOID *) OptionHtConfiguration.HtOptionPlatformDefaults, |
| 238 | (UINT32) (sizeof (AMD_HT_INTERFACE)), |
| 239 | StdHeader |
| 240 | ); |
| 241 | return AGESA_SUCCESS; |
| 242 | } |