7 * Platform Specific common header file
9 * @xrefitem bom "File Content Label" "Release Content"
11 * @e sub-project: (Mem)
12 * @e \$Revision: 55046 $ @e \$Date: 2011-06-15 23:59:07 -0600 (Wed, 15 Jun 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 * ***************************************************************************
49 /*----------------------------------------------------------------------------
50 * Mixed (DEFINITIONS AND MACROS / TYPEDEFS, STRUCTURES, ENUMS)
52 *----------------------------------------------------------------------------
55 /*-----------------------------------------------------------------------------
56 * DEFINITIONS AND MACROS
58 *-----------------------------------------------------------------------------
61 /*----------------------------------------------------------------------------
62 * TYPEDEFS, STRUCTURES, ENUMS
64 *----------------------------------------------------------------------------
66 /// Type of an entry for Dram Term table
68 UINT32 Speed; ///< BitMap for the supported speed
69 UINT8 Dimms; ///< BitMap for supported number of dimm
70 UINT8 QR_Dimms; ///< BitMap for supported number of QR dimm
71 UINT8 DramTerm; ///< DramTerm value
72 UINT8 QR_DramTerm; ///< DramTerm value for QR
73 UINT8 DynamicDramTerm; ///< Dynamic DramTerm
76 /// Type of an entry for POR speed limit table
78 UINT16 DIMMRankType; ///< Bitmap of Ranks
79 UINT8 Dimms; ///< Number of dimm
80 UINT16 SpeedLimit_1_5V; ///< POR speed limit for 1.5V
81 UINT16 SpeedLimit_1_35V; ///< POR speed limit for 1.35V
82 UINT16 SpeedLimit_1_25V; ///< POR speed limit for 1.25V
85 /// UDIMM&RDIMM Max. Frequency
87 struct { ///< PSCFG_MAXFREQ_ENTRY
88 UINT16 DimmPerCh:3; ///< Dimm slot per chanel
89 UINT16 Dimms:3; ///< Number of Dimms on a channel
90 UINT16 SR:3; ///< Number of single-rank Dimm
91 UINT16 DR:3; ///< Number of dual-rank Dimm
92 UINT16 QR:4; ///< Number of quad-rank Dimm
93 UINT16 Speed1_5V; ///< Speed limit with voltage 1.5V
94 UINT16 Speed1_35V; ///< Speed limit with voltage 1.35V
95 UINT16 Speed1_25V; ///< Speed limit with voltage 1.25V
98 UINT16 CDN; ///< Condition
99 UINT16 Speed[3]; ///< Speed limit
101 } PSCFG_MAXFREQ_ENTRY;
103 /// LRDIMM Max. Frequency
105 struct { ///< PSCFG_LR_MAXFREQ_ENTRY
106 UINT16 DimmPerCh:3; ///< Dimm slot per chanel
107 UINT16 Dimms:3; ///< Number of Dimms on a channel
108 UINT16 LR:10; ///< Number of LR-DIMM
109 UINT16 Speed1_5V; ///< Speed limit with voltage 1.5V
110 UINT16 Speed1_35V; ///< Speed limit with voltage 1.35V
111 UINT16 Speed1_25V; ///< Speed limit with voltage 1.25V
117 } PSCFG_LR_MAXFREQ_ENTRY;
119 /// UDIMM&RDIMM RttNom and RttWr
121 UINT64 DimmPerCh:8; ///< Dimm slot per chanel
122 UINT64 DDRrate:32; ///< Bitmap of DDR rate
123 UINT64 VDDIO:4; ///< Bitmap of VDDIO
124 UINT64 Dimm0:4; ///< Bitmap of rank type of Dimm0
125 UINT64 Dimm1:4; ///< Bitmap of rank type of Dimm1
126 UINT64 Dimm2:4; ///< Bitmap of rank type of Dimm2
127 UINT64 Dimm:4; ///< Bitmap of rank type of Dimm
128 UINT64 Rank:4; ///< Bitmap of rank
129 UINT8 RttNom:3; ///< Dram term
130 UINT8 RttWr:5; ///< Dynamic dram term
133 /// LRDIMM RttNom and RttWr
135 UINT64 DimmPerCh:8; ///< Dimm slot per chanel
136 UINT64 DDRrate:32; ///< Bitmap of DDR rate
137 UINT64 VDDIO:4; ///< Bitmap of VDDIO
138 UINT64 Dimm0:4; ///< Dimm0 population
139 UINT64 Dimm1:4; ///< Dimm1 population
140 UINT64 Dimm2:12; ///< Dimm2 population
141 UINT8 RttNom:3; ///< Dram term
142 UINT8 RttWr:5; ///< Dynamic dram term
143 } PSCFG_LR_RTT_ENTRY;
145 /// UDIMM&RDIMM&LRDIMM ODT pattern OF 1 DPC
147 UINT16 Dimm0; ///< Bitmap of dimm0 rank type or dimm0 population of LRDIMM
148 UINT32 RdODTCSHigh; ///< RdODTCSHigh
149 UINT32 RdODTCSLow; ///< RdODTCSLow
150 UINT32 WrODTCSHigh; ///< WrODTCSHigh
151 UINT32 WrODTCSLow; ///< WrODTCSLow
152 } PSCFG_1D_ODTPAT_ENTRY;
154 /// UDIMM&RDIMM&LRDIMM ODT pattern OF 2 DPC
156 UINT16 Dimm0:4; ///< Bitmap of dimm0 rank type or dimm0 population of LRDIMM
157 UINT16 Dimm1:12; ///< Bitmap of dimm1 rank type or dimm1 population of LRDIMM
158 UINT32 RdODTCSHigh; ///< RdODTCSHigh
159 UINT32 RdODTCSLow; ///< RdODTCSLow
160 UINT32 WrODTCSHigh; ///< WrODTCSHigh
161 UINT32 WrODTCSLow; ///< WrODTCSLow
162 } PSCFG____ODTPAT_ENTRY;
164 /// UDIMM&RDIMM&LRDIMM ODT pattern OF 3 DPC
166 UINT16 Dimm0:4; ///< Bitmap of dimm0 rank type or dimm0 population of LRDIMM
167 UINT16 Dimm1:4; ///< Bitmap of dimm1 rank type or dimm1 population of LRDIMM
168 UINT16 Dimm2:8; ///< Bitmap of dimm2 rank type or dimm2 population of LRDIMM
169 UINT32 RdODTCSHigh; ///< RdODTCSHigh
170 UINT32 RdODTCSLow; ///< RdODTCSLow
171 UINT32 WrODTCSHigh; ///< WrODTCSHigh
172 UINT32 WrODTCSLow; ///< WrODTCSLow
173 } PSCFG_3D_ODTPAT_ENTRY;
175 /// UDIMM&RDIMM&LRDIMM SlowMode, AddrTmgCtl and ODC
177 UINT64 DimmPerCh:8; ///< Dimm slot per channel
178 UINT64 DDRrate:32; ///< Bitmap of DDR rate
179 UINT64 VDDIO:4; ///< Bitmap of VDDIO
180 UINT64 Dimm0:4; ///< Bitmap of dimm0 rank type or dimm0 population of LRDIMM
181 UINT64 Dimm1:4; ///< Bitmap of dimm1 rank type or dimm1 population of LRDIMM
182 UINT64 Dimm2:11; ///< Bitmap of dimm2 rank type or dimm2 population of LRDIMM
183 UINT64 SlowMode:1; ///< SlowMode
184 UINT32 AddTmgCtl; ///< AddTmgCtl
188 /// UDIMM&RDIMM&LRDIMM training config entry
190 UINT64 DimmPerCh:8; ///< Dimm slot per channel
191 UINT64 DDRrate:32; ///< Bitmap of DDR rate
192 UINT64 VDDIO:4; ///< Bitmap of VDDIO
193 UINT64 Dimm0:4; ///< Bitmap of dimm0 rank type or dimm0 population of LRDIMM
194 UINT64 Dimm1:4; ///< Bitmap of dimm1 rank type or dimm1 population of LRDIMM
195 UINT64 Dimm2:11; ///< Bitmap of dimm2 rank type or dimm2 population of LRDIMM
196 UINT64 Enable__:1; ///< SlowMode
199 /// UDIMM&RDIMM MR0[WR]
201 UINT8 Timing; ///< Fn2_22C_dct[1:0][Twr]
202 UINT8 Value; ///< MR0[WR] : bit0 - bit2 available
205 /// UDIMM&RDIMM MR0[CL]
207 UINT8 Timing; ///< Fn2_200_dct[1:0][Tcl]
208 UINT8 Value:3; ///< MR0[CL] : bit0 - bit2 CL[3:1]
209 UINT8 Value1:5; ///< MR0[CL] : bit3 CL[0]
212 /// UDIMM&RDIMM MR2[IBT]
214 UINT64 DimmPerCh:4; ///< Dimm slot per channel
215 UINT64 DDRrate:32; ///< Bitmap of DDR rate
216 UINT64 VDDIO:4; ///< Bitmap of VDDIO
217 UINT64 Dimm0:4; ///< Bitmap of dimm0 rank type
218 UINT64 Dimm1:4; ///< Bitmap of dimm1 rank type
219 UINT64 Dimm2:4; ///< Bitmap of dimm2 rank type
220 UINT64 Dimm:4; ///< Bitmap of rank type of Dimm
221 UINT64 NumOfReg:4; ///< Number of registers
222 UINT64 IBT:4; ///< MR2[IBT] value
223 } PSCFG_MR2IBT_ENTRY;
225 /// UDIMM&RDIMM&LRDIMM Operating Speed
227 UINT32 DDRrate; ///< Bitmap of DDR rate
228 UINT8 OPSPD; ///< RC10[OperatingSpeed]
233 UINT64 DimmPerCh:4; ///< Dimm slot per channel
234 UINT64 DDRrate:32; ///< Bitmap of DDR rate
235 UINT64 VDDIO:4; ///< Bitmap of VDDIO
236 UINT64 Dimm0:4; ///< Dimm0 population
237 UINT64 Dimm1:4; ///< Dimm1 population
238 UINT64 Dimm2:4; ///< Dimm2 population
239 UINT64 F0RC8:3; ///< F0RC8
240 UINT64 F1RC0:3; ///< F1RC0
241 UINT64 F1RC1:3; ///< F1RC1
242 UINT64 F1RC2:3; ///< F1RC2
245 /// LRDIMM F0RC13[NumPhysicalRanks]
247 UINT8 NumRanks:3; ///< NumRanks
248 UINT8 NumPhyRanks:5; ///< NumPhyRanks
251 /// LRDIMM F0RC13[NumLogicalRanks]
253 UINT16 NumPhyRanks:3; ///< NumPhyRanks
254 UINT16 DramCap:4; ///< DramCap
255 UINT16 NumDimmSlot:9; ///< NumDimmSlot
256 UINT8 NumLogRanks; ///< NumLogRanks
259 /// UDIMM&RDIMM&LRDIMM pass1 seed entry
261 UINT8 DimmPerCh; ///< Dimm slot per channel
262 UINT8 Channel; ///< Channel#
263 UINT16 SeedVal; ///< Seed value
266 /// Platform specific configuration types
268 PSCFG_MAXFREQ, ///< PSCFG_MAXFREQ
269 PSCFG_LR_MAXFREQ, ///< PSCFG_LR_MAXFREQ
270 PSCFG_RTT, ///< PSCFG_RTT
271 PSCFG_LR_RTT, ///< PSCFG_LR_RTT
272 PSCFG_ODT_PAT_1D, ///< PSCFG_ODT_PAT_1D
273 PSCFG_ODT_PAT___, ///< PSCFG_ODT_PAT___
274 PSCFG_ODT_PAT_3D, ///< PSCFG_ODT_PAT_3D
275 PSCFG_LR_ODT_PAT_1D, ///< PSCFG_LR_ODT_PAT_1D
276 PSCFG_LR_ODT_PAT___, ///< PSCFG_LR_ODT_PAT___
277 PSCFG_LR_ODT_PAT_3D, ///< PSCFG_LR_ODT_PAT_3D
278 PSCFG_SAO, ///< PSCFG_SAO
279 PSCFG_LR_SAO, ///< PSCFG_LR_SAO
280 PSCFG_MR0WR, ///< PSCFG_MR0WR
281 PSCFG_MR0CL, ///< PSCFG_MR0CL
282 PSCFG_RC2IBT, ///< PSCFG_RC2IBT
283 PSCFG_RC10OPSPD, ///< PSCFG_RC10OPSPD
284 PSCFG_LR_IBT, ///< PSCFG_LR_IBT
285 PSCFG_LR_NPR, ///< PSCFG_LR_NPR
286 PSCFG_LR_NLR, ///< PSCFG_LR_NLR
287 PSCFG_S__, ///< PSCFG_S__
288 PSCFG_WL_PASS1_SEED, ///< PSCFG_WL_PASS1_SEED
289 PSCFG_HWRXEN_PASS1_SEED, ///< PSCFG_HWRXEN_SEED
291 // The type of general table entries could be added between
292 // PSCFG_GEN_START and PSCFG_GEN_END so that the PSCGen routine
293 // is able to look for the entries per the PSCType.
294 PSCFG_GEN_START, ///< PSCFG_GEN_START
295 PSCFG_CLKDIS, ///< PSCFG_CLKDIS
296 PSCFG_CKETRI, ///< PSCFG_CKETRI
297 PSCFG_ODTTRI, ///< PSCFG_ODTTRI
298 PSCFG_CSTRI, ///< PSCFG_CSTRI
299 PSCFG_GEN_END ///< PSCFG_GEN_END
304 UDIMM_TYPE = 0x01, ///< UDIMM_TYPE
305 RDIMM_TYPE = 0x02, ///< RDIMM_TYPE
306 SODIMM_TYPE = 0x04, ///< SODIMM_TYPE
307 LRDIMM_TYPE = 0x08, ///< LRDIMM_TYPE
308 SODWN_SODIMM_TYPE = 0x10, ///< SODWN_SODIMM_TYPE
309 DT_DONT_CARE = 0xFF ///< DT_DONT_CARE
314 _1DIMM = 0x01, ///< _1DIMM
315 _2DIMM = 0x02, ///< _2DIMM
316 _3DIMM = 0x04, ///< _3DIMM
317 _4DIMM = 0x08, ///< _4DIMM
318 NOD_DONT_CARE = 0xFF ///< NOD_DONT_CARE
321 /// Table header related definitions
323 PSCFG_TYPE PSCType; ///< PSC Type
324 DIMM_TYPE DimmType; ///< Dimm Type
325 NOD_SUPPORTED NumOfDimm; ///< Numbef of dimm
326 CPU_LOGICAL_ID LogicalCpuid; ///< Logical Cpuid
327 UINT8 PackageType; ///< Package Type
328 TECHNOLOGY_TYPE TechType; ///< Technology type
333 PSC_TBL_HEADER Header; ///< PSC_TBL_HEADER
334 UINT8 TableSize; ///< Table size
335 VOID *TBLPtr; ///< Pointer of the table
338 #define NOD_DONT_CARE 0xFF
339 #define PT_DONT_CARE 0xFF
344 #define VOLT_ALL (V1_5 | V1_35 | V1_25)
358 /*----------------------------------------------------------------------------
359 * FUNCTIONS PROTOTYPE
361 *----------------------------------------------------------------------------
365 MemPConstructPsUDef (
366 IN OUT MEM_DATA_STRUCT *MemPtr,
367 IN OUT CH_DEF_STRUCT *ChannelPtr,
368 IN OUT MEM_PS_BLOCK *PsPtr
373 IN OUT MEM_NB_BLOCK *NBPtr,
375 IN CONST DRAM_TERM_ENTRY *DramTermPtr
379 MemPConstructPsSHy3 (
380 IN OUT MEM_DATA_STRUCT *MemPtr,
381 IN OUT CH_DEF_STRUCT *ChannelPtr,
382 IN OUT MEM_PS_BLOCK *PsPtr
386 MemPConstructPsUHy3 (
387 IN OUT MEM_DATA_STRUCT *MemPtr,
388 IN OUT CH_DEF_STRUCT *ChannelPtr,
389 IN OUT MEM_PS_BLOCK *PsPtr
393 MemPConstructPsRHy3 (
394 IN OUT MEM_DATA_STRUCT *MemPtr,
395 IN OUT CH_DEF_STRUCT *ChannelPtr,
396 IN OUT MEM_PS_BLOCK *PsPtr
400 MemPConstructPsUC32_3 (
401 IN OUT MEM_DATA_STRUCT *MemPtr,
402 IN OUT CH_DEF_STRUCT *ChannelPtr,
403 IN OUT MEM_PS_BLOCK *PsPtr
407 MemPConstructPsRC32_3 (
408 IN OUT MEM_DATA_STRUCT *MemPtr,
409 IN OUT CH_DEF_STRUCT *ChannelPtr,
410 IN OUT MEM_PS_BLOCK *PsPtr
415 MemPConstructPsSDr3 (
416 IN OUT MEM_DATA_STRUCT *MemPtr,
417 IN OUT CH_DEF_STRUCT *ChannelPtr,
418 IN OUT MEM_PS_BLOCK *PsPtr
422 MemPConstructPsUDr3 (
423 IN OUT MEM_DATA_STRUCT *MemPtr,
424 IN OUT CH_DEF_STRUCT *ChannelPtr,
425 IN OUT MEM_PS_BLOCK *PsPtr
429 MemPConstructPsRDr3 (
430 IN OUT MEM_DATA_STRUCT *MemPtr,
431 IN OUT CH_DEF_STRUCT *ChannelPtr,
432 IN OUT MEM_PS_BLOCK *PsPtr
436 MemPConstructPsUDA3 (
437 IN OUT MEM_DATA_STRUCT *MemPtr,
438 IN OUT CH_DEF_STRUCT *ChannelPtr,
439 IN OUT MEM_PS_BLOCK *PsPtr
443 MemPConstructPsSNi3 (
444 IN OUT MEM_DATA_STRUCT *MemPtr,
445 IN OUT CH_DEF_STRUCT *ChannelPtr,
446 IN OUT MEM_PS_BLOCK *PsPtr
450 MemPConstructPsUNi3 (
451 IN OUT MEM_DATA_STRUCT *MemPtr,
452 IN OUT CH_DEF_STRUCT *ChannelPtr,
453 IN OUT MEM_PS_BLOCK *PsPtr
457 MemPConstructPsSRb3 (
458 IN OUT MEM_DATA_STRUCT *MemPtr,
459 IN OUT CH_DEF_STRUCT *ChannelPtr,
460 IN OUT MEM_PS_BLOCK *PsPtr
464 MemPConstructPsURb3 (
465 IN OUT MEM_DATA_STRUCT *MemPtr,
466 IN OUT CH_DEF_STRUCT *ChannelPtr,
467 IN OUT MEM_PS_BLOCK *PsPtr
471 MemPConstructPsSPh3 (
472 IN OUT MEM_DATA_STRUCT *MemPtr,
473 IN OUT CH_DEF_STRUCT *ChannelPtr,
474 IN OUT MEM_PS_BLOCK *PsPtr
478 MemPConstructPsUPh3 (
479 IN OUT MEM_DATA_STRUCT *MemPtr,
480 IN OUT CH_DEF_STRUCT *ChannelPtr,
481 IN OUT MEM_PS_BLOCK *PsPtr
485 MemPConstructPsSDA3 (
486 IN OUT MEM_DATA_STRUCT *MemPtr,
487 IN OUT CH_DEF_STRUCT *ChannelPtr,
488 IN OUT MEM_PS_BLOCK *PsPtr
492 MemPConstructPsSDA2 (
493 IN OUT MEM_DATA_STRUCT *MemPtr,
494 IN OUT CH_DEF_STRUCT *ChannelPtr,
495 IN OUT MEM_PS_BLOCK *PsPtr
499 MemPConstructPsSLN3 (
500 IN OUT MEM_DATA_STRUCT *MemPtr,
501 IN OUT CH_DEF_STRUCT *ChannelPtr,
502 IN OUT MEM_PS_BLOCK *PsPtr
506 MemPConstructPsULN3 (
507 IN OUT MEM_DATA_STRUCT *MemPtr,
508 IN OUT CH_DEF_STRUCT *ChannelPtr,
509 IN OUT MEM_PS_BLOCK *PsPtr
513 MemPConstructPsRLN3 (
514 IN OUT MEM_DATA_STRUCT *MemPtr,
515 IN OUT CH_DEF_STRUCT *ChannelPtr,
516 IN OUT MEM_PS_BLOCK *PsPtr
520 MemPConstructPsSON3 (
521 IN OUT MEM_DATA_STRUCT *MemPtr,
522 IN OUT CH_DEF_STRUCT *ChannelPtr,
523 IN OUT MEM_PS_BLOCK *PsPtr
527 MemPConstructPsUON3 (
528 IN OUT MEM_DATA_STRUCT *MemPtr,
529 IN OUT CH_DEF_STRUCT *ChannelPtr,
530 IN OUT MEM_PS_BLOCK *PsPtr
534 MemPGetPorFreqLimit (
535 IN OUT MEM_NB_BLOCK *NBPtr,
536 IN UINT8 FreqLimitSize,
537 IN CONST POR_SPEED_LIMIT *FreqLimitPtr
541 MemPGetPORFreqLimitDef (
542 IN OUT MEM_NB_BLOCK *NBPtr
547 IN OUT MEM_NB_BLOCK *NBPtr
551 MemPConstructRankTypeMap (
555 IN OUT UINT16 *RankTypeInTable
560 IN OUT MEM_NB_BLOCK *NBPtr,
561 IN CPU_LOGICAL_ID LogicalId,
567 IN CH_DEF_STRUCT *CurrentChannel
572 IN OUT MEM_NB_BLOCK *NBPtr
576 MemPRecConstructRankTypeMap (
580 IN OUT UINT16 *RankTypeInTable
584 MemPRecIsIdSupported (
585 IN OUT MEM_NB_BLOCK *NBPtr,
586 IN CPU_LOGICAL_ID LogicalId,
591 MemPRecGetPsRankType (
592 IN CH_DEF_STRUCT *CurrentChannel
596 MemPProceedTblDrvOverride (
597 IN OUT MEM_NB_BLOCK *NBPtr,
598 IN PSO_TABLE *PlatformMemoryConfiguration,
599 IN UINT8 ProceededPSOType
603 MemPGetPSCPass1Seed (
604 IN OUT MEM_NB_BLOCK *NBPtr