Debian Codegraph @

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