7 * Platform Specific common header file
9 * @xrefitem bom "File Content Label" "Release Content"
11 * @e sub-project: (Mem)
12 * @e \$Revision: 45233 $ @e \$Date: 2011-01-14 11:58:29 +0800 (Fri, 14 Jan 2011) $
15 /*****************************************************************************
17 * Copyright (c) 2011, 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.
41 * ***************************************************************************
48 /*----------------------------------------------------------------------------
49 * Mixed (DEFINITIONS AND MACROS / TYPEDEFS, STRUCTURES, ENUMS)
51 *----------------------------------------------------------------------------
54 /*-----------------------------------------------------------------------------
55 * DEFINITIONS AND MACROS
57 *-----------------------------------------------------------------------------
60 /*----------------------------------------------------------------------------
61 * TYPEDEFS, STRUCTURES, ENUMS
63 *----------------------------------------------------------------------------
65 /// Type of an entry for Dram Term table
67 UINT32 Speed; ///< BitMap for the supported speed
68 UINT8 Dimms; ///< BitMap for supported number of dimm
69 UINT8 QR_Dimms; ///< BitMap for supported number of QR dimm
70 UINT8 DramTerm; ///< DramTerm value
71 UINT8 QR_DramTerm; ///< DramTerm value for QR
72 UINT8 DynamicDramTerm; ///< Dynamic DramTerm
75 /// Type of an entry for POR speed limit table
77 UINT16 DIMMRankType; ///< Bitmap of Ranks
78 UINT8 Dimms; ///< Number of dimm
79 UINT16 SpeedLimit_1_5V; ///< POR speed limit for 1.5V
80 UINT16 SpeedLimit_1_35V; ///< POR speed limit for 1.35V
81 UINT16 SpeedLimit_1_25V; ///< POR speed limit for 1.25V
84 /// UDIMM&RDIMM Max. Frequency
86 struct { ///< PSCFG_MAXFREQ_ENTRY
87 UINT16 DimmPerCh:3; ///< Dimm slot per chanel
88 UINT16 Dimms:3; ///< Number of Dimms on a channel
89 UINT16 SR:3; ///< Number of single-rank Dimm
90 UINT16 DR:3; ///< Number of dual-rank Dimm
91 UINT16 QR:4; ///< Number of quad-rank Dimm
92 UINT16 Speed1_5V; ///< Speed limit with voltage 1.5V
93 UINT16 Speed1_35V; ///< Speed limit with voltage 1.35V
94 UINT16 Speed1_25V; ///< Speed limit with voltage 1.25V
97 UINT16 CDN; ///< Condition
98 UINT16 Speed[3]; ///< Speed limit
100 } PSCFG_MAXFREQ_ENTRY;
102 /// LRDIMM Max. Frequency
104 struct { ///< PSCFG_LR_MAXFREQ_ENTRY
105 UINT16 DimmPerCh:3; ///< Dimm slot per chanel
106 UINT16 Dimms:3; ///< Number of Dimms on a channel
107 UINT16 LR:10; ///< Number of LR-DIMM
108 UINT16 Speed1_5V; ///< Speed limit with voltage 1.5V
109 UINT16 Speed1_35V; ///< Speed limit with voltage 1.35V
110 UINT16 Speed1_25V; ///< Speed limit with voltage 1.25V
116 } PSCFG_LR_MAXFREQ_ENTRY;
118 /// UDIMM&RDIMM RttNom and RttWr
120 UINT64 DimmPerCh:8; ///< Dimm slot per chanel
121 UINT64 DDRrate:32; ///< Bitmap of DDR rate
122 UINT64 VDDIO:4; ///< Bitmap of VDDIO
123 UINT64 Dimm0:4; ///< Bitmap of rank type of Dimm0
124 UINT64 Dimm1:4; ///< Bitmap of rank type of Dimm1
125 UINT64 Dimm2:4; ///< Bitmap of rank type of Dimm2
126 UINT64 Dimm:4; ///< Bitmap of rank type of Dimm
127 UINT64 Rank:4; ///< Bitmap of rank
128 UINT8 RttNom:3; ///< Dram term
129 UINT8 RttWr:5; ///< Dynamic dram term
132 /// LRDIMM RttNom and RttWr
134 UINT64 DimmPerCh:8; ///< Dimm slot per chanel
135 UINT64 DDRrate:32; ///< Bitmap of DDR rate
136 UINT64 VDDIO:4; ///< Bitmap of VDDIO
137 UINT64 Dimm0:4; ///< Dimm0 population
138 UINT64 Dimm1:4; ///< Dimm1 population
139 UINT64 Dimm2:12; ///< Dimm2 population
140 UINT8 RttNom:3; ///< Dram term
141 UINT8 RttWr:5; ///< Dynamic dram term
142 } PSCFG_LR_RTT_ENTRY;
144 /// UDIMM&RDIMM&LRDIMM ODT pattern OF 1 DPC
146 UINT16 Dimm0; ///< Bitmap of dimm0 rank type or dimm0 population of LRDIMM
147 UINT32 RdODTCSHigh; ///< RdODTCSHigh
148 UINT32 RdODTCSLow; ///< RdODTCSLow
149 UINT32 WrODTCSHigh; ///< WrODTCSHigh
150 UINT32 WrODTCSLow; ///< WrODTCSLow
151 } PSCFG_1D_ODTPAT_ENTRY;
153 /// UDIMM&RDIMM&LRDIMM ODT pattern OF 2 DPC
155 UINT16 Dimm0:4; ///< Bitmap of dimm0 rank type or dimm0 population of LRDIMM
156 UINT16 Dimm1:12; ///< Bitmap of dimm1 rank type or dimm1 population of LRDIMM
157 UINT32 RdODTCSHigh; ///< RdODTCSHigh
158 UINT32 RdODTCSLow; ///< RdODTCSLow
159 UINT32 WrODTCSHigh; ///< WrODTCSHigh
160 UINT32 WrODTCSLow; ///< WrODTCSLow
161 } PSCFG_2D_ODTPAT_ENTRY;
163 /// UDIMM&RDIMM&LRDIMM ODT pattern OF 3 DPC
165 UINT16 Dimm0:4; ///< Bitmap of dimm0 rank type or dimm0 population of LRDIMM
166 UINT16 Dimm1:4; ///< Bitmap of dimm1 rank type or dimm1 population of LRDIMM
167 UINT16 Dimm2:8; ///< Bitmap of dimm2 rank type or dimm2 population of LRDIMM
168 UINT32 RdODTCSHigh; ///< RdODTCSHigh
169 UINT32 RdODTCSLow; ///< RdODTCSLow
170 UINT32 WrODTCSHigh; ///< WrODTCSHigh
171 UINT32 WrODTCSLow; ///< WrODTCSLow
172 } PSCFG_3D_ODTPAT_ENTRY;
174 /// UDIMM&RDIMM&LRDIMM SlowMode, AddrTmgCtl and ODC
176 UINT64 DimmPerCh:8; ///< Dimm slot per channel
177 UINT64 DDRrate:32; ///< Bitmap of DDR rate
178 UINT64 VDDIO:4; ///< Bitmap of VDDIO
179 UINT64 Dimm0:4; ///< Bitmap of dimm0 rank type or dimm0 population of LRDIMM
180 UINT64 Dimm1:4; ///< Bitmap of dimm1 rank type or dimm1 population of LRDIMM
181 UINT64 Dimm2:11; ///< Bitmap of dimm2 rank type or dimm2 population of LRDIMM
182 UINT64 SlowMode:1; ///< SlowMode
183 UINT32 AddTmgCtl; ///< AddTmgCtl
187 /// UDIMM&RDIMM MR0[WR]
189 UINT8 Timing; ///< Fn2_22C_dct[1:0][Twr]
190 UINT8 Value; ///< MR0[WR] : bit0 - bit2 available
193 /// UDIMM&RDIMM MR0[CL]
195 UINT8 Timing; ///< Fn2_200_dct[1:0][Tcl]
196 UINT8 Value:3; ///< MR0[CL] : bit0 - bit2 CL[3:1]
197 UINT8 Value1:5; ///< MR0[CL] : bit3 CL[0]
200 /// UDIMM&RDIMM MR2[IBT]
202 UINT64 DimmPerCh:4; ///< Dimm slot per channel
203 UINT64 DDRrate:32; ///< Bitmap of DDR rate
204 UINT64 VDDIO:4; ///< Bitmap of VDDIO
205 UINT64 Dimm0:4; ///< Bitmap of dimm0 rank type
206 UINT64 Dimm1:4; ///< Bitmap of dimm1 rank type
207 UINT64 Dimm2:4; ///< Bitmap of dimm2 rank type
208 UINT64 Dimm:4; ///< Bitmap of rank type of Dimm
209 UINT64 NumOfReg:4; ///< Number of registers
210 UINT64 IBT:4; ///< MR2[IBT] value
211 } PSCFG_MR2IBT_ENTRY;
213 /// UDIMM&RDIMM&LRDIMM Operating Speed
215 UINT32 DDRrate; ///< Bitmap of DDR rate
216 UINT8 OPSPD; ///< RC10[OperatingSpeed]
221 UINT64 DimmPerCh:4; ///< Dimm slot per channel
222 UINT64 DDRrate:32; ///< Bitmap of DDR rate
223 UINT64 VDDIO:4; ///< Bitmap of VDDIO
224 UINT64 Dimm0:4; ///< Dimm0 population
225 UINT64 Dimm1:4; ///< Dimm1 population
226 UINT64 Dimm2:4; ///< Dimm2 population
227 UINT64 F0RC8:3; ///< F0RC8
228 UINT64 F1RC0:3; ///< F1RC0
229 UINT64 F1RC1:3; ///< F1RC1
230 UINT64 F1RC2:3; ///< F1RC2
233 /// LRDIMM F0RC13[NumPhysicalRanks]
235 UINT8 NumRanks:3; ///< NumRanks
236 UINT8 NumPhyRanks:5; ///< NumPhyRanks
239 /// LRDIMM F0RC13[NumLogicalRanks]
241 UINT16 NumPhyRanks:3; ///< NumPhyRanks
242 UINT16 DramCap:4; ///< DramCap
243 UINT16 NumDimmSlot:9; ///< NumDimmSlot
244 UINT8 NumLogRanks; ///< NumLogRanks
247 /// Platform specific configuration types
249 PSCFG_MAXFREQ, ///< PSCFG_MAXFREQ
250 PSCFG_LR_MAXFREQ, ///< PSCFG_LR_MAXFREQ
251 PSCFG_RTT, ///< PSCFG_RTT
252 PSCFG_LR_RTT, ///< PSCFG_LR_RTT
253 PSCFG_ODT_PAT_1D, ///< PSCFG_ODT_PAT_1D
254 PSCFG_ODT_PAT_2D, ///< PSCFG_ODT_PAT_2D
255 PSCFG_ODT_PAT_3D, ///< PSCFG_ODT_PAT_3D
256 PSCFG_LR_ODT_PAT_1D, ///< PSCFG_LR_ODT_PAT_1D
257 PSCFG_LR_ODT_PAT_2D, ///< PSCFG_LR_ODT_PAT_2D
258 PSCFG_LR_ODT_PAT_3D, ///< PSCFG_LR_ODT_PAT_3D
259 PSCFG_SAO, ///< PSCFG_SAO
260 PSCFG_LR_SAO, ///< PSCFG_LR_SAO
261 PSCFG_MR0WR, ///< PSCFG_MR0WR
262 PSCFG_MR0CL, ///< PSCFG_MR0CL
263 PSCFG_RC2IBT, ///< PSCFG_RC2IBT
264 PSCFG_RC10OPSPD, ///< PSCFG_RC10OPSPD
265 PSCFG_LR_IBT, ///< PSCFG_LR_IBT
266 PSCFG_LR_NPR, ///< PSCFG_LR_NPR
267 PSCFG_LR_NLR, ///< PSCFG_LR_NLR
269 // The type of general table entries could be added between
270 // PSCFG_GEN_START and PSCFG_GEN_END so that the PSCGen routine
271 // is able to look for the entries per the PSCType.
272 PSCFG_GEN_START, ///< PSCFG_GEN_START
273 PSCFG_CLKDIS, ///< PSCFG_CLKDIS
274 PSCFG_CKETRI, ///< PSCFG_CKETRI
275 PSCFG_ODTTRI, ///< PSCFG_ODTTRI
276 PSCFG_CSTRI, ///< PSCFG_CSTRI
277 PSCFG_GEN_END ///< PSCFG_GEN_END
282 UDIMM_TYPE = 0x01, ///< UDIMM_TYPE
283 RDIMM_TYPE = 0x02, ///< RDIMM_TYPE
284 SODIMM_TYPE = 0x04, ///< SODIMM_TYPE
285 LRDIMM_TYPE = 0x08, ///< LRDIMM_TYPE
286 SODWN_SODIMM_TYPE = 0x10, ///< SODWN_SODIMM_TYPE
287 DT_DONT_CARE = 0xFF ///< DT_DONT_CARE
292 _1DIMM = 0x01, ///< _1DIMM
293 _2DIMM = 0x02, ///< _2DIMM
294 _3DIMM = 0x04, ///< _3DIMM
295 _4DIMM = 0x08, ///< _4DIMM
296 NOD_DONT_CARE = 0xFF ///< NOD_DONT_CARE
299 /// Table header related definitions
301 PSCFG_TYPE PSCType; ///< PSC Type
302 DIMM_TYPE DimmType; ///< Dimm Type
303 NOD_SUPPORTED NumOfDimm; ///< Numbef of dimm
304 CPU_LOGICAL_ID LogicalCpuid; ///< Logical Cpuid
305 UINT8 PackageType; ///< Package Type
306 TECHNOLOGY_TYPE TechType; ///< Technology type
311 PSC_TBL_HEADER Header; ///< PSC_TBL_HEADER
312 UINT8 TableSize; ///< Table size
313 VOID *TBLPtr; ///< Pointer of the table
316 #define NOD_DONT_CARE 0xFF
317 #define PT_DONT_CARE 0xFF
322 #define VOLT_ALL (V1_5 | V1_35 | V1_25)
331 /*----------------------------------------------------------------------------
332 * FUNCTIONS PROTOTYPE
334 *----------------------------------------------------------------------------
338 MemPConstructPsUDef (
339 IN OUT MEM_DATA_STRUCT *MemPtr,
340 IN OUT CH_DEF_STRUCT *ChannelPtr,
341 IN OUT MEM_PS_BLOCK *PsPtr
346 IN OUT MEM_NB_BLOCK *NBPtr,
348 IN CONST DRAM_TERM_ENTRY *DramTermPtr
352 MemPConstructPsSHy3 (
353 IN OUT MEM_DATA_STRUCT *MemPtr,
354 IN OUT CH_DEF_STRUCT *ChannelPtr,
355 IN OUT MEM_PS_BLOCK *PsPtr
359 MemPConstructPsUHy3 (
360 IN OUT MEM_DATA_STRUCT *MemPtr,
361 IN OUT CH_DEF_STRUCT *ChannelPtr,
362 IN OUT MEM_PS_BLOCK *PsPtr
366 MemPConstructPsRHy3 (
367 IN OUT MEM_DATA_STRUCT *MemPtr,
368 IN OUT CH_DEF_STRUCT *ChannelPtr,
369 IN OUT MEM_PS_BLOCK *PsPtr
373 MemPConstructPsUC32_3 (
374 IN OUT MEM_DATA_STRUCT *MemPtr,
375 IN OUT CH_DEF_STRUCT *ChannelPtr,
376 IN OUT MEM_PS_BLOCK *PsPtr
380 MemPConstructPsRC32_3 (
381 IN OUT MEM_DATA_STRUCT *MemPtr,
382 IN OUT CH_DEF_STRUCT *ChannelPtr,
383 IN OUT MEM_PS_BLOCK *PsPtr
388 MemPConstructPsSDr3 (
389 IN OUT MEM_DATA_STRUCT *MemPtr,
390 IN OUT CH_DEF_STRUCT *ChannelPtr,
391 IN OUT MEM_PS_BLOCK *PsPtr
395 MemPConstructPsUDr3 (
396 IN OUT MEM_DATA_STRUCT *MemPtr,
397 IN OUT CH_DEF_STRUCT *ChannelPtr,
398 IN OUT MEM_PS_BLOCK *PsPtr
402 MemPConstructPsRDr3 (
403 IN OUT MEM_DATA_STRUCT *MemPtr,
404 IN OUT CH_DEF_STRUCT *ChannelPtr,
405 IN OUT MEM_PS_BLOCK *PsPtr
409 MemPConstructPsUDA3 (
410 IN OUT MEM_DATA_STRUCT *MemPtr,
411 IN OUT CH_DEF_STRUCT *ChannelPtr,
412 IN OUT MEM_PS_BLOCK *PsPtr
416 MemPConstructPsSNi3 (
417 IN OUT MEM_DATA_STRUCT *MemPtr,
418 IN OUT CH_DEF_STRUCT *ChannelPtr,
419 IN OUT MEM_PS_BLOCK *PsPtr
423 MemPConstructPsUNi3 (
424 IN OUT MEM_DATA_STRUCT *MemPtr,
425 IN OUT CH_DEF_STRUCT *ChannelPtr,
426 IN OUT MEM_PS_BLOCK *PsPtr
430 MemPConstructPsSRb3 (
431 IN OUT MEM_DATA_STRUCT *MemPtr,
432 IN OUT CH_DEF_STRUCT *ChannelPtr,
433 IN OUT MEM_PS_BLOCK *PsPtr
437 MemPConstructPsURb3 (
438 IN OUT MEM_DATA_STRUCT *MemPtr,
439 IN OUT CH_DEF_STRUCT *ChannelPtr,
440 IN OUT MEM_PS_BLOCK *PsPtr
444 MemPConstructPsSPh3 (
445 IN OUT MEM_DATA_STRUCT *MemPtr,
446 IN OUT CH_DEF_STRUCT *ChannelPtr,
447 IN OUT MEM_PS_BLOCK *PsPtr
451 MemPConstructPsUPh3 (
452 IN OUT MEM_DATA_STRUCT *MemPtr,
453 IN OUT CH_DEF_STRUCT *ChannelPtr,
454 IN OUT MEM_PS_BLOCK *PsPtr
458 MemPConstructPsSDA3 (
459 IN OUT MEM_DATA_STRUCT *MemPtr,
460 IN OUT CH_DEF_STRUCT *ChannelPtr,
461 IN OUT MEM_PS_BLOCK *PsPtr
465 MemPConstructPsSDA2 (
466 IN OUT MEM_DATA_STRUCT *MemPtr,
467 IN OUT CH_DEF_STRUCT *ChannelPtr,
468 IN OUT MEM_PS_BLOCK *PsPtr
472 MemPConstructPsSLN3 (
473 IN OUT MEM_DATA_STRUCT *MemPtr,
474 IN OUT CH_DEF_STRUCT *ChannelPtr,
475 IN OUT MEM_PS_BLOCK *PsPtr
479 MemPConstructPsULN3 (
480 IN OUT MEM_DATA_STRUCT *MemPtr,
481 IN OUT CH_DEF_STRUCT *ChannelPtr,
482 IN OUT MEM_PS_BLOCK *PsPtr
486 MemPConstructPsRLN3 (
487 IN OUT MEM_DATA_STRUCT *MemPtr,
488 IN OUT CH_DEF_STRUCT *ChannelPtr,
489 IN OUT MEM_PS_BLOCK *PsPtr
493 MemPConstructPsSON3 (
494 IN OUT MEM_DATA_STRUCT *MemPtr,
495 IN OUT CH_DEF_STRUCT *ChannelPtr,
496 IN OUT MEM_PS_BLOCK *PsPtr
500 MemPConstructPsUON3 (
501 IN OUT MEM_DATA_STRUCT *MemPtr,
502 IN OUT CH_DEF_STRUCT *ChannelPtr,
503 IN OUT MEM_PS_BLOCK *PsPtr
507 MemPGetPorFreqLimit (
508 IN OUT MEM_NB_BLOCK *NBPtr,
509 IN UINT8 FreqLimitSize,
510 IN CONST POR_SPEED_LIMIT *FreqLimitPtr
514 MemPGetPORFreqLimitDef (
515 IN OUT MEM_NB_BLOCK *NBPtr
520 IN OUT MEM_NB_BLOCK *NBPtr
524 MemPConstructRankTypeMap (
528 IN OUT UINT16 *RankTypeInTable
533 IN OUT MEM_NB_BLOCK *NBPtr,
534 IN CPU_LOGICAL_ID LogicalId,
540 IN CH_DEF_STRUCT *CurrentChannel
545 IN OUT MEM_NB_BLOCK *NBPtr
549 MemPRecConstructRankTypeMap (
553 IN OUT UINT16 *RankTypeInTable
557 MemPRecIsIdSupported (
558 IN OUT MEM_NB_BLOCK *NBPtr,
559 IN CPU_LOGICAL_ID LogicalId,
564 MemPRecGetPsRankType (
565 IN CH_DEF_STRUCT *CurrentChannel