Debian Codegraph @

src/vendorcode/intel/fsp/fsp2_0/jasperlake/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) 2019, 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 #pragma pack (push, 1)
22
23 #include <Uefi/UefiMultiPhase.h>
24 #include <Pi/PiBootMode.h>
25 #include <Pi/PiHob.h>
26
27 extern EFI_GUID gSiMemoryS3DataGuid;
28 extern EFI_GUID gSiMemoryInfoDataGuid;
29 extern EFI_GUID gSiMemoryPlatformDataGuid;
30
31 #define MAX_TRACE_CACHE_TYPE 3
32
33 #define MAX_NODE 1
34 #define MAX_CH 2
35 #define MAX_DIMM 2
36
37 ///
38 /// Host reset states from MRC.
39 ///
40 #define WARM_BOOT 2
41
42 #define R_MC_CHNL_RANK_PRESENT 0x7C
43 #define B_RANK0_PRS BIT0
44 #define B_RANK1_PRS BIT1
45 #define B_RANK2_PRS BIT4
46 #define B_RANK3_PRS BIT5
47
48
49 ///
50 /// Defines taken from MRC so avoid having to include MrcInterface.h
51 ///
52
53 //
54 // Matches MAX_SPD_SAVE define in MRC
55 //
56 #ifndef MAX_SPD_SAVE
57 #define MAX_SPD_SAVE 29
58 #endif
59
60 //
61 // MRC version description.
62 //
63 typedef struct {
64 UINT8 Major; ///< Major version number
65 UINT8 Minor; ///< Minor version number
66 UINT8 Rev; ///< Revision number
67 UINT8 Build; ///< Build number
68 } SiMrcVersion;
69
70 //// Matches MrcChannelSts enum in MRC
71 //
72 #ifndef CHANNEL_NOT_PRESENT
73 #define CHANNEL_NOT_PRESENT 0 // There is no channel present on the controller.
74 #endif
75 #ifndef CHANNEL_DISABLED
76 #define CHANNEL_DISABLED 1 // There is a channel present but it is disabled.
77 #endif
78 #ifndef CHANNEL_PRESENT
79 #define CHANNEL_PRESENT 2 // There is a channel present and it is enabled.
80 #endif
81
82 //
83 // Matches MrcDimmSts enum in MRC
84 //
85 #ifndef DIMM_ENABLED
86 #define DIMM_ENABLED 0 // DIMM/rank Pair is enabled, presence will be detected.
87 #endif
88 #ifndef DIMM_DISABLED
89 #define DIMM_DISABLED 1 // DIMM/rank Pair is disabled, regardless of presence.
90 #endif
91 #ifndef DIMM_PRESENT
92 #define DIMM_PRESENT 2 // There is a DIMM present in the slot/rank pair and it will be used.
93 #endif
94 #ifndef DIMM_NOT_PRESENT
95 #define DIMM_NOT_PRESENT 3 // There is no DIMM present in the slot/rank pair.
96 #endif
97
98 //
99 // Matches MrcBootMode enum in MRC
100 //
101 #ifndef __MRC_BOOT_MODE__
102 #define __MRC_BOOT_MODE__ //The below values are originated from MrcCommonTypes.h
103 #ifndef INT32_MAX
104 #define INT32_MAX (0x7FFFFFFF)
105 #endif //INT32_MAX
106 typedef enum {
107 bmCold, ///< Cold boot
108 bmWarm, ///< Warm boot
109 bmS3, ///< S3 resume
110 bmFast, ///< Fast boot
111 MrcBootModeMax, ///< MRC_BOOT_MODE enumeration maximum value.
112 MrcBootModeDelim = INT32_MAX ///< This value ensures the enum size is consistent on both sides of the PPI.
113 } MRC_BOOT_MODE;
114 #endif //__MRC_BOOT_MODE__
115
116 //
117 // Matches MrcDdrType enum in MRC
118 //
119 #ifndef MRC_DDR_TYPE_DDR4
120 #define MRC_DDR_TYPE_DDR4 0
121 #endif
122 #ifndef MRC_DDR_TYPE_DDR3
123 #define MRC_DDR_TYPE_DDR3 1
124 #endif
125 #ifndef MRC_DDR_TYPE_LPDDR3
126 #define MRC_DDR_TYPE_LPDDR3 2
127 #endif
128 #ifndef MRC_DDR_TYPE_LPDDR4
129 #define MRC_DDR_TYPE_LPDDR4 3
130 #endif
131 #ifndef MRC_DDR_TYPE_WIO2
132 #define MRC_DDR_TYPE_WIO2 4
133 #endif
134 #ifndef MRC_DDR_TYPE_UNKNOWN
135 #define MRC_DDR_TYPE_UNKNOWN 5
136 #endif
137
138 #define MAX_PROFILE_NUM 4 // number of memory profiles supported
139 #define MAX_XMP_PROFILE_NUM 2 // number of XMP profiles supported
140
141 //
142 // DIMM timings
143 //
144 typedef struct {
145 UINT32 tCK; ///< Memory cycle time, in femtoseconds.
146 UINT16 NMode; ///< Number of tCK cycles for the channel DIMM's command rate mode.
147 UINT16 tCL; ///< Number of tCK cycles for the channel DIMM's CAS latency.
148 UINT16 tCWL; ///< Number of tCK cycles for the channel DIMM's minimum CAS write latency time.
149 UINT16 tFAW; ///< Number of tCK cycles for the channel DIMM's minimum four activate window delay time.
150 UINT16 tRAS; ///< Number of tCK cycles for the channel DIMM's minimum active to precharge delay time.
151 UINT16 tRCDtRP; ///< Number of tCK cycles for the channel DIMM's minimum RAS# to CAS# delay time and Row Precharge delay time.
152 UINT16 tREFI; ///< Number of tCK cycles for the channel DIMM's minimum Average Periodic Refresh Interval.
153 UINT16 tRFC; ///< Number of tCK cycles for the channel DIMM's minimum refresh recovery delay time.
154 UINT16 tRFCpb; ///< Number of tCK cycles for the channel DIMM's minimum per bank refresh recovery delay time.
155 UINT16 tRFC2; ///< Number of tCK cycles for the channel DIMM's minimum refresh recovery delay time.
156 UINT16 tRFC4; ///< Number of tCK cycles for the channel DIMM's minimum refresh recovery delay time.
157 UINT16 tRPab; ///< Number of tCK cycles for the channel DIMM's minimum row precharge delay time for all banks.
158 UINT16 tRRD; ///< Number of tCK cycles for the channel DIMM's minimum row active to row active delay time.
159 UINT16 tRRD_L; ///< Number of tCK cycles for the channel DIMM's minimum row active to row active delay time for same bank groups.
160 UINT16 tRRD_S; ///< Number of tCK cycles for the channel DIMM's minimum row active to row active delay time for different bank groups.
161 UINT16 tRTP; ///< Number of tCK cycles for the channel DIMM's minimum internal read to precharge command delay time.
162 UINT16 tWR; ///< Number of tCK cycles for the channel DIMM's minimum write recovery time.
163 UINT16 tWTR; ///< Number of tCK cycles for the channel DIMM's minimum internal write to read command delay time.
164 UINT16 tWTR_L; ///< Number of tCK cycles for the channel DIMM's minimum internal write to read command delay time for same bank groups.
165 UINT16 tWTR_S; ///< Number of tCK cycles for the channel DIMM's minimum internal write to read command delay time for different bank groups.
166 UINT16 tCCD_L; ///< Number of tCK cycles for the channel DIMM's minimum CAS-to-CAS delay for same bank group.
167 } MRC_CH_TIMING;
168
169 ///
170 /// Memory SMBIOS & OC Memory Data Hob
171 ///
172 typedef struct {
173 UINT8 Status; ///< See MrcDimmStatus for the definition of this field.
174 UINT8 DimmId;
175 UINT32 DimmCapacity; ///< DIMM size in MBytes.
176 UINT16 MfgId;
177 UINT8 ModulePartNum[20]; ///< Module part number for DDR3 is 18 bytes however for DRR4 20 bytes as per JEDEC Spec, so reserving 20 bytes
178 UINT8 RankInDimm; ///< The number of ranks in this DIMM.
179 UINT8 SpdDramDeviceType; ///< Save SPD DramDeviceType information needed for SMBIOS structure creation.
180 UINT8 SpdModuleType; ///< Save SPD ModuleType information needed for SMBIOS structure creation.
181 UINT8 SpdModuleMemoryBusWidth; ///< Save SPD ModuleMemoryBusWidth information needed for SMBIOS structure creation.
182 UINT8 SpdSave[MAX_SPD_SAVE]; ///< Save SPD Manufacturing information needed for SMBIOS structure creation.
183 UINT16 Speed; ///< The maximum capable speed of the device, in MHz
184 UINT8 MdSocket; ///< MdSocket: 0 = Memory Down, 1 = Socketed. Needed for SMBIOS structure creation.
185 } DIMM_INFO;
186
187 typedef struct {
188 UINT8 Status; ///< Indicates whether this channel should be used.
189 UINT8 ChannelId;
190 UINT8 DimmCount; ///< Number of valid DIMMs that exist in the channel.
191 MRC_CH_TIMING Timing[MAX_PROFILE_NUM]; ///< The channel timing values.
192 DIMM_INFO DimmInfo[MAX_DIMM]; ///< Save the DIMM output characteristics.
193 } CHANNEL_INFO;
194
195 typedef struct {
196 UINT8 Status; ///< Indicates whether this controller should be used.
197 UINT16 DeviceId; ///< The PCI device id of this memory controller.
198 UINT8 RevisionId; ///< The PCI revision id of this memory controller.
199 UINT8 ChannelCount; ///< Number of valid channels that exist on the controller.
200 CHANNEL_INFO ChannelInfo[MAX_CH]; ///< The following are channel level definitions.
201 } CONTROLLER_INFO;
202
203 typedef struct {
204 UINT64 BaseAddress; ///< Trace Base Address
205 UINT64 TotalSize; ///< Total Trace Region of Same Cache type
206 UINT8 CacheType; ///< Trace Cache Type
207 UINT8 ErrorCode; ///< Trace Region Allocation Fail Error code
208 UINT8 Rsvd[2];
209 } PSMI_MEM_INFO;
210
211 typedef struct {
212 UINT8 Revision;
213 UINT16 DataWidth; ///< Data width, in bits, of this memory device
214 /** As defined in SMBIOS 3.0 spec
215 Section 7.18.2 and Table 75
216 **/
217 UINT8 MemoryType; ///< DDR type: DDR3, DDR4, or LPDDR3
218 UINT16 MaximumMemoryClockSpeed;///< The maximum capable speed of the device, in megahertz (MHz)
219 UINT16 ConfiguredMemoryClockSpeed; ///< The configured clock speed to the memory device, in megahertz (MHz)
220 /** As defined in SMBIOS 3.0 spec
221 Section 7.17.3 and Table 72
222 **/
223 UINT8 ErrorCorrectionType;
224
225 SiMrcVersion Version;
226 BOOLEAN EccSupport;
227 UINT8 MemoryProfile;
228 UINT32 TotalPhysicalMemorySize;
229 UINT32 DefaultXmptCK[MAX_XMP_PROFILE_NUM];///< Stores the tCK value read from SPD XMP profiles if they exist.
230 UINT8 XmpProfileEnable; ///< If XMP capable DIMMs are detected, this will indicate which XMP Profiles are common among all DIMMs.
231 UINT8 Ratio;
232 UINT8 RefClk;
233 UINT32 VddVoltage[MAX_PROFILE_NUM];
234 CONTROLLER_INFO Controller[MAX_NODE];
235 } MEMORY_INFO_DATA_HOB;
236
237 /**
238 Memory Platform Data Hob
239
240 <b>Revision 1:</b>
241 - Initial version.
242 <b>Revision 2:</b>
243 - Added TsegBase, PrmrrSize, PrmrrBase, Gttbase, MmioSize, PciEBaseAddress fields
244 **/
245 typedef struct {
246 UINT8 Revision;
247 UINT8 Reserved[3];
248 UINT32 BootMode;
249 UINT32 TsegSize;
250 UINT32 TsegBase;
251 UINT32 PrmrrSize;
252 UINT64 PrmrrBase;
253 UINT32 PramSize;
254 UINT64 PramBase;
255 UINT64 DismLimit;
256 UINT64 DismBase;
257 UINT32 GttBase;
258 UINT32 MmioSize;
259 UINT32 PciEBaseAddress;
260 PSMI_MEM_INFO PsmiInfo[MAX_TRACE_CACHE_TYPE];
261 } MEMORY_PLATFORM_DATA;
262
263 typedef struct {
264 EFI_HOB_GUID_TYPE EfiHobGuidType;
265 MEMORY_PLATFORM_DATA Data;
266 UINT8 *Buffer;
267 } MEMORY_PLATFORM_DATA_HOB;
268
269 #pragma pack (pop)
270
271 #endif // _MEM_INFO_HOB_H_