Debian Codegraph @

src/vendorcode/intel/fsp/fsp2_0/wildcatlake/MemInfoHob.h

raw symbols SCIP
1 /** @file
2 This file contains definitions required for creation of
3 Memory S3 Save data, Memory Info data and Memory Platform
4 data hobs.
5
6 @copyright
7 Copyright (c) 1999 - 2024, Intel Corporation. All rights reserved.<BR>
8 This program and the accompanying materials are licensed and made available under
9 the terms and conditions of the BSD License that accompanies this distribution.
10 The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php.
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 @par Specification Reference:
17 **/
18 #ifndef _MEM_INFO_HOB_H_
19 #define _MEM_INFO_HOB_H_
20
21
22 #pragma pack (push, 1)
23
24 extern EFI_GUID gSiMemoryS3DataGuid;
25 extern EFI_GUID gSiMemoryS3Data2Guid;
26 extern EFI_GUID gSiMemoryInfoDataGuid;
27 extern EFI_GUID gSiMemoryPlatformDataGuid;
28
29 #define MAX_NODE 2
30 #define MAX_CH 4
31 #define MAX_DDR5_CH 2
32 #define MAX_DIMM 2
33
34 // Must be same or higher than the corresponding definitions in MrcGlobalDefinitions.h
35 #define _MAX_RANK_IN_CHANNEL (4) ///< The maximum number of ranks per channel.
36 #define _MAX_SDRAM_IN_DIMM (5) ///< The maximum number of SDRAMs per DIMM.
37
38 // Must match definitions in
39 // Intel\OneSiliconPkg\IpBlock\MemoryInit\Mtl\Include\MrcInterface.h
40 #define HOB_MAX_SAGV_POINTS 4
41
42 ///
43 /// Host reset states from MRC.
44 ///
45 #define WARM_BOOT 2
46
47 #define R_MC_CHNL_RANK_PRESENT 0x7C
48 #define B_RANK0_PRS BIT0
49 #define B_RANK1_PRS BIT1
50 #define B_RANK2_PRS BIT4
51 #define B_RANK3_PRS BIT5
52
53 // @todo remove and use the MdePkg\Include\Pi\PiHob.h
54 #if !defined(_PEI_HOB_H_) && !defined(__PI_HOB_H__)
55 #ifndef __HOB__H__
56 typedef struct _EFI_HOB_GENERIC_HEADER {
57 UINT16 HobType;
58 UINT16 HobLength;
59 UINT32 Reserved;
60 } EFI_HOB_GENERIC_HEADER;
61
62 typedef struct _EFI_HOB_GUID_TYPE {
63 EFI_HOB_GENERIC_HEADER Header;
64 EFI_GUID Name;
65 ///
66 /// Guid specific data goes here
67 ///
68 } EFI_HOB_GUID_TYPE;
69 #endif
70 #endif
71
72 ///
73 /// Defines taken from MRC so avoid having to include MrcInterface.h
74 ///
75
76 //
77 // Matches MAX_SPD_SAVE define in MRC
78 //
79 #ifndef MAX_SPD_SAVE
80 #define MAX_SPD_SAVE 39
81 #endif
82
83 //
84 // MRC version description.
85 //
86 typedef struct {
87 UINT8 Major; ///< Major version number
88 UINT8 Minor; ///< Minor version number
89 UINT8 Rev; ///< Revision number
90 UINT8 Build; ///< Build number
91 } SiMrcVersion;
92
93 //
94 // Matches MrcChannelSts enum in MRC
95 //
96 #ifndef CHANNEL_NOT_PRESENT
97 #define CHANNEL_NOT_PRESENT 0 // There is no channel present on the controller.
98 #endif
99 #ifndef CHANNEL_DISABLED
100 #define CHANNEL_DISABLED 1 // There is a channel present but it is disabled.
101 #endif
102 #ifndef CHANNEL_PRESENT
103 #define CHANNEL_PRESENT 2 // There is a channel present and it is enabled.
104 #endif
105
106 //
107 // Matches MrcDimmSts enum in MRC
108 //
109 #ifndef DIMM_ENABLED
110 #define DIMM_ENABLED 0 // DIMM/rank Pair is enabled, presence will be detected.
111 #endif
112 #ifndef DIMM_DISABLED
113 #define DIMM_DISABLED 1 // DIMM/rank Pair is disabled, regardless of presence.
114 #endif
115 #ifndef DIMM_PRESENT
116 #define DIMM_PRESENT 2 // There is a DIMM present in the slot/rank pair and it will be used.
117 #endif
118 #ifndef DIMM_NOT_PRESENT
119 #define DIMM_NOT_PRESENT 3 // There is no DIMM present in the slot/rank pair.
120 #endif
121
122 //
123 // Matches MrcBootMode enum in MRC
124 //
125 #ifndef __MRC_BOOT_MODE__
126 #define __MRC_BOOT_MODE__ //The below values are originated from MrcCommonTypes.h
127 #ifndef INT32_MAX
128 #define INT32_MAX (0x7FFFFFFF)
129 #endif //INT32_MAX
130 typedef enum {
131 bmCold, ///< Cold boot
132 bmWarm, ///< Warm boot
133 bmS3, ///< S3 resume
134 bmFast, ///< Fast boot
135 MrcBootModeMax, ///< MRC_BOOT_MODE enumeration maximum value.
136 MrcBootModeDelim = INT32_MAX ///< This value ensures the enum size is consistent on both sides of the PPI.
137 } MRC_BOOT_MODE;
138 #endif //__MRC_BOOT_MODE__
139
140 //
141 // Matches MrcDdrType enum in MRC
142 //
143 #ifndef MRC_DDR_TYPE_LPDDR5
144 #define MRC_DDR_TYPE_LPDDR5 0
145 #endif
146 #ifndef MRC_DDR_TYPE_DDR5
147 #define MRC_DDR_TYPE_DDR5 1
148 #endif
149 #ifndef MRC_DDR_TYPE_UNKNOWN
150 #define MRC_DDR_TYPE_UNKNOWN 2
151 #endif
152
153 #define MAX_PROFILE_NUM 7 // number of memory profiles supported
154 #define MAX_XMP_PROFILE_NUM 5 // number of XMP profiles supported
155
156 #ifndef MAX_RCOMP_TARGETS
157 #define MAX_RCOMP_TARGETS 5
158 #endif
159
160 #ifndef MAX_ODT_ENTRIES
161 #define MAX_ODT_ENTRIES 11
162 #endif
163
164 #ifndef MAX_COPY_DIMM_DFE_TAPS
165 #define MAX_COPY_DIMM_DFE_TAPS 2
166 #endif
167
168 #define MAX_TRACE_REGION 5
169 #define MAX_TRACE_CACHE_TYPE 2
170
171 //
172 // DIMM timings
173 //
174 typedef struct {
175 UINT32 tCK; ///< Memory cycle time, in femtoseconds.
176 UINT16 NMode; ///< Number of tCK cycles for the channel DIMM's command rate mode.
177 UINT16 tCL; ///< Number of tCK cycles for the channel DIMM's CAS latency.
178 UINT16 tCWL; ///< Number of tCK cycles for the channel DIMM's minimum CAS write latency time.
179 UINT16 tFAW; ///< Number of tCK cycles for the channel DIMM's minimum four activate window delay time.
180 UINT16 tRAS; ///< Number of tCK cycles for the channel DIMM's minimum active to precharge delay time.
181 UINT16 tRCDtRP; ///< Number of tCK cycles for the channel DIMM's minimum RAS# to CAS# delay time and Row Precharge delay time.
182 UINT32 tREFI; ///< Number of tCK cycles for the channel DIMM's minimum Average Periodic Refresh Interval.
183 UINT16 tRFC; ///< Number of tCK cycles for the channel DIMM's minimum refresh recovery delay time.
184 UINT16 tRFCpb; ///< Number of tCK cycles for the channel DIMM's minimum per bank refresh recovery delay time.
185 UINT16 tRFC2; ///< Number of tCK cycles for the channel DIMM's minimum refresh recovery delay time.
186 UINT16 tRFC4; ///< Number of tCK cycles for the channel DIMM's minimum refresh recovery delay time.
187 UINT16 tRPab; ///< Number of tCK cycles for the channel DIMM's minimum row precharge delay time for all banks.
188 UINT16 tRRD; ///< Number of tCK cycles for the channel DIMM's minimum row active to row active delay time.
189 UINT16 tRRD_L; ///< Number of tCK cycles for the channel DIMM's minimum row active to row active delay time for same bank groups.
190 UINT16 tRRD_S; ///< Number of tCK cycles for the channel DIMM's minimum row active to row active delay time for different bank groups.
191 UINT16 tRTP; ///< Number of tCK cycles for the channel DIMM's minimum internal read to precharge command delay time.
192 UINT16 tWR; ///< Number of tCK cycles for the channel DIMM's minimum write recovery time.
193 UINT16 tWTR; ///< Number of tCK cycles for the channel DIMM's minimum internal write to read command delay time.
194 UINT16 tWTR_L; ///< Number of tCK cycles for the channel DIMM's minimum internal write to read command delay time for same bank groups.
195 UINT16 tWTR_S; ///< Number of tCK cycles for the channel DIMM's minimum internal write to read command delay time for different bank groups.
196 UINT16 tCCD_L; ///< Number of tCK cycles for the channel DIMM's minimum CAS-to-CAS delay for same bank group.
197 UINT16 tCCD_L_WR; ///< Number of tCK cycles for the channel DIMM's minimum Write-to-Write delay for same bank group.
198 UINT8 Resv[2]; ///< Reserved.
199 } MRC_CH_TIMING;
200
201 typedef struct {
202 UINT16 tRDPRE; ///< Read CAS to Precharge cmd delay
203 } MRC_IP_TIMING;
204
205 typedef union {
206 struct {
207 UINT16 ContinuationCount : 7; ///< Bits 6:0
208 UINT16 ContinuationParity : 1; ///< Bits 7:7
209 UINT16 LastNonZeroByte : 8; ///< Bits 15:8
210 } Bits;
211 UINT16 Data;
212 UINT8 Data8[2];
213 } HOB_MANUFACTURER_ID_CODE;
214
215 ///
216 /// Memory SMBIOS & OC Memory Data Hob
217 ///
218 typedef struct {
219 UINT8 Status; ///< See MrcDimmStatus for the definition of this field.
220 UINT8 DimmId;
221 UINT32 DimmCapacity; ///< DIMM size in MBytes.
222 HOB_MANUFACTURER_ID_CODE MfgId; ///< Dram module manufacturer ID
223 HOB_MANUFACTURER_ID_CODE CkdMfgID; ///< Clock Driver (CKD) Manufacturer ID
224 UINT8 CkdDeviceRev; ///< Clock Driver (CKD) device revision
225 HOB_MANUFACTURER_ID_CODE DramMfgID; ///< Manufacturer ID code for DRAM chip on the module
226 UINT8 ModulePartNum[30]; ///< Module part number in ASCII
227 UINT8 RankInDimm; ///< The number of ranks in this DIMM.
228 UINT8 SpdDramDeviceType; ///< Save SPD DramDeviceType information needed for SMBIOS structure creation.
229 UINT8 SpdModuleType; ///< Save SPD ModuleType information needed for SMBIOS structure creation.
230 UINT8 SpdSave[MAX_SPD_SAVE]; ///< Save SPD Manufacturing information needed for SMBIOS structure creation.
231 UINT16 Speed; ///< The maximum capable speed of the device, in MHz
232 UINT8 MdSocket; ///< MdSocket: 0 = Memory Down, 1 = Socketed. Needed for SMBIOS structure creation.
233 UINT8 Banks; ///< Number of banks the DIMM contains.
234 UINT8 BankGroups; ///< Number of bank groups the DIMM contains.
235 UINT8 DeviceDensity; ///< Device Density in Gb
236 UINT32 SerialNumber; ///< DIMM Serial Number
237 UINT8 TotalWidth; ///< Total Data width in bits
238 UINT8 DataWidth; ///< Primary bus width in bits
239 } DIMM_INFO;
240
241 typedef struct {
242 UINT8 Status; ///< Indicates whether this channel should be used.
243 UINT8 ChannelId;
244 UINT8 DimmCount; ///< Number of valid DIMMs that exist in the channel.
245 MRC_CH_TIMING Timing[MAX_PROFILE_NUM]; ///< The channel timing values.
246 DIMM_INFO DimmInfo[MAX_DIMM]; ///< Save the DIMM output characteristics.
247 } CHANNEL_INFO;
248
249 typedef struct {
250 UINT8 Status; ///< Indicates whether this controller should be used.
251 UINT16 DeviceId; ///< The PCI device id of this memory controller.
252 UINT8 RevisionId; ///< The PCI revision id of this memory controller.
253 UINT8 ChannelCount; ///< Number of valid channels that exist on the controller.
254 CHANNEL_INFO ChannelInfo[MAX_CH]; ///< The following are channel level definitions.
255 } CONTROLLER_INFO;
256
257 //
258 // Each DIMM Slot Mechanical present bit map
259 //
260 typedef struct {
261 UINT8 MrcSlotMap[MAX_NODE][MAX_CH];
262 } MRC_SLOTMAP;
263
264 typedef struct {
265 UINT64 BaseAddress; ///< Trace Base Address
266 UINT64 TotalSize; ///< Total Trace Region of Same Cache type
267 UINT8 CacheType; ///< Trace Cache Type
268 UINT8 ErrorCode; ///< Trace Region Allocation Fail Error code
269 UINT8 Rsvd[2];
270 } PSMI_MEM_INFO;
271
272 /// This data structure contains per-SaGv timing values that are considered output by the MRC.
273 typedef struct {
274 UINT32 DataRate; ///< The memory rate for the current SaGv Point in units of MT/s
275 MRC_CH_TIMING JedecTiming; ///< Timings used for this entry's corresponding SaGv Point - derived from JEDEC SPD spec
276 MRC_IP_TIMING IpTiming; ///< Timings used for this entry's corresponding SaGv Point - IP specific
277 UINT16 MaxMemoryBandwidth; ///< Maximum theoretical bandwidth in GB/s supported by GV
278 } HOB_SAGV_TIMING_OUT;
279
280 /// This data structure contains SAGV config values that are considered output by the MRC.
281 typedef struct {
282 UINT32 NumSaGvPointsEnabled; ///< Count of the total number of SAGV Points enabled.
283 UINT32 SaGvPointMask; ///< Bit mask where each bit indicates an enabled SAGV point.
284 HOB_SAGV_TIMING_OUT SaGvTiming[HOB_MAX_SAGV_POINTS];
285 } HOB_SAGV_INFO;
286
287 typedef struct _PPR_RESULT_COLUMNS_HOB {
288 UINT8 PprRowRepairsSuccessful;
289 UINT8 Controller;
290 UINT8 Channel;
291 UINT8 Rank;
292 UINT8 BankGroup;
293 UINT8 Bank;
294 UINT32 Row;
295 UINT8 Device;
296 } PPR_RESULT_COLUMNS_HOB;
297
298 /**
299 Memory Info Data Hob
300
301 <b>Revision 1:</b>
302 - Initial version. (from MTL)
303 <b>Revision 2:</b>
304 - Added MopPackages, MopDensity, MopRanks, MopVendor fields
305 <b>Revision 3:</b>
306 - Added MaxRankCapacity
307 - Removed DataWidth
308 - DIMM_INFO: increased ModulePartNum from 20 to 30 chars
309 - DIMM_INFO: Added SerialNumber, TotalWidth and DataWidth
310 - DIMM_INFO: Removed SpdModuleMemoryBusWidth
311 - MFG ID fields: use HOB_MANUFACTURER_ID_CODE instead of UINT16 for easier parsing
312
313 **/
314 typedef struct {
315 UINT8 Revision;
316 /** As defined in SMBIOS 3.0 spec
317 Section 7.18.2 and Table 75
318 **/
319 UINT8 MemoryType; ///< DDR type: DDR5 or LPDDR5, uses SMBIOS MEMORY_DEVICE_TYPE encoding
320 UINT16 MaximumMemoryClockSpeed; ///< The maximum capable speed of the device, in megahertz (MHz)
321 UINT16 ConfiguredMemoryClockSpeed; ///< The configured clock speed to the memory device, in megahertz (MHz)
322 /** As defined in SMBIOS 3.0 spec
323 Section 7.17.3 and Table 72
324 **/
325 UINT8 ErrorCorrectionType;
326
327 SiMrcVersion Version;
328 BOOLEAN EccSupport;
329 UINT8 MemoryProfile;
330 UINT32 TotalPhysicalMemorySize;
331 UINT32 DefaultXmptCK[MAX_XMP_PROFILE_NUM];///< Stores the tCK value read from SPD XMP profiles if they exist.
332 UINT8 XmpProfileEnable; ///< If XMP capable DIMMs are detected, this will indicate which XMP Profiles are common among all DIMMs.
333 UINT8 XmpConfigWarning; ///< If XMP capable DIMMs config support only 1DPC, but 2DPC is installed
334 BOOLEAN DynamicMemoryBoostTrainingFailed; ///< TRUE if Dynamic Memory Boost failed to train and was force disabled on the last full training boot. FALSE otherwise.
335 UINT16 Ratio; ///< DDR Frequency Ratio, used for programs that require ratios higher then 255
336 UINT8 RefClk;
337 UINT32 VddVoltage[MAX_PROFILE_NUM];
338 UINT32 VddqVoltage[MAX_PROFILE_NUM];
339 UINT32 VppVoltage[MAX_PROFILE_NUM];
340 UINT16 RcompTarget[MAX_PROFILE_NUM][MAX_RCOMP_TARGETS];
341 UINT16 DimmOdt[MAX_PROFILE_NUM][MAX_DIMM][MAX_ODT_ENTRIES];
342 INT8 DimmDFE[MAX_PROFILE_NUM][MAX_DDR5_CH][MAX_DIMM][MAX_COPY_DIMM_DFE_TAPS];
343 CONTROLLER_INFO Controller[MAX_NODE];
344 UINT32 NumPopulatedChannels; ///< Total number of memory channels populated
345 HOB_SAGV_INFO SagvConfigInfo; ///< This data structure contains SAGV config values that are considered output by the MRC.
346 BOOLEAN IsIbeccEnabled;
347 UINT16 TotalMemWidth; ///< Total Memory Width in bits from all populated channels
348 UINT8 MopPackages; ///< Mop DRAM package population
349 UINT8 MopDensity; ///< Mop DRAM die density
350 UINT8 MopRanks; ///< Mop Number of ranks
351 UINT8 MopVendor; ///< Mop DRAM vendor ID
352 UINT8 PprRanInLastBoot; ///< Whether PPR ran in the prior boot
353 UINT16 PprDetectedErrors; ///< PPR: Counts of detected bad rows
354 UINT16 PprRepairFails; ///< PPR: Counts of repair failure
355 UINT16 PprForceRepairStatus; ///< PPR: Force Repair Status
356 UINT16 PprRepairsSuccessful; ///< PPR: Counts of repair successes
357 PPR_RESULT_COLUMNS_HOB PprErrorInfo; ///< PPR: Error location
358 UINT8 PprAvailableResources[MAX_NODE][MAX_CH][_MAX_RANK_IN_CHANNEL][_MAX_SDRAM_IN_DIMM]; ///< PPR available resources per device
359 BOOLEAN MixedEccDimms; ///< TRUE if both ECC and nonECC Dimms were detected in the system
360 UINT8 MaxRankCapacity; ///< Maximum possible rank capacity in [GB]
361 UINT16 PprFailingChannelBitMask; ///< PPR failing channel mask
362 } MEMORY_INFO_DATA_HOB;
363
364 /**
365 Memory Platform Data Hob
366
367 <b>Revision 1:</b>
368 - Initial version.
369 <b>Revision 2:</b>
370 - Added TsegBase, PrmrrSize, PrmrrBase, Gttbase, MmioSize, PciEBaseAddress fields
371 **/
372 typedef struct {
373 UINT8 Revision;
374 UINT8 Reserved[3];
375 UINT32 BootMode;
376 UINT32 TsegSize;
377 UINT32 TsegBase;
378 UINT32 PrmrrSize;
379 UINT64 PrmrrBase;
380 UINT32 GttBase;
381 UINT32 MmioSize;
382 UINT32 PciEBaseAddress;
383 PSMI_MEM_INFO PsmiInfo[MAX_TRACE_CACHE_TYPE];
384 PSMI_MEM_INFO PsmiRegionInfo[MAX_TRACE_REGION];
385 BOOLEAN MrcBasicMemoryTestPass;
386 } MEMORY_PLATFORM_DATA;
387
388 typedef struct {
389 EFI_HOB_GUID_TYPE EfiHobGuidType;
390 MEMORY_PLATFORM_DATA Data;
391 UINT8 *Buffer;
392 } MEMORY_PLATFORM_DATA_HOB;
393
394 #define EFI_RMT_OS_VARIABLE_NAME L"Rmt"
395 #define RMT_ENABLE 1
396 #define RMT_DISABLE 0
397
398 extern EFI_GUID gRmtVariableGuid;
399
400 //Structure of RMT UEFI variable which should be R/W by OS
401 //EnDsRmt - To enable Memory margining support
402
403 typedef struct {
404 UINT8 EnDsRmt;
405 } RMT_VAR;
406
407 #pragma pack (pop)
408
409 #endif // _MEM_INFO_HOB_H_