Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 1 | /* $NoKeywords:$ */ |
| 2 | /** |
| 3 | * @file |
| 4 | * |
| 5 | * mnflowon.c |
| 6 | * |
| 7 | * Llano initializer for MCT and DCT |
| 8 | * |
| 9 | * @xrefitem bom "File Content Label" "Release Content" |
| 10 | * @e project: AGESA |
| 11 | * @e sub-project: (Mem/Main) |
| 12 | * @e \$Revision: 34897 $ @e \$Date: 2010-07-14 10:07:10 +0800 (Wed, 14 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 | * MODULES USED |
| 50 | * |
| 51 | *---------------------------------------------------------------------------- |
| 52 | */ |
| 53 | |
| 54 | |
| 55 | |
| 56 | #include "AGESA.h" |
| 57 | #include "AdvancedApi.h" |
| 58 | #include "amdlib.h" |
| 59 | #include "Ids.h" |
| 60 | #include "OptionMemory.h" |
| 61 | #include "mm.h" |
| 62 | #include "mn.h" |
efdesign98 | 84cbce2 | 2011-08-04 12:09:17 -0600 | [diff] [blame] | 63 | #include "mnon.h" |
Frank Vibrans | 2b4c831 | 2011-02-14 18:30:54 +0000 | [diff] [blame] | 64 | #include "mt.h" |
| 65 | #include "Filecode.h" |
| 66 | #include "GeneralServices.h" |
| 67 | #define FILECODE PROC_MEM_NB_ON_MNFLOWON_FILECODE |
| 68 | /* features */ |
| 69 | #include "mftds.h" |
| 70 | /*---------------------------------------------------------------------------- |
| 71 | * DEFINITIONS AND MACROS |
| 72 | * |
| 73 | *---------------------------------------------------------------------------- |
| 74 | */ |
| 75 | |
| 76 | /*---------------------------------------------------------------------------- |
| 77 | * TYPEDEFS AND STRUCTURES |
| 78 | * |
| 79 | *---------------------------------------------------------------------------- |
| 80 | */ |
| 81 | |
| 82 | /*---------------------------------------------------------------------------- |
| 83 | * PROTOTYPES OF LOCAL FUNCTIONS |
| 84 | * |
| 85 | *---------------------------------------------------------------------------- |
| 86 | */ |
| 87 | |
| 88 | /*---------------------------------------------------------------------------- |
| 89 | * EXPORTED FUNCTIONS |
| 90 | * |
| 91 | *---------------------------------------------------------------------------- |
| 92 | */ |
| 93 | extern MEM_PLAT_SPEC_CFG* memPlatSpecFFInstalledON[MAX_FF_TYPES]; |
| 94 | |
| 95 | /* -----------------------------------------------------------------------------*/ |
| 96 | /** |
| 97 | * |
| 98 | * |
| 99 | * This function initializes the platform specific block |
| 100 | * |
| 101 | * |
| 102 | * @param[in,out] *NBPtr - Pointer to the MEM_NB_BLOCK |
| 103 | * |
| 104 | * @return TRUE - AGESA_SUCCESS at least one dorm factor was found |
| 105 | * @return FALSE - AGESA_UNSUPPORTED - Error indicating that no form factors were found |
| 106 | */ |
| 107 | |
| 108 | BOOLEAN |
| 109 | MemNPlatformSpecificFormFactorInitON ( |
| 110 | IN OUT MEM_NB_BLOCK *NBPtr |
| 111 | ) |
| 112 | { |
| 113 | UINT8 f; |
| 114 | |
| 115 | if (NBPtr->MCTPtr->DimmValid == 0) { |
| 116 | PutEventLog (AGESA_FATAL, MEM_ERROR_NO_DIMM_FOUND_ON_SYSTEM, 0, 0, 0, 0, &(NBPtr->MemPtr->StdHeader)); |
| 117 | SetMemError (AGESA_FATAL, NBPtr->MCTPtr); |
| 118 | ASSERT(FALSE); // Size of memory on BSP = 0, so no DIMM found |
| 119 | return FALSE; // There is no dimm present on the system. |
| 120 | } |
| 121 | for (f = 0; memPlatSpecFFInstalledON[f] != NULL; f++) { |
| 122 | if (memPlatSpecFFInstalledON[f] (NBPtr->MemPtr, NBPtr->ChannelPtr, NBPtr->PsPtr) == AGESA_SUCCESS) { |
| 123 | break; |
| 124 | } |
| 125 | } |
| 126 | if (memPlatSpecFFInstalledON[f] == NULL) { |
| 127 | return FALSE; // No FF types are supported |
| 128 | } |
| 129 | return TRUE; |
| 130 | } |
| 131 | |
| 132 | /* -----------------------------------------------------------------------------*/ |
| 133 | /** |
| 134 | * |
| 135 | * This function selects appropriate Tech functions for the NB. |
| 136 | * |
| 137 | * @param[in,out] *NBPtr - Pointer to the MEM_NB_BLOCK |
| 138 | * |
| 139 | */ |
| 140 | |
| 141 | VOID |
| 142 | MemNTechBlockSwitchON ( |
| 143 | IN OUT MEM_NB_BLOCK *NBPtr |
| 144 | ) |
| 145 | { |
| 146 | MEM_TECH_BLOCK *TechPtr; |
| 147 | |
| 148 | TechPtr = NBPtr->TechPtr; |
| 149 | |
| 150 | // Specify Dimm-Byte training for Nb |
| 151 | MemTDimmByteTrainInit (TechPtr); |
| 152 | |
| 153 | // Remove the following functions because they are not needed for ON |
| 154 | TechPtr->SetDramMode = (BOOLEAN (*) (MEM_TECH_BLOCK *)) memDefTrue; |
| 155 | TechPtr->SpdCalcWidth = (BOOLEAN (*) (MEM_TECH_BLOCK *)) memDefTrue; |
| 156 | TechPtr->SetDqsEccTmgs = (BOOLEAN (*) (MEM_TECH_BLOCK *)) memDefTrue; |
| 157 | TechPtr->AdjustTwrwr = (VOID (*) (MEM_TECH_BLOCK *)) memDefRet; |
| 158 | TechPtr->AdjustTwrrd = (VOID (*) (MEM_TECH_BLOCK *)) memDefRet; |
| 159 | TechPtr->GetLD = (INT8 (*) (MEM_TECH_BLOCK *)) memDefRet; |
| 160 | TechPtr->FindMaxDlyForMaxRdLat = MemTFindMaxRcvrEnDlyRdDqsDlyByte; |
| 161 | TechPtr->ResetDCTWrPtr = (VOID (*) (MEM_TECH_BLOCK *, UINT8)) memDefRet; |
| 162 | } |
| 163 | |
| 164 | /*---------------------------------------------------------------------------- |
| 165 | * LOCAL FUNCTIONS |
| 166 | * |
| 167 | *---------------------------------------------------------------------------- |
| 168 | */ |
| 169 | |