7 * Platform specific settings for C32 DDR3 R-DIMM system
9 * @xrefitem bom "File Content Label" "Release Content"
11 * @e sub-project: (Mem/Ps)
12 * @e \$Revision: 52286 $ @e \$Date: 2011-05-04 03:48:21 -0600 (Wed, 04 May 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 * ***************************************************************************
48 #include "AdvancedApi.h"
52 #include "cpuFamRegisters.h"
57 #include "OptionMemory.h"
58 #include "PlatformMemoryConfiguration.h"
59 #include "GeneralServices.h"
63 #define FILECODE PROC_MEM_PS_C32_MPRC32_3_FILECODE
64 /*----------------------------------------------------------------------------
65 * DEFINITIONS AND MACROS
67 *----------------------------------------------------------------------------
69 #define AMD_FAMILY_10_C32 AMD_FAMILY_10_HY
71 /*----------------------------------------------------------------------------
72 * TYPEDEFS AND STRUCTURES
74 *----------------------------------------------------------------------------
77 /*----------------------------------------------------------------------------
78 * PROTOTYPES OF LOCAL FUNCTIONS
80 *----------------------------------------------------------------------------
85 IN OUT MEM_NB_BLOCK *NBPtr
90 MemPGetPORFreqLimitRC32_3 (
91 IN OUT MEM_NB_BLOCK *NBPtr
94 *-----------------------------------------------------------------------------
97 *-----------------------------------------------------------------------------
101 * ODT Settings for 1 or 2 Dimms Per Channel
103 * Speeds Supported, # of Dimms, # of QRDimms, DramTerm, QR DramTerm, Dynamic DramTerm
105 STATIC CONST DRAM_TERM_ENTRY C32RDdr3DramTerm2D[] = {
106 {DDR667 + DDR800 + DDR1066 + DDR1333 + DDR1600, ONE_DIMM, NO_DIMM, 1, 0, 0},
107 {DDR667 + DDR800 + DDR1066, TWO_DIMM, NO_DIMM, 3, 0, 2},
108 {DDR1333, TWO_DIMM, NO_DIMM, 5, 0, 2},
109 {DDR1600, TWO_DIMM, NO_DIMM, 5, 0, 1},
110 {DDR667 + DDR800 + DDR1066 + DDR1333, ONE_DIMM, ONE_DIMM, 0, 1, 2},
111 {DDR1600, ONE_DIMM, ONE_DIMM, 0, 1, 1},
112 {DDR667 + DDR800, TWO_DIMM, ONE_DIMM, 5, 1, 2},
113 {DDR1066 + DDR1333 + DDR1600, TWO_DIMM, ONE_DIMM, 5, 1, 1},
114 {DDR667 + DDR800, TWO_DIMM, TWO_DIMM, 0, 1, 2},
115 {DDR1066 + DDR1333 + DDR1600, TWO_DIMM, TWO_DIMM, 0, 1, 1}
118 * ODT Settings for 3 Dimms Per Channel
120 * Speeds Supported, # of Dimms, # of QRDimms, DramTerm, QR DramTerm, Dynamic DramTerm
122 STATIC CONST DRAM_TERM_ENTRY C32RDdr3DramTerm3D[] = {
123 {DDR667 + DDR800 + DDR1066 + DDR1333 + DDR1600, ONE_DIMM, NO_DIMM, 1, 0, 0},
124 {DDR667 + DDR800 + DDR1066, TWO_DIMM, NO_DIMM, 3, 0, 2},
125 {DDR1333 + DDR1600, TWO_DIMM, NO_DIMM, 5, 0, 2},
126 {DDR667 + DDR800 + DDR1066 + DDR1333 + DDR1600, THREE_DIMM, NO_DIMM, 3, 0, 2},
127 {DDR667 + DDR800 + DDR1066 + DDR1333, ONE_DIMM, ONE_DIMM, 0, 1, 2},
128 {DDR667 + DDR800, TWO_DIMM, ONE_DIMM, 5, 1, 2},
129 {DDR1066 + DDR1333 + DDR1600, TWO_DIMM, ONE_DIMM, 5, 1, 1},
130 {DDR667 + DDR800 + DDR1066 + DDR1333 + DDR1600, THREE_DIMM, ONE_DIMM, 3, 1, 2}
133 * POR Max Frequency supported for specific Dimm configurations for 1 Dimm Per Channel
135 * Dimm Config, # of Dimms, Max Freq @ 1.5V, Max Freq @ 1.35V, Max Freq @ 1.25
137 STATIC CONST POR_SPEED_LIMIT C32RDdr3PSPorFreqLimit1D[] = {
138 {SR_DIMM0 + DR_DIMM0, 1, DDR1333_FREQUENCY, DDR1333_FREQUENCY, 0},
139 {QR_DIMM0, 1, DDR1333_FREQUENCY, DDR1333_FREQUENCY, 0}
142 * POR Max Frequency supported for specific Dimm configurations for 2 Dimms Per Channel
144 * Dimm Config, # of Dimms, Max Freq @ 1.5V, Max Freq @ 1.35V, Max Freq @ 1.25
146 STATIC CONST POR_SPEED_LIMIT C32RDdr3PSPorFreqLimit2D[] = {
147 {SR_DIMM1 + DR_DIMM1, 1, DDR1333_FREQUENCY, DDR1333_FREQUENCY, 0},
148 {QR_DIMM1, 1, DDR1333_FREQUENCY, DDR1066_FREQUENCY, 0},
149 {SR_DIMM0 + SR_DIMM1, 2, DDR1333_FREQUENCY, DDR1333_FREQUENCY, 0},
150 {SR_DIMM0 + DR_DIMM0 + SR_DIMM1 + DR_DIMM1, 2, DDR1066_FREQUENCY, DDR1066_FREQUENCY, 0},
151 {QR_DIMM0 + ANY_DIMM1, 2, DDR800_FREQUENCY, DDR667_FREQUENCY, 0},
152 {ANY_DIMM0 + QR_DIMM1, 2, DDR800_FREQUENCY, DDR667_FREQUENCY, 0}
155 * POR Max Frequency supported for specific Dimm configurations for 3 Dimms Per Channel
157 * Dimm Config, # of Dimms, Max Freq @ 1.5V, Max Freq @ 1.35V, Max Freq @ 1.25
159 STATIC CONST POR_SPEED_LIMIT C32RDdr3PSPorFreqLimit3D[] = {
160 {SR_DIMM2 + DR_DIMM2, 1, DDR1333_FREQUENCY, DDR1333_FREQUENCY, 0},
161 {SR_DIMM0 + SR_DIMM2, 2, DDR1333_FREQUENCY, DDR1333_FREQUENCY, 0},
162 {SR_DIMM0 + DR_DIMM0 + SR_DIMM2 + DR_DIMM2, 2, DDR1066_FREQUENCY, DDR1066_FREQUENCY, 0},
163 {QR_DIMM1, 1, DDR800_FREQUENCY, DDR800_FREQUENCY, 0},
164 {QR_DIMM1 + SR_DIMM2 + DR_DIMM2, 2, DDR800_FREQUENCY, DDR667_FREQUENCY, 0},
165 {SR_DIMM0 + SR_DIMM1 + SR_DIMM2, 3, DDR1066_FREQUENCY, DDR800_FREQUENCY, 0},
166 {SR_DIMM0 + DR_DIMM0 + SR_DIMM1 + DR_DIMM1 + SR_DIMM2 + DR_DIMM2, 3, DDR800_FREQUENCY, DDR800_FREQUENCY, 0},
167 {SR_DIMM0 + DR_DIMM0 + QR_DIMM1 + SR_DIMM2 + DR_DIMM2, 3, DDR667_FREQUENCY, DDR667_FREQUENCY, 0}
170 /* -----------------------------------------------------------------------------*/
173 * This function is the constructor platform specific settings for R DIMM-DDR3 C32 DDR3
175 * @param[in,out] *MemPtr Pointer to MEM_DATA_STRUCTURE
176 * @param[in,out] *ChannelPtr Pointer to CH_DEF_STRUCT
177 * @param[in,out] *PsPtr Pointer to MEM_PS_BLOCK
179 * @return AGESA_SUCCESS
184 MemPConstructPsRC32_3 (
185 IN OUT MEM_DATA_STRUCT *MemPtr,
186 IN OUT CH_DEF_STRUCT *ChannelPtr,
187 IN OUT MEM_PS_BLOCK *PsPtr
190 ASSERT (MemPtr != 0);
191 ASSERT (ChannelPtr != 0);
193 if ((ChannelPtr->MCTPtr->LogicalCpuid.Family & AMD_FAMILY_10_C32) == 0) {
194 return AGESA_UNSUPPORTED;
196 if (ChannelPtr->TechType != DDR3_TECHNOLOGY) {
197 return AGESA_UNSUPPORTED;
199 if (ChannelPtr->RegDimmPresent != ChannelPtr->ChDimmValid) {
200 return AGESA_UNSUPPORTED;
202 PsPtr->MemPDoPs = MemPDoPsRC32_3;
203 PsPtr->MemPGetPORFreqLimit = MemPGetPORFreqLimitRC32_3;
204 return AGESA_SUCCESS;
207 /* -----------------------------------------------------------------------------*/
210 * This is function sets the platform specific settings for R-DDR3 C32 DDR3
212 * @param[in,out] *NBPtr Pointer to MEM_NB_BLOCK
214 * @return TRUE - Find settings for corresponding platform and dimm population.
215 * @return FALSE - Fail to find settings for corresponding platform and dimm population.
222 IN OUT MEM_NB_BLOCK *NBPtr
225 CONST DRAM_TERM_ENTRY *DramTermPtr;
226 UINT8 MaxDimmsPerChannel;
227 UINT8 *DimmsPerChPtr;
232 DimmsPerChPtr = FindPSOverrideEntry (NBPtr->RefPtr->PlatformMemoryConfiguration, PSO_MAX_DIMMS, NBPtr->MCTPtr->SocketId, NBPtr->ChannelPtr->ChannelID, 0, NULL, NULL);
233 if (DimmsPerChPtr != NULL) {
234 MaxDimmsPerChannel = *DimmsPerChPtr;
236 MaxDimmsPerChannel = 2;
239 if ((MaxDimmsPerChannel == 1) || (MaxDimmsPerChannel == 2)) {
240 DramTermSize = GET_SIZE_OF (C32RDdr3DramTerm2D);
241 DramTermPtr = C32RDdr3DramTerm2D;
242 } else if (MaxDimmsPerChannel == 3) {
243 DramTermSize = GET_SIZE_OF (C32RDdr3DramTerm3D);
244 DramTermPtr = C32RDdr3DramTerm3D;
249 if (!MemPGetDramTerm (NBPtr, DramTermSize, DramTermPtr)) {
253 // Special Cases for certain configs not covered by the table
255 // SR-SR-SR 1.5v @1066 (Currently only 3DPCH config at 1066)
256 if ((MaxDimmsPerChannel == 3) && (NBPtr->ChannelPtr->Dimms == 3) &&
257 (NBPtr->DCTPtr->Timings.Speed == DDR1066_FREQUENCY)) {
258 NBPtr->PsPtr->DramTerm = 5; //30 Ohms
264 /* -----------------------------------------------------------------------------*/
267 * This is function gets the POR speed limit for R-DDR3 C32 DDR3
269 * @param[in,out] *NBPtr Pointer to MEM_NB_BLOCK
275 MemPGetPORFreqLimitRC32_3 (
276 IN OUT MEM_NB_BLOCK *NBPtr
279 UINT8 *DimmsPerChPtr;
283 CONST POR_SPEED_LIMIT *FreqLimitPtr;
286 DCTPtr = NBPtr->DCTPtr;
287 DimmsPerChPtr = FindPSOverrideEntry (NBPtr->RefPtr->PlatformMemoryConfiguration, PSO_MAX_DIMMS, NBPtr->MCTPtr->SocketId, NBPtr->ChannelPtr->ChannelID, 0, NULL, NULL);
288 if (DimmsPerChPtr != NULL) {
289 MaxDimmPerCH = *DimmsPerChPtr;
294 if (MaxDimmPerCH == 4) {
295 DCTPtr->Timings.DimmExclude |= DCTPtr->Timings.DctDimmValid;
296 PutEventLog (AGESA_CRITICAL, MEM_ERROR_UNSUPPORTED_DIMM_CONFIG, NBPtr->Node, NBPtr->Dct, NBPtr->Channel, 0, &NBPtr->MemPtr->StdHeader);
297 SetMemError (AGESA_CRITICAL, NBPtr->MCTPtr);
298 // Change target speed to highest value so it won't affect other channels when leveling frequency across the node.
299 NBPtr->DCTPtr->Timings.TargetSpeed = UNSUPPORTED_DDR_FREQUENCY;
301 } else if (MaxDimmPerCH == 3) {
302 FreqLimitPtr = C32RDdr3PSPorFreqLimit3D;
303 FreqLimitSize = GET_SIZE_OF (C32RDdr3PSPorFreqLimit3D);
304 } else if (MaxDimmPerCH == 2) {
305 FreqLimitPtr = C32RDdr3PSPorFreqLimit2D;
306 FreqLimitSize = GET_SIZE_OF (C32RDdr3PSPorFreqLimit2D);
308 FreqLimitPtr = C32RDdr3PSPorFreqLimit1D;
309 FreqLimitSize = GET_SIZE_OF (C32RDdr3PSPorFreqLimit1D);
312 SpeedLimit = MemPGetPorFreqLimit (NBPtr, FreqLimitSize, FreqLimitPtr);
314 if (SpeedLimit != 0) {
315 if (DCTPtr->Timings.TargetSpeed > SpeedLimit) {
316 DCTPtr->Timings.TargetSpeed = SpeedLimit;
319 DCTPtr->Timings.DimmExclude |= DCTPtr->Timings.DctDimmValid;
320 PutEventLog (AGESA_CRITICAL, MEM_ERROR_UNSUPPORTED_DIMM_CONFIG, NBPtr->Node, NBPtr->Dct, NBPtr->Channel, 0, &NBPtr->MemPtr->StdHeader);
321 SetMemError (AGESA_CRITICAL, NBPtr->MCTPtr);
322 // Change target speed to highest value so it won't affect other channels when leveling frequency across the node.
323 NBPtr->DCTPtr->Timings.TargetSpeed = UNSUPPORTED_DDR_FREQUENCY;