7 * Memory Controller, registered dimms
9 * @xrefitem bom "File Content Label" "Release Content"
11 * @e sub-project: (Mem/Ardk)
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 * ***************************************************************************
46 /* This file contains routine that add platform specific support AM3 */
51 #include "OptionMemory.h"
52 #include "PlatformMemoryConfiguration.h"
55 #include "cpuFamRegisters.h"
60 #define FILECODE PROC_MEM_ARDK_C32_MARC32_3_FILECODE
61 /*----------------------------------------------------------------------------
62 * DEFINITIONS AND MACROS
64 *----------------------------------------------------------------------------
67 /*----------------------------------------------------------------------------
68 * TYPEDEFS AND STRUCTURES
70 *----------------------------------------------------------------------------
73 /*----------------------------------------------------------------------------
74 * PROTOTYPES OF LOCAL FUNCTIONS
76 *----------------------------------------------------------------------------
80 *-----------------------------------------------------------------------------
83 *-----------------------------------------------------------------------------
86 STATIC CONST UINT8 ROMDATA C32RDdr3CLKDis[] = {0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00};
88 // Even chip select maps to M[B,A]_CKE[0]
89 // Odd chip select maps to M[B,A]_CKE[1]
90 STATIC CONST UINT8 ROMDATA C32RDdr3CKETri[] = {0x55, 0xAA};
92 // 2 dimms per channel
93 // Dimm 0: BP_MEMODTx[2,0]
94 // Dimm 1: BP_MEMODTx[3,1]
95 STATIC CONST UINT8 ROMDATA C32RDdr3ODTTri2D[] = {0x03, 0x0C, 0x32, 0xC8};
96 // 3 dimms per channel
97 // Dimm 0: BP_MEMODTx[0]
98 // Dimm 1: BP_MEMODTx[3,1]
99 // Dimm 2: BP_MEMODTx[2]
100 STATIC CONST UINT8 ROMDATA C32RDdr3ODTTri3D[] = {0x03, 0x0C, 0x30, 0xC8};
101 // 4 dimms per channel
102 // Dimm 0: BP_MEMODTx[0]
103 // Dimm 1: BP_MEMODTx[1]
104 // Dimm 2: BP_MEMODTx[2]
105 // Dimm 3: BP_MEMODTx[3]
106 STATIC CONST UINT8 ROMDATA C32RDdr3ODTTri4D[] = {0x03, 0x0C, 0x30, 0xC0};
108 // BIOS must not tri-state chip select pin corresponding to the second chip
109 // select of a single rank registered dimm
110 STATIC CONST UINT8 ROMDATA C32RDdr3CSTri[] = {0x01, 0x03, 0x04, 0x0C, 0x10, 0x30, 0x40, 0xC0};
112 /* -----------------------------------------------------------------------------*/
115 * This is function sets the platform specific settings for C32 DDR3 L1 system
117 * @param[in,out] *MemData Pointer to MEM_DATA_STRUCTURE
118 * @param[in] SocketID Socket number
119 * @param[in] *CurrentChannel Pointer to CH_DEF_STRUCT
121 * @return AGESA_SUCCESS
122 * @return CurrentChannel->MemClkDisMap Points this pointer to C32 MemClkDis table
123 * @return CurrentChannel->ChipSelTriMap Points this pointer to C32 CS table
124 * @return CurrentChannel->CKETriMap Points this pointer to C32 ODT table
125 * @return CurrentChannel->ODTTriMap Points this pointer to C32 CKE table
126 * @return CurrentChannel->DctEccDQSLike Indicates the bytes that should be averaged for ECC
127 * @return CurrentChannel->DctEccDQSScale Indicates the scale that should be used for Averaging ECC byte
128 * @return CurrentChannel->DctAddrTmg Address Command Timing Settings for specified channel
129 * @return CurrentChannel->DctOdcCtl Drive Strength settings for specified channel
130 * @return CurrentChannel->SlowMode Slow Mode
136 IN OUT MEM_DATA_STRUCT *MemData,
138 IN OUT CH_DEF_STRUCT *CurrentChannel
142 // Address Timings and Drive Strengths for 1 DIMM per channel or 2 Dimms per Channel
144 // Code searches table for matching speed, then matches the current dimm
145 // population and # of dimms to current config and programs the Addr Timing and RC2/RC2
147 // RC2/RC8 Value - This field id dependent upon the number of Registers on the Dimm, as indicated
149 // Bits 15-12 RC2 if One register
150 // Bits 11-8 RC8 if One register
151 // Bits 7-4 RC2 for more than one register
152 // Bits 3-0 RC8 for more than one register
154 // Frequency, Dimm Config ,
155 // Address Timing Value(F2x[1, 0]9C_x04), RC2/RC8 Value, # Dimms to match
157 STATIC CONST ADV_R_PSCFG_ENTRY PSCfg2DIMMs[] = {
158 {DDR667_FREQUENCY, ANY_DIMM0 + ANY_DIMM1, \
159 0x00000000, 0x4004, 2},
160 {DDR800_FREQUENCY, SR_DIMM0 + DR_DIMM0 + SR_DIMM1 + DR_DIMM1, \
161 0x00000000, 0x0000, 1},
162 {DDR800_FREQUENCY, QR_DIMM1, \
163 0x00000000, 0x0040, 1},
164 {DDR800_FREQUENCY, SR_DIMM0 + DR_DIMM0 + SR_DIMM1 + DR_DIMM1, \
165 0x00000000, 0x4004, 2},
166 {DDR800_FREQUENCY, QR_DIMM0 + ANY_DIMM1, \
167 0x00000000, 0x4004, 2},
168 {DDR800_FREQUENCY, ANY_DIMM0 + QR_DIMM1, \
169 0x00000000, 0x4004, 2},
170 {DDR1066_FREQUENCY, SR_DIMM0 + DR_DIMM0 + SR_DIMM1 + DR_DIMM1, \
171 0x003C3C3C, 0x0000,1},
172 {DDR1066_FREQUENCY, QR_DIMM0 + QR_DIMM1, \
173 0x003C3C3C, 0x0040, 1},
174 {DDR1066_FREQUENCY, ANY_DIMM0 + ANY_DIMM1, \
175 0x003A3C3A, 0x4004, 2},
176 {DDR1333_FREQUENCY, SR_DIMM0 + DR_DIMM0 + SR_DIMM1 + DR_DIMM1, \
177 0x003A3A3A, 0x0000, 1},
178 {DDR1333_FREQUENCY, QR_DIMM0 + QR_DIMM1, \
179 0x003A3A3A, 0x0040, 1},
180 {DDR1333_FREQUENCY, SR_DIMM0 + DR_DIMM0 + SR_DIMM1 + DR_DIMM1, \
181 0x00383A38, 0x4040, 2},
184 // Address Timings and Drive Strengths for 3 DIMMs per channel
186 // Code searches table for matching speed, then matches the current dimm
187 // population and # of dimms to current config and programs the Addr Timing and RC2/RC2
189 // RC2/RC8 Value - This field id dependent upon the number of Registers on the Dimm, as indicated
191 // Bits 15-12 RC2 if One register
192 // Bits 11-8 RC8 if One register
193 // Bits 7-4 RC2 for more than one register
194 // Bits 3-0 RC8 for more than one register
196 // Frequency, Dimm Config ,
197 // Address Timing Value(F2x[1, 0]9C_x04), RC2/RC8 Value, # Dimms to match
199 STATIC CONST ADV_R_PSCFG_ENTRY PSCfg3DIMMs[] = {
200 {DDR667_FREQUENCY, SR_DIMM0 + DR_DIMM0 + SR_DIMM1 + DR_DIMM1 + SR_DIMM2 + DR_DIMM2, \
201 0x00000000, 0x0000, 1},
202 {DDR667_FREQUENCY, SR_DIMM0 + DR_DIMM0 + SR_DIMM1 + DR_DIMM1 + SR_DIMM2 + DR_DIMM2, \
203 0x00000000, 0x4040, 2},
204 {DDR667_FREQUENCY, QR_DIMM1 + SR_DIMM2 + DR_DIMM2, \
205 0x00000000, 0x4004, 2},
206 {DDR667_FREQUENCY, SR_DIMM0 + DR_DIMM0 + ANY_DIMM1 + SR_DIMM2 + DR_DIMM2, \
207 0x00380038, 0x4004, 3},
208 {DDR800_FREQUENCY, SR_DIMM0 + DR_DIMM0 + SR_DIMM1 + DR_DIMM1 + SR_DIMM2 + DR_DIMM2, \
209 0x00000000, 0x0000, 1},
210 {DDR800_FREQUENCY, SR_DIMM0 + DR_DIMM0 + SR_DIMM2 + DR_DIMM2, \
211 0x00000000, 0x4040, 2},
212 {DDR800_FREQUENCY, QR_DIMM1 + SR_DIMM2 + DR_DIMM2, \
213 0x00000000, 0x4004, 2},
214 {DDR800_FREQUENCY, SR_DIMM0 + DR_DIMM0 + SR_DIMM1 + DR_DIMM1 + SR_DIMM2 + DR_DIMM2, \
215 0x00380038, 0x4004, 3},
216 {DDR800_FREQUENCY, QR_DIMM1, \
217 0x00000000, 0x0040, 1},
218 {DDR1066_FREQUENCY, SR_DIMM0 + DR_DIMM0 + SR_DIMM1 + DR_DIMM1 + SR_DIMM2 + DR_DIMM2, \
219 0x003C3C3C, 0x0000, 1},
220 {DDR1066_FREQUENCY, SR_DIMM0 + DR_DIMM0 + SR_DIMM2 + DR_DIMM2, \
221 0x003A3C3A, 0x4040, 2},
222 {DDR1066_FREQUENCY, SR_DIMM0 + SR_DIMM1 + SR_DIMM2, \
223 0x00373C37, 0x4040, 3},
224 {DDR1333_FREQUENCY, SR_DIMM0 + DR_DIMM0 + SR_DIMM1 + DR_DIMM1 + SR_DIMM2 + DR_DIMM2, \
225 0x003A3A3A, 0x0000, 1},
226 {DDR1333_FREQUENCY, SR_DIMM0 + DR_DIMM0 + SR_DIMM2 + DR_DIMM2, \
227 0x00383A38, 0x4040, 2},
231 // DIMM ODT Pattern (1 or 2 DIMMs per channel)
234 // Fn2_9C 180, Fn2_9C 181, Fn2_9C 182, Fn2_9C 183, # Dimms to match
236 STATIC CONST ADV_PSCFG_ODT_ENTRY PSCfg2DIMMsODT[] = {
238 0x00000000, 0x00000000, 0x00000001, 0x00000000, 1},
240 0x00000000, 0x00000000, 0x00000104, 0x00000000, 1},
242 0x00000000, 0x00000000, 0x00000505, 0x00000505, 1},
244 0x00000000, 0x00000000, 0x00020000, 0x00000000, 1},
246 0x00000000, 0x00000000, 0x02080000, 0x00000000, 1},
248 0x00000000, 0x00000000, 0x0A0A0000, 0x0A0A0000, 1},
249 {SR_DIMM0 + DR_DIMM0 + SR_DIMM1 + DR_DIMM1, \
250 0x01010202, 0x00000000, 0x09030603, 0x00000000, 2},
251 {SR_DIMM0 + DR_DIMM0 + QR_DIMM1, \
252 0x01010A0A, 0x01010000, 0x01030E0B, 0x01090000, 2},
253 {QR_DIMM0 + SR_DIMM1 + DR_DIMM1, \
254 0x05050202, 0x00000202, 0x0D070203, 0x00000206, 2},
255 {QR_DIMM0 + QR_DIMM1, \
256 0x05050A0A, 0x05050A0A, 0x05070A0B, 0x050D0A0E, 2}
258 // DIMM ODT Pattern (3 DIMMs per channel)
261 // Fn2_9C 180, Fn2_9C 181, Fn2_9C 182, Fn2_9C 183, # Dimms to match
263 STATIC CONST ADV_PSCFG_ODT_ENTRY PSCfg3DIMMsODT[] = {
264 {SR_DIMM2 + DR_DIMM2, \
265 0x00000000, 0x00000000, 0x00000000, 0x00000404, 1},
266 {SR_DIMM0 + DR_DIMM0, \
267 0x00000000, 0x00000000, 0x00000101, 0x00000000, 1},
268 {SR_DIMM0 + DR_DIMM0 + SR_DIMM2 + DR_DIMM2, \
269 0x00000404, 0x00000101, 0x00000405, 0x00000105, 2},
270 {SR_DIMM0 + DR_DIMM0 + SR_DIMM1 + DR_DIMM1 + SR_DIMM2 + DR_DIMM2, \
271 0x05050606, 0x00000303, 0x0D070607, 0x00000307, 3},
273 0x00000000, 0x00000000, 0x080A0000, 0x020A0000, 1},
274 {QR_DIMM1 + SR_DIMM2 + DR_DIMM2, \
275 0x04040000, 0x04040A0A, 0x04060000, 0x040C0A0E, 2},
276 {SR_DIMM0 + DR_DIMM0 + QR_DIMM1, \
277 0x01010A0A, 0x01010000, 0x01030A0B, 0x01090000, 2},
278 {SR_DIMM0 + DR_DIMM0 + QR_DIMM1 + SR_DIMM2 + DR_DIMM2, \
279 0x05050E0E, 0x05050B0B, 0x05070E0F, 0x050D0B0F, 3}
282 // DIMM ODT Pattern (4 DIMMs per channel)
285 // Fn2_9C 180, Fn2_9C 181, Fn2_9C 182, Fn2_9C 183, # Dimms to match
287 STATIC CONST ADV_PSCFG_ODT_ENTRY PSCfg4DIMMsODT[] = {
289 0x00000000, 0x00000000, 0x00000000, 0x08080000, 1},
290 {ANY_DIMM2 + ANY_DIMM3, \
291 0x00000000, 0x04040808, 0x00000000, 0x0C0C0C0C, 2},
292 {ANY_DIMM1 + ANY_DIMM2 + ANY_DIMM3, \
293 0x0C0C0000, 0x06060A0A, 0x0E0E0000, 0x0E0E0E0E, 3},
294 {ANY_DIMM0 + ANY_DIMM1 + ANY_DIMM2 + ANY_DIMM3, \
295 0x0D0D0E0E, 0x07070B0B, 0x0F0F0F0F, 0x0F0F0F0F, 4}
298 // DIMM Write Leveling ODT Pattern 1 or 2 Dimms Per Channel
300 // Dimm Config, WrLvOdt (Fn2_9C_0x08[11:8]) Value for each Dimm, # Dimms to match
302 STATIC CONST ADV_R_PSCFG_WL_ODT_ENTRY PSCfg2DIMMsWlODT[] = {
303 {SR_DIMM0, {0x01, 0x00, 0x00, 0x00}, 1},
304 {DR_DIMM0, {0x04, 0x00, 0x00, 0x00}, 1},
305 {QR_DIMM0, {0x05, 0x00, 0x00, 0x00}, 1},
306 {SR_DIMM1, {0x00, 0x02, 0x00, 0x00}, 1},
307 {DR_DIMM1, {0x00, 0x08, 0x00, 0x00}, 1},
308 {QR_DIMM1, {0x00, 0x0A, 0x00, 0x00}, 1},
309 {SR_DIMM0 + DR_DIMM0 + SR_DIMM1 + DR_DIMM1, {0x03, 0x03, 0x00, 0x00}, 2},
310 {SR_DIMM0 + QR_DIMM1, {0x0B, 0x03, 0x00, 0x09}, 2},
311 {DR_DIMM0 + QR_DIMM1, {0x0B, 0x03, 0x00, 0x09}, 2},
312 {QR_DIMM0 + SR_DIMM1, {0x03, 0x07, 0x06, 0x00}, 2},
313 {QR_DIMM0 + DR_DIMM1, {0x03, 0x07, 0x06, 0x00}, 2},
314 {QR_DIMM0 + QR_DIMM1, {0x0B, 0x07, 0x0E, 0x0D}, 2}
317 // DIMM Write Leveling ODT Pattern 3 Dimms Per Channel
319 // Dimm Config, WrLvOdt (Fn2_9C_0x08[11:8]) Value for each Dimm, # Dimms to match
321 STATIC CONST ADV_R_PSCFG_WL_ODT_ENTRY PSCfg3DIMMsWlODT[] = {
322 {SR_DIMM2 + DR_DIMM2, {0x00, 0x00, 0x04, 0x00}, 1},
323 {SR_DIMM0 + DR_DIMM0, {0x01, 0x02, 0x00, 0x00}, 1},
324 {SR_DIMM0 + DR_DIMM0 + SR_DIMM2 + DR_DIMM2, {0x05, 0x00, 0x05, 0x00}, 2},
325 {SR_DIMM0 + DR_DIMM0 + SR_DIMM1 + DR_DIMM1 + SR_DIMM2 + DR_DIMM2, {0x07, 0x07, 0x07, 0x00}, 3},
326 {QR_DIMM1, {0x00, 0x0A, 0x00, 0x0A}, 1},
327 {QR_DIMM1 + SR_DIMM2 + DR_DIMM2, {0x00, 0x06, 0x0E, 0x0C}, 2},
328 {SR_DIMM0 + DR_DIMM0 + QR_DIMM1, {0x0B, 0x03, 0x00, 0x09}, 2},
329 {SR_DIMM0 + DR_DIMM0 + QR_DIMM1 + SR_DIMM2 + DR_DIMM2, {0x0F, 0x07, 0x0F, 0x0D}, 3}
332 // DIMM Write Leveling ODT Pattern 4 Dimms Per Channel
334 // Dimm Config, WrLvOdt (Fn2_9C_0x08[11:8]) Value for each Dimm, # Dimms to match
336 STATIC CONST ADV_R_PSCFG_WL_ODT_ENTRY PSCfg4DIMMsWlODT[] = {
337 {ANY_DIMM3, {0x00, 0x00, 0x00, 0x08}, 1},
338 {ANY_DIMM2 + ANY_DIMM3, {0x00, 0x00, 0x0C, 0x0C}, 2},
339 {ANY_DIMM1 + ANY_DIMM2 + ANY_DIMM3, {0x00, 0x0E, 0x0E, 0x0E}, 3},
340 {ANY_DIMM0 + ANY_DIMM1 + ANY_DIMM2 + ANY_DIMM3, {0x0F, 0x0F, 0x0F, 0x0F}, 4}
350 UINT16 _DIMMRankType;
356 UINT32 PhyRODTCSHigh;
358 UINT32 PhyWODTCSHigh;
362 UINT8 PSCfgWlODTSize;
365 CONST ADV_R_PSCFG_ENTRY *PSCfgPtr;
366 CONST ADV_PSCFG_ODT_ENTRY *PSCfgODTPtr;
367 CONST ADV_R_PSCFG_WL_ODT_ENTRY *PSCfgWlODTPtr;
368 UINT8 *DimmsPerChPtr;
370 ASSERT (MemData != NULL);
371 ASSERT (CurrentChannel != NULL);
386 if ((CurrentChannel->MCTPtr->LogicalCpuid.Family & AMD_FAMILY_10_C32) == 0) {
387 return AGESA_UNSUPPORTED;
389 if (CurrentChannel->TechType != DDR3_TECHNOLOGY) {
390 return AGESA_UNSUPPORTED;
392 if (CurrentChannel->RegDimmPresent == 0) {
393 return AGESA_UNSUPPORTED;
397 Dimms = CurrentChannel->Dimms;
398 Speed = CurrentChannel->DCTPtr->Timings.Speed;
400 DimmsPerChPtr = FindPSOverrideEntry (MemData->ParameterListPtr->PlatformMemoryConfiguration, PSO_MAX_DIMMS, SocketID, CurrentChannel->ChannelID, 0, NULL, NULL);
401 if (DimmsPerChPtr != NULL) {
402 MaxDimmPerCH = *DimmsPerChPtr;
407 DIMMRankType = MemAGetPsRankType (CurrentChannel);
409 if (MaxDimmPerCH == 4) {
412 PSCfgODTPtr = PSCfg4DIMMsODT;
413 PSCfgWlODTPtr = PSCfg4DIMMsWlODT;
414 PSCfgODTSize = sizeof (PSCfg4DIMMsODT) / sizeof (ADV_PSCFG_ODT_ENTRY);
415 PSCfgWlODTSize = sizeof (PSCfg4DIMMsWlODT) / sizeof (ADV_R_PSCFG_WL_ODT_ENTRY);
416 } else if (MaxDimmPerCH == 3) {
417 PSCfgPtr = PSCfg3DIMMs;
418 PSCfgSize = sizeof (PSCfg3DIMMs) / sizeof (ADV_R_PSCFG_ENTRY);
419 PSCfgODTPtr = PSCfg3DIMMsODT;
420 PSCfgWlODTPtr = PSCfg3DIMMsWlODT;
421 PSCfgODTSize = sizeof (PSCfg3DIMMsODT) / sizeof (ADV_PSCFG_ODT_ENTRY);
422 PSCfgWlODTSize = sizeof (PSCfg3DIMMsWlODT) / sizeof (ADV_R_PSCFG_WL_ODT_ENTRY);
424 PSCfgPtr = PSCfg2DIMMs;
425 PSCfgSize = sizeof (PSCfg2DIMMs) / sizeof (ADV_R_PSCFG_ENTRY);
426 PSCfgODTPtr = PSCfg2DIMMsODT;
427 PSCfgWlODTPtr = PSCfg2DIMMsWlODT;
428 PSCfgODTSize = sizeof (PSCfg2DIMMsODT) / sizeof (ADV_PSCFG_ODT_ENTRY);
429 PSCfgWlODTSize = sizeof (PSCfg2DIMMsWlODT) / sizeof (ADV_R_PSCFG_WL_ODT_ENTRY);
432 // AddrTmgCTL and DctOdcCtl
433 if (MaxDimmPerCH != 4) {
434 for (i = 0; i < PSCfgSize; i++, PSCfgPtr++) {
435 if ((Speed != PSCfgPtr->Speed) || (Dimms != PSCfgPtr->Dimms)) {
439 _DIMMRankType = DIMMRankType & PSCfgPtr->DIMMRankType;
440 for (j = 0; j < MAX_DIMMS_PER_CHANNEL; j++) {
441 if ((_DIMMRankType & (UINT16) 0x0F << (j << 2)) != 0) {
445 if (DimmTpMatch == PSCfgPtr->Dimms) {
446 AddrTmgCTL = PSCfgPtr->AddrTmg;
447 DctOdcCtl = 0x00223222;
448 RC2RC8 = PSCfgPtr->RC2RC8;
455 // Overrides and/or exceptions
458 // Count slots with SR/DR poulated.
461 for (j = 0; j < MAX_DIMMS_PER_CHANNEL; j++) {
462 if ((DIMMRankType & (UINT16) 0x03 << (j << 2)) != 0) {
467 // DimmTpMatch is equal to the count of slot that have either an SR or DR
470 if (MaxDimmPerCH == 4) {
472 // Any SR/DR in 4 DPCH
474 if (DimmTpMatch > 0) {
475 DctOdcCtl = 0x00223222;
476 if ((Speed == DDR800_FREQUENCY) && (DimmTpMatch == 1)) {
477 DctOdcCtl = 0x00113222;
481 // At Least 3 SR/DR in 4 DPCH
483 if (DimmTpMatch >= 3) {
484 AddrTmgCTL |= 0x002F0000;
486 // At Least 2 SR/DR in 4 DPCH
487 if (DimmTpMatch >= 2) {
495 // Only 1 Dimm Populated and its a SR or DR OR
496 // 3 Dimms Populated and Frequency is 800 MHz
498 if (((Dimms == 1) && (DimmTpMatch == 1)) ||
499 ((Dimms == 3) && ((Speed == DDR800_FREQUENCY) ||
500 (Speed == DDR1066_FREQUENCY)))) {
501 DctOdcCtl = 0x00113222;
506 for (j = 0; j < MAX_DIMMS_PER_CHANNEL; j++) {
507 // CtrlWrd02(s) will contain the info. of SPD byte 63 after MemTDIMMPresence3 execution.
508 if (CurrentChannel->CtrlWrd02[j] > 0) {
509 if (CurrentChannel->CtrlWrd02[j] == 1) {
510 // Store real RC2 and RC8 value (High byte) into CtrlWrd02(s) and CtrlWrd08(s).
511 CurrentChannel->CtrlWrd02[j] = (UINT8) (RC2RC8 >> 12) & 0x000F;
512 CurrentChannel->CtrlWrd08[j] = (UINT8) (RC2RC8 >> 8) & 0x000F;
514 // Store real RC2 and RC8 value (low byte) into CtrlWrd02(s) and CtrlWrd08(s).
515 CurrentChannel->CtrlWrd02[j] = (UINT8) (RC2RC8 >> 4) & 0x000F;
516 CurrentChannel->CtrlWrd08[j] = (UINT8) RC2RC8 & 0x000F;
522 for (i = 0; i < PSCfgODTSize; i++, PSCfgODTPtr++) {
523 if (Dimms != PSCfgODTPtr->Dimms) {
527 _DIMMRankType = DIMMRankType & PSCfgODTPtr->DIMMRankType;
528 for (j = 0; j < MAX_DIMMS_PER_CHANNEL; j++) {
529 if ((_DIMMRankType & (UINT16) 0x0F << (j << 2)) != 0) {
533 if (DimmTpMatch == PSCfgODTPtr->Dimms) {
534 PhyRODTCSLow = PSCfgODTPtr->PhyRODTCSLow;
535 PhyRODTCSHigh = PSCfgODTPtr->PhyRODTCSHigh;
536 PhyWODTCSLow = PSCfgODTPtr->PhyWODTCSLow;
537 PhyWODTCSHigh = PSCfgODTPtr->PhyWODTCSHigh;
543 for (i = 0; i < PSCfgWlODTSize; i++, PSCfgWlODTPtr++) {
544 if (Dimms != PSCfgWlODTPtr->Dimms) {
548 _DIMMRankType = DIMMRankType & PSCfgWlODTPtr->DIMMRankType;
549 for (j = 0; j < MAX_DIMMS_PER_CHANNEL; j++) {
550 if ((_DIMMRankType & (UINT16) 0x0F << (j << 2)) != 0) {
554 if (DimmTpMatch == PSCfgWlODTPtr->Dimms) {
555 PhyWLODT[0] = PSCfgWlODTPtr->PhyWrLvOdt[0];
556 PhyWLODT[1] = PSCfgWlODTPtr->PhyWrLvOdt[1];
557 PhyWLODT[2] = PSCfgWlODTPtr->PhyWrLvOdt[2];
558 PhyWLODT[3] = PSCfgWlODTPtr->PhyWrLvOdt[3];
564 DctOdcCtl |= 0x20000000;
566 CurrentChannel->MemClkDisMap = (UINT8 *) C32RDdr3CLKDis;
567 CurrentChannel->CKETriMap = (UINT8 *) C32RDdr3CKETri;
568 CurrentChannel->ChipSelTriMap = (UINT8 *) C32RDdr3CSTri;
570 switch (MaxDimmPerCH) {
572 CurrentChannel->ODTTriMap = (UINT8 *) C32RDdr3ODTTri3D;
575 CurrentChannel->ODTTriMap = (UINT8 *) C32RDdr3ODTTri4D;
578 CurrentChannel->ODTTriMap = (UINT8 *) C32RDdr3ODTTri2D; // Most conservative
581 CurrentChannel->DctAddrTmg = AddrTmgCTL;
582 CurrentChannel->DctOdcCtl = DctOdcCtl;
583 CurrentChannel->PhyRODTCSLow = PhyRODTCSLow;
584 CurrentChannel->PhyRODTCSHigh = PhyRODTCSHigh;
585 CurrentChannel->PhyWODTCSLow = PhyWODTCSLow;
586 CurrentChannel->PhyWODTCSHigh = PhyWODTCSHigh;
587 for (i = 0; i < sizeof (CurrentChannel->PhyWLODT); i++) {
588 CurrentChannel->PhyWLODT[i] = PhyWLODT[i];
590 CurrentChannel->SlowMode = SlowMode;
592 return AGESA_SUCCESS;