Debian Codegraph @

src/soc/intel/snowridge/common/hob_display.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <console/console.h>
4 #include <fsp/debug.h>
5 #include <fsp/soc_binding.h>
6 #include <fsp/util.h>
7 #include <lib.h>
8 #include <uuid.h>
9
10 #include "fsp_hob.h"
11
12 struct guid_name_map {
13 const guid_t *guid;
14 const char *name;
15 };
16
17 static const struct guid_name_map guid_names[] = {
18 {&fsp_hob_fia_override_status_guid, "FSP_HOB_FIA_OVERRIDE_STATUS_GUID"},
19 {&fsp_hob_iio_uds_data_guid, "FSP_HOB_IIO_UDS_DATA_GUID" },
20 {&fsp_hob_kti_cache_guid, "FSP_HOB_KTI_HOST_NVRAM_DATA_GUID"},
21 {&fsp_hob_smbios_memory_info_guid, "FSP_HOB_SMBIOS_MEMORY_INFO_GUID" },
22 };
23
24 const char *soc_get_guid_name(const uint8_t *guid)
25 {
26 size_t index;
27
28 /* Compare the GUID values in this module */
29 for (index = 0; index < ARRAY_SIZE(guid_names); index++)
30 if (fsp_guid_compare(guid, guid_names[index].guid->b))
31 return guid_names[index].name;
32
33 return NULL;
34 }
35
36 static void soc_display_fsp_iio_uds_data_hob(const BL_IIO_UDS *hob)
37 {
38 if (!hob) {
39 return;
40 }
41
42 printk(BIOS_DEBUG, "IIO UDS\n");
43 printk(BIOS_DEBUG, "\t Platform Data\n");
44 printk(BIOS_DEBUG, "\t\t PlatGlobalIoBase: 0x%x\n", hob->PlatformData.PlatGlobalIoBase);
45 printk(BIOS_DEBUG, "\t\t PlatGlobalIoLimit: 0x%x\n",
46 hob->PlatformData.PlatGlobalIoLimit);
47 printk(BIOS_DEBUG, "\t\t PlatGlobalMmio32Base: 0x%x\n",
48 hob->PlatformData.PlatGlobalMmio32Base);
49 printk(BIOS_DEBUG, "\t\t PlatGlobalMmio32Limit: 0x%x\n",
50 hob->PlatformData.PlatGlobalMmio32Limit);
51 printk(BIOS_DEBUG, "\t\t PlatGlobalMmio64Base: 0x%llx\n",
52 hob->PlatformData.PlatGlobalMmio64Base);
53 printk(BIOS_DEBUG, "\t\t PlatGlobalMmio64Limit: 0x%llx\n",
54 hob->PlatformData.PlatGlobalMmio64Limit);
55 for (int socket = 0; socket < BL_MAX_SOCKET; socket++) {
56 const BL_QPI_CPU_DATA *cpu_qpi_info = &hob->PlatformData.CpuQpiInfo[socket];
57 printk(BIOS_DEBUG, "\t\t CpuQpiInfo[%d]\n", socket);
58 printk(BIOS_DEBUG, "\t\t\t Valid: 0x%x\n", cpu_qpi_info->Valid);
59 for (int bar = 0; bar < BL_TYPE_MAX_MMIO_BAR; bar++) {
60 printk(BIOS_DEBUG, "\t\t\t MmioBar[%d]: 0x%x\n", bar,
61 cpu_qpi_info->MmioBar[bar]);
62 }
63 printk(BIOS_DEBUG, "\t\t\t PcieSegment: 0x%x\n", cpu_qpi_info->PcieSegment);
64 printk(BIOS_DEBUG, "\t\t\t SegMmcfgBase: 0x%llx\n",
65 cpu_qpi_info->SegMmcfgBase.Data);
66 printk(BIOS_DEBUG, "\t\t\t stackPresentBitmap: 0x%x\n",
67 cpu_qpi_info->stackPresentBitmap);
68 printk(BIOS_DEBUG, "\t\t\t M2PciePresentBitmap: 0x%x\n",
69 cpu_qpi_info->M2PciePresentBitmap);
70 printk(BIOS_DEBUG, "\t\t\t TotM3Kti: 0x%x\n", cpu_qpi_info->TotM3Kti);
71 printk(BIOS_DEBUG, "\t\t\t TotCha: 0x%x\n", cpu_qpi_info->TotCha);
72 for (int cha = 0; cha < BL_MAX_CHA_MAP; cha++) {
73 printk(BIOS_DEBUG, "\t\t\t ChaList[%d]: 0x%x\n", cha,
74 cpu_qpi_info->ChaList[cha]);
75 }
76 printk(BIOS_DEBUG, "\t\t\t SocId: 0x%x\n", cpu_qpi_info->SocId);
77 for (int peer = 0; peer < BL_MAX_FW_KTI_PORTS; peer++) {
78 const BL_QPI_PEER_DATA *peer_info = &cpu_qpi_info->PeerInfo[peer];
79 printk(BIOS_DEBUG, "\t\t\t PeerInfo[%d]\n", peer);
80 printk(BIOS_DEBUG, "\t\t\t\t Valid: 0x%x\n", peer_info->Valid);
81 printk(BIOS_DEBUG, "\t\t\t\t PeerSocId: 0x%x\n", peer_info->PeerSocId);
82 printk(BIOS_DEBUG, "\t\t\t\t PeerSocType: 0x%x\n",
83 peer_info->PeerSocType);
84 printk(BIOS_DEBUG, "\t\t\t\t PeerPort: 0x%x\n", peer_info->PeerPort);
85 }
86 }
87 for (int socket = 0; socket < BL_MAX_SOCKET; socket++) {
88 const BL_QPI_IIO_DATA *iio_qpi_info = &hob->PlatformData.IioQpiInfo[socket];
89 printk(BIOS_DEBUG, "\t\t IioQpiInfo[%d]\n", socket);
90 printk(BIOS_DEBUG, "\t\t\t SocId: 0x%x\n", iio_qpi_info->SocId);
91 for (int peer = 0; peer < BL_MAX_SOCKET; peer++) {
92 const BL_QPI_PEER_DATA *peer_info = &iio_qpi_info->PeerInfo[peer];
93 printk(BIOS_DEBUG, "\t\t\t PeerInfo[%d]\n", peer);
94 printk(BIOS_DEBUG, "\t\t\t\t Valid: 0x%x\n", peer_info->Valid);
95 printk(BIOS_DEBUG, "\t\t\t\t PeerSocId: 0x%x\n", peer_info->PeerSocId);
96 printk(BIOS_DEBUG, "\t\t\t\t PeerSocType: 0x%x\n",
97 peer_info->PeerSocType);
98 printk(BIOS_DEBUG, "\t\t\t\t PeerPort: 0x%x\n", peer_info->PeerPort);
99 }
100 }
101 printk(BIOS_DEBUG, "\t\t MemTsegSize: 0x%x\n", hob->PlatformData.MemTsegSize);
102 printk(BIOS_DEBUG, "\t\t MemIedSize: 0x%x\n", hob->PlatformData.MemIedSize);
103 printk(BIOS_DEBUG, "\t\t PciExpressBase: 0x%llx\n", hob->PlatformData.PciExpressBase);
104 printk(BIOS_DEBUG, "\t\t PciExpressSize: 0x%x\n", hob->PlatformData.PciExpressSize);
105 printk(BIOS_DEBUG, "\t\t MemTolm: 0x%x\n", hob->PlatformData.MemTolm);
106 for (uint8_t socket = 0; socket < hob->PlatformData.numofIIO; socket++) {
107 const BL_IIO_RESOURCE_INSTANCE *iio_res =
108 &hob->PlatformData.IIO_resource[socket];
109 printk(BIOS_DEBUG, "\t\t IIO_resource[%d]\n", socket);
110 printk(BIOS_DEBUG, "\t\t\t Valid: 0x%x\n", iio_res->Valid);
111 printk(BIOS_DEBUG, "\t\t\t SocketID: 0x%x\n", iio_res->SocketID);
112 printk(BIOS_DEBUG, "\t\t\t BusBase: 0x%x\n", iio_res->BusBase);
113 printk(BIOS_DEBUG, "\t\t\t BusLimit: 0x%x\n", iio_res->BusLimit);
114 printk(BIOS_DEBUG, "\t\t\t PciResourceIoBase: 0x%x\n",
115 iio_res->PciResourceIoBase);
116 printk(BIOS_DEBUG, "\t\t\t PciResourceIoLimit: 0x%x\n",
117 iio_res->PciResourceIoLimit);
118 printk(BIOS_DEBUG, "\t\t\t IoApicBase: 0x%x\n", iio_res->IoApicBase);
119 printk(BIOS_DEBUG, "\t\t\t IoApicLimit: 0x%x\n", iio_res->IoApicLimit);
120 printk(BIOS_DEBUG, "\t\t\t Mmio32Base: 0x%x\n", iio_res->Mmio32Base);
121 printk(BIOS_DEBUG, "\t\t\t Mmio32Limit: 0x%x\n", iio_res->Mmio32Limit);
122 printk(BIOS_DEBUG, "\t\t\t Mmio64Base: 0x%llx\n", iio_res->Mmio64Base);
123 printk(BIOS_DEBUG, "\t\t\t Mmio64Limit: 0x%llx\n", iio_res->Mmio64Limit);
124 for (int stack = 0; stack < BL_MAX_LOGIC_IIO_STACK; stack++) {
125 const BL_STACK_RES *stack_res = &iio_res->StackRes[stack];
126 printk(BIOS_DEBUG, "\t\t\t StackRes[%d]\n", stack);
127 printk(BIOS_DEBUG, "\t\t\t\t Personality: 0x%x\n",
128 stack_res->Personality);
129 printk(BIOS_DEBUG, "\t\t\t\t BusBase: 0x%x\n", stack_res->BusBase);
130 printk(BIOS_DEBUG, "\t\t\t\t BusLimit: 0x%x\n", stack_res->BusLimit);
131 printk(BIOS_DEBUG, "\t\t\t\t PciResourceIoBase: 0x%x\n",
132 stack_res->PciResourceIoBase);
133 printk(BIOS_DEBUG, "\t\t\t\t PciResourceIoLimit: 0x%x\n",
134 stack_res->PciResourceIoLimit);
135 printk(BIOS_DEBUG, "\t\t\t\t IoApicBase: 0x%x\n",
136 stack_res->IoApicBase);
137 printk(BIOS_DEBUG, "\t\t\t\t IoApicLimit: 0x%x\n",
138 stack_res->IoApicLimit);
139 printk(BIOS_DEBUG, "\t\t\t\t Mmio32Base: 0x%x\n",
140 stack_res->Mmio32Base);
141 printk(BIOS_DEBUG, "\t\t\t\t Mmio32Limit: 0x%x\n",
142 stack_res->Mmio32Limit);
143 printk(BIOS_DEBUG, "\t\t\t\t Mmio64Base: 0x%llx\n",
144 stack_res->Mmio64Base);
145 printk(BIOS_DEBUG, "\t\t\t\t Mmio64Limit: 0x%llx\n",
146 stack_res->Mmio64Limit);
147 printk(BIOS_DEBUG, "\t\t\t\t PciResourceMem32Base: 0x%x\n",
148 stack_res->PciResourceMem32Base);
149 printk(BIOS_DEBUG, "\t\t\t\t PciResourceMem32Limit: 0x%x\n",
150 stack_res->PciResourceMem32Limit);
151 printk(BIOS_DEBUG, "\t\t\t\t PciResourceMem64Base: 0x%llx\n",
152 stack_res->PciResourceMem64Base);
153 printk(BIOS_DEBUG, "\t\t\t\t PciResourceMem64Limit: 0x%llx\n",
154 stack_res->PciResourceMem64Limit);
155 printk(BIOS_DEBUG, "\t\t\t\t VtdBarAddress: 0x%x\n",
156 stack_res->VtdBarAddress);
157 printk(BIOS_DEBUG, "\t\t\t\t Mmio32MinSize: 0x%x\n",
158 stack_res->Mmio32MinSize);
159 }
160 printk(BIOS_DEBUG, "\t\t\t RcBaseAddress: 0x%x\n", iio_res->RcBaseAddress);
161 printk(BIOS_DEBUG, "\t\t\t PcieInfo\n");
162 for (int port = 0; port < BL_NUMBER_PORTS_PER_SOCKET; port++) {
163 const BL_IIO_PORT_INFO *port_info = &iio_res->PcieInfo.PortInfo[port];
164 printk(BIOS_DEBUG, "\t\t\t\t PortInfo[%d]\n", port);
165 printk(BIOS_DEBUG, "\t\t\t\t\t Device: 0x%x, Function: 0x%x\n",
166 port_info->Device, port_info->Function);
167 }
168 printk(BIOS_DEBUG, "\t\t\t DmaDeviceCount: 0x%x\n", iio_res->DmaDeviceCount);
169 }
170 printk(BIOS_DEBUG, "\t\t numofIIO: 0x%x\n", hob->PlatformData.numofIIO);
171 printk(BIOS_DEBUG, "\t\t MaxBusNumber: 0x%x\n", hob->PlatformData.MaxBusNumber);
172 for (int socket = 0; socket < BL_MAX_SOCKET; socket++) {
173 printk(BIOS_DEBUG, "\t\t packageBspApicID[%d]: 0x%x\n", socket,
174 hob->PlatformData.packageBspApicID[socket]);
175 }
176 printk(BIOS_DEBUG, "\t\t EVMode: 0x%x\n", hob->PlatformData.EVMode);
177 printk(BIOS_DEBUG, "\t\t Pci64BitResourceAllocation: %d\n",
178 hob->PlatformData.Pci64BitResourceAllocation);
179 for (int socket = 0; socket < BL_MAX_SOCKET; socket++) {
180 printk(BIOS_DEBUG, "\t\t SkuPersonality[%d]: 0x%x\n", socket,
181 hob->PlatformData.SkuPersonality[socket]);
182 }
183 for (int iio = 0; iio < BL_MaxIIO; iio++) {
184 for (int iio_stack = 0; iio_stack < BL_MAX_IIO_STACK; iio_stack++) {
185 printk(BIOS_DEBUG, "\t\t VMDStackEnable[%d][%d]: 0x%x\n", iio,
186 iio_stack, hob->PlatformData.VMDStackEnable[iio][iio_stack]);
187 }
188 }
189 printk(BIOS_DEBUG, "\t\t IoGranularity: 0x%x\n", hob->PlatformData.IoGranularity);
190 printk(BIOS_DEBUG, "\t\t MmiolGranularity: 0x%x\n", hob->PlatformData.MmiolGranularity);
191 printk(BIOS_DEBUG, "\t\t MmiohGranularity: 0x%llx\n",
192 hob->PlatformData.MmiohGranularity.Data);
193 printk(BIOS_DEBUG, "\t\t RemoteRequestThreshold: 0x%x\n",
194 hob->PlatformData.RemoteRequestThreshold);
195 printk(BIOS_DEBUG, "\t\t UboxMmioSize: 0x%x\n", hob->PlatformData.UboxMmioSize);
196 printk(BIOS_DEBUG, "\t\t MaxAddressBits: 0x%x\n", hob->PlatformData.MaxAddressBits);
197
198 printk(BIOS_DEBUG, "\t System Status\n");
199 printk(BIOS_DEBUG, "\t\t CurrentUpiiLinkSpeed: 0x%x\n",
200 hob->SystemStatus.CurrentUpiiLinkSpeed);
201 printk(BIOS_DEBUG, "\t\t CurrentUpiLinkFrequency: 0x%x\n",
202 hob->SystemStatus.CurrentUpiLinkFrequency);
203 printk(BIOS_DEBUG, "\t\t OutKtiCpuSktHotPlugEn: 0x%x\n",
204 hob->SystemStatus.OutKtiCpuSktHotPlugEn);
205 for (int socket = 0; socket < BL_MAX_SOCKET; socket++)
206 printk(BIOS_DEBUG, "\t\t OutKtiPerLinkL1En: 0x%x\n",
207 hob->SystemStatus.OutKtiPerLinkL1En[socket]);
208 printk(BIOS_DEBUG, "\t\t IsocEnable: 0x%x\n", hob->SystemStatus.IsocEnable);
209 printk(BIOS_DEBUG, "\t\t meRequestedSize: 0x%x\n", hob->SystemStatus.meRequestedSize);
210 printk(BIOS_DEBUG, "\t\t ieRequestedSize: 0x%x\n", hob->SystemStatus.ieRequestedSize);
211 printk(BIOS_DEBUG, "\t\t DmiVc1: 0x%x\n", hob->SystemStatus.DmiVc1);
212 printk(BIOS_DEBUG, "\t\t DmiVcm: 0x%x\n", hob->SystemStatus.DmiVcm);
213 printk(BIOS_DEBUG, "\t\t CpuPCPSInfo: 0x%x\n", hob->SystemStatus.CpuPCPSInfo);
214 printk(BIOS_DEBUG, "\t\t cpuSubType: 0x%x\n", hob->SystemStatus.cpuSubType);
215 printk(BIOS_DEBUG, "\t\t SystemRasType: 0x%x\n", hob->SystemStatus.SystemRasType);
216 printk(BIOS_DEBUG, "\t\t numCpus: 0x%x\n", hob->SystemStatus.numCpus);
217 printk(BIOS_DEBUG, "\t\t tolmLimit: 0x%x\n", hob->SystemStatus.tolmLimit);
218 printk(BIOS_DEBUG, "\t\t tohmLimit: 0x%x\n", hob->SystemStatus.tohmLimit);
219 printk(BIOS_DEBUG, "\t\t RcVersion\n");
220 printk(BIOS_DEBUG, "\t\t\t Major: 0x%x\n", hob->SystemStatus.RcVersion.Major);
221 printk(BIOS_DEBUG, "\t\t\t Minor: 0x%x\n", hob->SystemStatus.RcVersion.Minor);
222 printk(BIOS_DEBUG, "\t\t\t Revision: 0x%x\n", hob->SystemStatus.RcVersion.Revision);
223 printk(BIOS_DEBUG, "\t\t\t BuildNumber: 0x%x\n",
224 hob->SystemStatus.RcVersion.BuildNumber);
225 printk(BIOS_DEBUG, "\t\t MsrTraceEnable: 0x%x\n", hob->SystemStatus.MsrTraceEnable);
226 printk(BIOS_DEBUG, "\t\t DdrXoverMode: 0x%x\n", hob->SystemStatus.DdrXoverMode);
227 printk(BIOS_DEBUG, "\t\t bootMode: 0x%x\n", hob->SystemStatus.bootMode);
228 printk(BIOS_DEBUG, "\t\t OutClusterOnDieEn: 0x%x\n",
229 hob->SystemStatus.OutClusterOnDieEn);
230 printk(BIOS_DEBUG, "\t\t OutSncEn: 0x%x\n", hob->SystemStatus.OutSncEn);
231 printk(BIOS_DEBUG, "\t\t OutNumOfCluster: 0x%x\n", hob->SystemStatus.OutNumOfCluster);
232 for (int socket = 0; socket < BL_MAX_SOCKET; socket++) {
233 for (int imc = 0; imc < BL_MAX_IMC; imc++) {
234 printk(BIOS_DEBUG, "\t\t imcEnabled[%d][%d]: 0x%x\n", socket, imc,
235 hob->SystemStatus.imcEnabled[socket][imc]);
236 }
237 }
238 printk(BIOS_DEBUG, "\t\t LlcSizeReg: 0x%x\n", hob->SystemStatus.LlcSizeReg);
239 for (int socket = 0; socket < BL_MAX_SOCKET; socket++) {
240 for (int ch = 0; ch < BL_MAX_CH; ch++) {
241 printk(BIOS_DEBUG, "\t\t chEnabled[%d][%d]: 0x%x\n", socket, ch,
242 hob->SystemStatus.chEnabled[socket][ch]);
243 }
244 }
245 for (int node = 0; node < BL_MC_MAX_NODE; node++) {
246 printk(BIOS_DEBUG, "\t\t memNode[%d]: 0x%x\n", node,
247 hob->SystemStatus.memNode[node]);
248 }
249 printk(BIOS_DEBUG, "\t\t IoDcMode: 0x%x\n", hob->SystemStatus.IoDcMode);
250 printk(BIOS_DEBUG, "\t\t DfxRstCplBitsEn: 0x%x\n", hob->SystemStatus.DfxRstCplBitsEn);
251 }
252
253 static void soc_display_fsp_fia_override_status(const BL_FIA_OVERRIDE_STATUS_HOB *hob)
254 {
255 if (!hob)
256 return;
257 printk(BIOS_DEBUG, "FIA Override Status\n");
258 printk(BIOS_DEBUG, "\t FiaMuxConfigGetStatus: 0x%08x\n", hob->FiaMuxConfigGetStatus);
259 printk(BIOS_DEBUG, "\t FiaMuxConfigSetStatus: 0x%08x\n", hob->FiaMuxConfigSetStatus);
260 printk(BIOS_DEBUG, "\t FiaMuxConfigSetRequired: 0x%08x\n",
261 hob->FiaMuxConfigSetRequired);
262 }
263
264 static void soc_display_fsp_smbios_memory_info(const FSP_SMBIOS_MEMORY_INFO *hob)
265 {
266 if (!hob)
267 return;
268
269 printk(BIOS_DEBUG, "SMBIOS Memory Info\n");
270 printk(BIOS_DEBUG, "\t Revision: 0x%x\n", hob->Revision);
271 printk(BIOS_DEBUG, "\t DataWidth: 0x%x\n", hob->DataWidth);
272 printk(BIOS_DEBUG, "\t MemoryType: 0x%x\n", hob->MemoryType);
273 printk(BIOS_DEBUG, "\t MemoryFrequencyInMHz: 0x%x\n", hob->MemoryFrequencyInMHz);
274 printk(BIOS_DEBUG, "\t ErrorCorrectionType: 0x%x\n", hob->ErrorCorrectionType);
275 printk(BIOS_DEBUG, "\t ChannelCount: 0x%x\n", hob->ChannelCount);
276 for (uint8_t channel = 0; channel < hob->ChannelCount; channel++) {
277 const CHANNEL_INFO *channel_info = &hob->ChannelInfo[channel];
278 printk(BIOS_DEBUG, "\t ChannelInfo[%d]\n", channel);
279 printk(BIOS_DEBUG, "\t\t ChannelId: 0x%x\n", channel_info->ChannelId);
280 printk(BIOS_DEBUG, "\t\t DimmCount: 0x%x\n", channel_info->DimmCount);
281 for (uint8_t dimm = 0; dimm < channel_info->DimmCount; dimm++) {
282 const DIMM_INFO *dimm_info = &channel_info->DimmInfo[dimm];
283 printk(BIOS_DEBUG, "\t\t\t DimmInfo[%d]\n", dimm);
284 printk(BIOS_DEBUG, "\t\t\t\t DimmId: 0x%x\n", dimm_info->DimmId);
285 printk(BIOS_DEBUG, "\t\t\t\t SizeInMb: 0x%x\n", dimm_info->SizeInMb);
286 printk(BIOS_DEBUG, "\t\t\t\t MfgId: 0x%x\n", dimm_info->MfgId);
287 printk(BIOS_DEBUG, "\t\t\t\t ModulePartNum: %s\n",
288 dimm_info->ModulePartNum);
289 }
290 }
291 }
292
293 void soc_display_hob(const struct hob_header *hob)
294 {
295 uint8_t *guid;
296
297 if (hob->type != HOB_TYPE_GUID_EXTENSION)
298 return;
299
300 guid = (uint8_t *)fsp_hob_header_to_resource(hob);
301 if (fsp_guid_compare(guid, fsp_hob_iio_uds_data_guid.b))
302 soc_display_fsp_iio_uds_data_hob(
303 (const BL_IIO_UDS *)(guid + sizeof(fsp_hob_iio_uds_data_guid)));
304 else if (fsp_guid_compare(guid, fsp_hob_fia_override_status_guid.b))
305 soc_display_fsp_fia_override_status(
306 (const BL_FIA_OVERRIDE_STATUS_HOB
307 *)(guid + sizeof(fsp_hob_fia_override_status_guid)));
308 else if (fsp_guid_compare(guid, fsp_hob_smbios_memory_info_guid.b))
309 soc_display_fsp_smbios_memory_info(
310 (const FSP_SMBIOS_MEMORY_INFO
311 *)(guid + sizeof(fsp_hob_smbios_memory_info_guid)));
312 }