1 | /** @file
|
---|
2 | Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
|
---|
3 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
4 | **/
|
---|
5 |
|
---|
6 | #include "UefiPayloadEntry.h"
|
---|
7 | #include <UniversalPayload/AcpiTable.h>
|
---|
8 | #include <UniversalPayload/SerialPortInfo.h>
|
---|
9 | #include <UniversalPayload/PciRootBridges.h>
|
---|
10 | #include <UniversalPayload/ExtraData.h>
|
---|
11 | #include <Guid/MemoryTypeInformation.h>
|
---|
12 | #include <Guid/AcpiBoardInfoGuid.h>
|
---|
13 |
|
---|
14 | #define ROW_LIMITER 16
|
---|
15 |
|
---|
16 | typedef
|
---|
17 | EFI_STATUS
|
---|
18 | (*HOB_PRINT_HANDLER) (
|
---|
19 | IN VOID *Hob,
|
---|
20 | IN UINT16 HobLength
|
---|
21 | );
|
---|
22 |
|
---|
23 | typedef struct {
|
---|
24 | UINT16 Type;
|
---|
25 | CHAR8 *Name;
|
---|
26 | HOB_PRINT_HANDLER PrintHandler;
|
---|
27 | } HOB_PRINT_HANDLER_TABLE;
|
---|
28 |
|
---|
29 | CHAR8 *mMemoryTypeStr[] = {
|
---|
30 | "EfiReservedMemoryType",
|
---|
31 | "EfiLoaderCode",
|
---|
32 | "EfiLoaderData",
|
---|
33 | "EfiBootServicesCode",
|
---|
34 | "EfiBootServicesData",
|
---|
35 | "EfiRuntimeServicesCode",
|
---|
36 | "EfiRuntimeServicesData",
|
---|
37 | "EfiConventionalMemory",
|
---|
38 | "EfiUnusableMemory",
|
---|
39 | "EfiACPIReclaimMemory",
|
---|
40 | "EfiACPIMemoryNVS",
|
---|
41 | "EfiMemoryMappedIO",
|
---|
42 | "EfiMemoryMappedIOPortSpace",
|
---|
43 | "EfiPalCode",
|
---|
44 | "EfiPersistentMemory",
|
---|
45 | "EfiMaxMemoryType"
|
---|
46 | };
|
---|
47 |
|
---|
48 | CHAR8 *mResource_Type_List[] = {
|
---|
49 | "EFI_RESOURCE_SYSTEM_MEMORY ", // 0x00000000
|
---|
50 | "EFI_RESOURCE_MEMORY_MAPPED_IO ", // 0x00000001
|
---|
51 | "EFI_RESOURCE_IO ", // 0x00000002
|
---|
52 | "EFI_RESOURCE_FIRMWARE_DEVICE ", // 0x00000003
|
---|
53 | "EFI_RESOURCE_MEMORY_MAPPED_IO_PORT ", // 0x00000004
|
---|
54 | "EFI_RESOURCE_MEMORY_RESERVED ", // 0x00000005
|
---|
55 | "EFI_RESOURCE_IO_RESERVED ", // 0x00000006
|
---|
56 | "EFI_RESOURCE_MAX_MEMORY_TYPE " // 0x00000007
|
---|
57 | };
|
---|
58 |
|
---|
59 | typedef
|
---|
60 | EFI_STATUS
|
---|
61 | (*GUID_HOB_PRINT) (
|
---|
62 | IN UINT8 *HobRaw,
|
---|
63 | IN UINT16 HobLength
|
---|
64 | );
|
---|
65 |
|
---|
66 | typedef struct {
|
---|
67 | EFI_GUID *Guid;
|
---|
68 | GUID_HOB_PRINT PrintHandler;
|
---|
69 | CHAR8 *GuidName;
|
---|
70 | } GUID_HOB_PRINT_HANDLE;
|
---|
71 |
|
---|
72 | typedef struct {
|
---|
73 | EFI_GUID *Guid;
|
---|
74 | CHAR8 *Type;
|
---|
75 | } PRINT_MEMORY_ALLOCCATION_HOB;
|
---|
76 |
|
---|
77 | /**
|
---|
78 | Print the Hex value of a given range.
|
---|
79 | @param[in] DataStart A pointer to the start of data to be printed.
|
---|
80 | @param[in] DataSize The length of the data to be printed.
|
---|
81 | @retval EFI_SUCCESS If it completed successfully.
|
---|
82 | **/
|
---|
83 | EFI_STATUS
|
---|
84 | PrintHex (
|
---|
85 | IN UINT8 *DataStart,
|
---|
86 | IN UINT16 DataSize
|
---|
87 | )
|
---|
88 | {
|
---|
89 | UINTN Index1;
|
---|
90 | UINTN Index2;
|
---|
91 | UINT8 *StartAddr;
|
---|
92 |
|
---|
93 | StartAddr = DataStart;
|
---|
94 | for (Index1 = 0; Index1 * ROW_LIMITER < DataSize; Index1++) {
|
---|
95 | DEBUG ((DEBUG_VERBOSE, " 0x%04p:", (DataStart - StartAddr)));
|
---|
96 | for (Index2 = 0; (Index2 < ROW_LIMITER) && (Index1 * ROW_LIMITER + Index2 < DataSize); Index2++) {
|
---|
97 | DEBUG ((DEBUG_VERBOSE, " %02x", *DataStart));
|
---|
98 | DataStart++;
|
---|
99 | }
|
---|
100 |
|
---|
101 | DEBUG ((DEBUG_VERBOSE, "\n"));
|
---|
102 | }
|
---|
103 |
|
---|
104 | return EFI_SUCCESS;
|
---|
105 | }
|
---|
106 |
|
---|
107 | /**
|
---|
108 | Print the information in HandOffHob.
|
---|
109 |
|
---|
110 | @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_HANDOFF.
|
---|
111 | @param[in] HobLength The length in bytes of HOB of type EFI_HOB_TYPE_HANDOFF.
|
---|
112 | @retval EFI_SUCCESS If it completed successfully.
|
---|
113 | **/
|
---|
114 | EFI_STATUS
|
---|
115 | PrintHandOffHob (
|
---|
116 | IN VOID *HobStart,
|
---|
117 | IN UINT16 HobLength
|
---|
118 | )
|
---|
119 | {
|
---|
120 | EFI_PEI_HOB_POINTERS Hob;
|
---|
121 |
|
---|
122 | Hob.Raw = (UINT8 *)HobStart;
|
---|
123 | ASSERT (HobLength >= sizeof (*Hob.HandoffInformationTable));
|
---|
124 | DEBUG ((DEBUG_INFO, " BootMode = 0x%x\n", Hob.HandoffInformationTable->BootMode));
|
---|
125 | DEBUG ((DEBUG_INFO, " EfiMemoryTop = 0x%lx\n", Hob.HandoffInformationTable->EfiMemoryTop));
|
---|
126 | DEBUG ((DEBUG_INFO, " EfiMemoryBottom = 0x%lx\n", Hob.HandoffInformationTable->EfiMemoryBottom));
|
---|
127 | DEBUG ((DEBUG_INFO, " EfiFreeMemoryTop = 0x%lx\n", Hob.HandoffInformationTable->EfiFreeMemoryTop));
|
---|
128 | DEBUG ((DEBUG_INFO, " EfiFreeMemoryBottom = 0x%lx\n", Hob.HandoffInformationTable->EfiFreeMemoryBottom));
|
---|
129 | DEBUG ((DEBUG_INFO, " EfiEndOfHobList = 0x%lx\n", Hob.HandoffInformationTable->EfiEndOfHobList));
|
---|
130 | return EFI_SUCCESS;
|
---|
131 | }
|
---|
132 |
|
---|
133 | /**
|
---|
134 | Print the information in Memory Allocation Hob.
|
---|
135 | @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_MEMORY_ALLOCATION.
|
---|
136 | @param[in] HobLength The length in bytes of HOB of type EFI_HOB_TYPE_MEMORY_ALLOCATION.
|
---|
137 | @retval EFI_SUCCESS If it completed successfully.
|
---|
138 | **/
|
---|
139 | EFI_STATUS
|
---|
140 | PrintMemoryAllocationHob (
|
---|
141 | IN VOID *HobStart,
|
---|
142 | IN UINT16 HobLength
|
---|
143 | )
|
---|
144 | {
|
---|
145 | EFI_PEI_HOB_POINTERS Hob;
|
---|
146 |
|
---|
147 | Hob.Raw = (UINT8 *)HobStart;
|
---|
148 |
|
---|
149 | if (CompareGuid (&Hob.MemoryAllocation->AllocDescriptor.Name, &gEfiHobMemoryAllocStackGuid)) {
|
---|
150 | ASSERT (HobLength >= sizeof (*Hob.MemoryAllocationStack));
|
---|
151 | DEBUG ((DEBUG_INFO, " Type = EFI_HOB_MEMORY_ALLOCATION_STACK\n"));
|
---|
152 | } else if (CompareGuid (&Hob.MemoryAllocation->AllocDescriptor.Name, &gEfiHobMemoryAllocBspStoreGuid)) {
|
---|
153 | ASSERT (HobLength >= sizeof (*Hob.MemoryAllocationBspStore));
|
---|
154 | DEBUG ((DEBUG_INFO, " Type = EFI_HOB_MEMORY_ALLOCATION_BSP_STORE\n"));
|
---|
155 | } else if (CompareGuid (&Hob.MemoryAllocation->AllocDescriptor.Name, &gEfiHobMemoryAllocModuleGuid)) {
|
---|
156 | ASSERT (HobLength >= sizeof (*Hob.MemoryAllocationModule));
|
---|
157 | DEBUG ((DEBUG_INFO, " Type = EFI_HOB_MEMORY_ALLOCATION_MODULE\n"));
|
---|
158 | DEBUG ((DEBUG_INFO, " Module Name = %g\n", Hob.MemoryAllocationModule->ModuleName));
|
---|
159 | DEBUG ((DEBUG_INFO, " Physical Address = 0x%lx\n", Hob.MemoryAllocationModule->EntryPoint));
|
---|
160 | } else {
|
---|
161 | ASSERT (HobLength >= sizeof (*Hob.MemoryAllocation));
|
---|
162 | DEBUG ((DEBUG_INFO, " Type = EFI_HOB_TYPE_MEMORY_ALLOCATION\n"));
|
---|
163 | }
|
---|
164 |
|
---|
165 | DEBUG ((DEBUG_INFO, " MemoryBaseAddress = 0x%lx\n", Hob.MemoryAllocationStack->AllocDescriptor.MemoryBaseAddress));
|
---|
166 | DEBUG ((DEBUG_INFO, " MemoryLength = 0x%lx\n", Hob.MemoryAllocationStack->AllocDescriptor.MemoryLength));
|
---|
167 | DEBUG ((DEBUG_INFO, " MemoryType = %a \n", mMemoryTypeStr[Hob.MemoryAllocationStack->AllocDescriptor.MemoryType]));
|
---|
168 | return EFI_SUCCESS;
|
---|
169 | }
|
---|
170 |
|
---|
171 | /**
|
---|
172 | Print the information in Resource Discriptor Hob.
|
---|
173 | @param[in] HobStart A pointer to HOB of type EFI_HOB_TYPE_RESOURCE_DESCRIPTOR.
|
---|
174 | @param[in] HobLength The Length in bytes of HOB of type EFI_HOB_TYPE_RESOURCE_DESCRIPTOR.
|
---|
175 | @retval EFI_SUCCESS If it completed successfully.
|
---|
176 | **/
|
---|
177 | EFI_STATUS
|
---|
178 | PrintResourceDiscriptorHob (
|
---|
179 | IN VOID *HobStart,
|
---|
180 | IN UINT16 HobLength
|
---|
181 | )
|
---|
182 | {
|
---|
183 | EFI_PEI_HOB_POINTERS Hob;
|
---|
184 |
|
---|
185 | Hob.Raw = (UINT8 *)HobStart;
|
---|
186 | ASSERT (HobLength >= sizeof (*Hob.ResourceDescriptor));
|
---|
187 |
|
---|
188 | DEBUG ((DEBUG_INFO, " ResourceType = %a\n", mResource_Type_List[Hob.ResourceDescriptor->ResourceType]));
|
---|
189 | if (!IsZeroGuid (&Hob.ResourceDescriptor->Owner)) {
|
---|
190 | DEBUG ((DEBUG_INFO, " Owner = %g\n", Hob.ResourceDescriptor->Owner));
|
---|
191 | }
|
---|
192 |
|
---|
193 | DEBUG ((DEBUG_INFO, " ResourceAttribute = 0x%x\n", Hob.ResourceDescriptor->ResourceAttribute));
|
---|
194 | DEBUG ((DEBUG_INFO, " PhysicalStart = 0x%lx\n", Hob.ResourceDescriptor->PhysicalStart));
|
---|
195 | DEBUG ((DEBUG_INFO, " ResourceLength = 0x%lx\n", Hob.ResourceDescriptor->ResourceLength));
|
---|
196 | return EFI_SUCCESS;
|
---|
197 | }
|
---|
198 |
|
---|
199 | /**
|
---|
200 | Print the information in Acpi Guid Hob.
|
---|
201 |
|
---|
202 | @param[in] HobRaw A pointer to the start of gUniversalPayloadAcpiTableGuid HOB.
|
---|
203 | @param[in] HobLength The size of the HOB data buffer.
|
---|
204 |
|
---|
205 | @retval EFI_SUCCESS If it completed successfully.
|
---|
206 | **/
|
---|
207 | EFI_STATUS
|
---|
208 | PrintAcpiGuidHob (
|
---|
209 | IN UINT8 *HobRaw,
|
---|
210 | IN UINT16 HobLength
|
---|
211 | )
|
---|
212 | {
|
---|
213 | UNIVERSAL_PAYLOAD_ACPI_TABLE *AcpiTableHob;
|
---|
214 |
|
---|
215 | AcpiTableHob = (UNIVERSAL_PAYLOAD_ACPI_TABLE *)GET_GUID_HOB_DATA (HobRaw);
|
---|
216 | ASSERT (HobLength >= AcpiTableHob->Header.Length);
|
---|
217 | DEBUG ((DEBUG_INFO, " Revision = 0x%x\n", AcpiTableHob->Header.Revision));
|
---|
218 | DEBUG ((DEBUG_INFO, " Length = 0x%x\n", AcpiTableHob->Header.Length));
|
---|
219 | DEBUG ((DEBUG_INFO, " Rsdp = 0x%p\n", (UINT64)AcpiTableHob->Rsdp));
|
---|
220 | return EFI_SUCCESS;
|
---|
221 | }
|
---|
222 |
|
---|
223 | /**
|
---|
224 | Print the information in Serial Guid Hob.
|
---|
225 | @param[in] HobRaw A pointer to the start of gUniversalPayloadSerialPortInfoGuid HOB.
|
---|
226 | @param[in] HobLength The size of the HOB data buffer.
|
---|
227 |
|
---|
228 | @retval EFI_SUCCESS If it completed successfully.
|
---|
229 | **/
|
---|
230 | EFI_STATUS
|
---|
231 | PrintSerialGuidHob (
|
---|
232 | IN UINT8 *HobRaw,
|
---|
233 | IN UINT16 HobLength
|
---|
234 | )
|
---|
235 | {
|
---|
236 | UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *SerialPortInfo;
|
---|
237 |
|
---|
238 | SerialPortInfo = (UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO *)GET_GUID_HOB_DATA (HobRaw);
|
---|
239 | ASSERT (HobLength >= SerialPortInfo->Header.Length);
|
---|
240 | DEBUG ((DEBUG_INFO, " Revision = 0x%x\n", SerialPortInfo->Header.Revision));
|
---|
241 | DEBUG ((DEBUG_INFO, " Length = 0x%x\n", SerialPortInfo->Header.Length));
|
---|
242 | DEBUG ((DEBUG_INFO, " UseMmio = 0x%x\n", SerialPortInfo->UseMmio));
|
---|
243 | DEBUG ((DEBUG_INFO, " RegisterStride = 0x%x\n", SerialPortInfo->RegisterStride));
|
---|
244 | DEBUG ((DEBUG_INFO, " BaudRate = %d\n", SerialPortInfo->BaudRate));
|
---|
245 | DEBUG ((DEBUG_INFO, " RegisterBase = 0x%lx\n", SerialPortInfo->RegisterBase));
|
---|
246 | return EFI_SUCCESS;
|
---|
247 | }
|
---|
248 |
|
---|
249 | /**
|
---|
250 | Print the information in Smbios Guid Hob.
|
---|
251 | @param[in] HobRaw A pointer to the start of gUniversalPayloadSmbios3TableGuid HOB.
|
---|
252 | @param[in] HobLength The size of the HOB data buffer.
|
---|
253 | @retval EFI_SUCCESS If it completed successfully.
|
---|
254 | **/
|
---|
255 | EFI_STATUS
|
---|
256 | PrintSmbios3GuidHob (
|
---|
257 | IN UINT8 *HobRaw,
|
---|
258 | IN UINT16 HobLength
|
---|
259 | )
|
---|
260 | {
|
---|
261 | UNIVERSAL_PAYLOAD_SMBIOS_TABLE *SmBiosTable;
|
---|
262 |
|
---|
263 | SmBiosTable = (UNIVERSAL_PAYLOAD_SMBIOS_TABLE *)GET_GUID_HOB_DATA (HobRaw);
|
---|
264 | ASSERT (HobLength >= SmBiosTable->Header.Length);
|
---|
265 | DEBUG ((DEBUG_INFO, " Revision = 0x%x\n", SmBiosTable->Header.Revision));
|
---|
266 | DEBUG ((DEBUG_INFO, " Length = 0x%x\n", SmBiosTable->Header.Length));
|
---|
267 | DEBUG ((DEBUG_INFO, " SmBiosEntryPoint = 0x%lx\n", (UINT64)SmBiosTable->SmBiosEntryPoint));
|
---|
268 | return EFI_SUCCESS;
|
---|
269 | }
|
---|
270 |
|
---|
271 | /**
|
---|
272 | Print the information in Smbios Guid Hob.
|
---|
273 | @param[in] HobRaw A pointer to the start of gUniversalPayloadSmbiosTableGuid HOB.
|
---|
274 | @param[in] HobLength The size of the HOB data buffer.
|
---|
275 |
|
---|
276 | @retval EFI_SUCCESS If it completed successfully.
|
---|
277 | **/
|
---|
278 | EFI_STATUS
|
---|
279 | PrintSmbiosTablGuidHob (
|
---|
280 | IN UINT8 *HobRaw,
|
---|
281 | IN UINT16 HobLength
|
---|
282 | )
|
---|
283 | {
|
---|
284 | UNIVERSAL_PAYLOAD_SMBIOS_TABLE *SmBiosTable;
|
---|
285 |
|
---|
286 | SmBiosTable = (UNIVERSAL_PAYLOAD_SMBIOS_TABLE *)GET_GUID_HOB_DATA (HobRaw);
|
---|
287 | ASSERT (HobLength >= SmBiosTable->Header.Length);
|
---|
288 | DEBUG ((DEBUG_INFO, " Revision = 0x%x\n", SmBiosTable->Header.Revision));
|
---|
289 | DEBUG ((DEBUG_INFO, " Length = 0x%x\n", SmBiosTable->Header.Length));
|
---|
290 | DEBUG ((DEBUG_INFO, " SmBiosEntryPoint = 0x%lx\n", (UINT64)SmBiosTable->SmBiosEntryPoint));
|
---|
291 | return EFI_SUCCESS;
|
---|
292 | }
|
---|
293 |
|
---|
294 | /**
|
---|
295 | Print the information in Acpi BoardInfo Guid Hob.
|
---|
296 | @param[in] HobRaw A pointer to the start of gUefiAcpiBoardInfoGuid HOB.
|
---|
297 | @param[in] HobLength The size of the HOB data buffer.
|
---|
298 |
|
---|
299 | @retval EFI_SUCCESS If it completed successfully.
|
---|
300 | **/
|
---|
301 | EFI_STATUS
|
---|
302 | PrintAcpiBoardInfoGuidHob (
|
---|
303 | IN UINT8 *HobRaw,
|
---|
304 | IN UINT16 HobLength
|
---|
305 | )
|
---|
306 | {
|
---|
307 | ACPI_BOARD_INFO *AcpBoardInfo;
|
---|
308 |
|
---|
309 | AcpBoardInfo = (ACPI_BOARD_INFO *)GET_GUID_HOB_DATA (HobRaw);
|
---|
310 | ASSERT (HobLength >= sizeof (*AcpBoardInfo));
|
---|
311 | DEBUG ((DEBUG_INFO, " Revision = 0x%x\n", AcpBoardInfo->Revision));
|
---|
312 | DEBUG ((DEBUG_INFO, " Reserved0 = 0x%x\n", AcpBoardInfo->Reserved0));
|
---|
313 | DEBUG ((DEBUG_INFO, " ResetValue = 0x%x\n", AcpBoardInfo->ResetValue));
|
---|
314 | DEBUG ((DEBUG_INFO, " PmEvtBase = 0x%lx\n", AcpBoardInfo->PmEvtBase));
|
---|
315 | DEBUG ((DEBUG_INFO, " PmGpeEnBase = 0x%lx\n", AcpBoardInfo->PmGpeEnBase));
|
---|
316 | DEBUG ((DEBUG_INFO, " PmCtrlRegBase = 0x%lx\n", AcpBoardInfo->PmCtrlRegBase));
|
---|
317 | DEBUG ((DEBUG_INFO, " PmTimerRegBase = 0x%lx\n", AcpBoardInfo->PmTimerRegBase));
|
---|
318 | DEBUG ((DEBUG_INFO, " ResetRegAddress = 0x%lx\n", AcpBoardInfo->ResetRegAddress));
|
---|
319 | DEBUG ((DEBUG_INFO, " PcieBaseAddress = 0x%lx\n", AcpBoardInfo->PcieBaseAddress));
|
---|
320 | DEBUG ((DEBUG_INFO, " PcieBaseSize = 0x%lx\n", AcpBoardInfo->PcieBaseSize));
|
---|
321 | return EFI_SUCCESS;
|
---|
322 | }
|
---|
323 |
|
---|
324 | /**
|
---|
325 | Print the information in Pci RootBridge Info Guid Hob.
|
---|
326 | @param[in] HobRaw A pointer to the start of gUniversalPayloadPciRootBridgeInfoGuid HOB.
|
---|
327 | @param[in] HobLength The size of the HOB data buffer.
|
---|
328 |
|
---|
329 | @retval EFI_SUCCESS If it completed successfully.
|
---|
330 | **/
|
---|
331 | EFI_STATUS
|
---|
332 | PrintPciRootBridgeInfoGuidHob (
|
---|
333 | IN UINT8 *HobRaw,
|
---|
334 | IN UINT16 HobLength
|
---|
335 | )
|
---|
336 | {
|
---|
337 | UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *PciRootBridges;
|
---|
338 | UINTN Index;
|
---|
339 | UINTN Length;
|
---|
340 |
|
---|
341 | Index = 0;
|
---|
342 | PciRootBridges = (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *)GET_GUID_HOB_DATA (HobRaw);
|
---|
343 | Length = sizeof (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES) + PciRootBridges->Count * sizeof (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE);
|
---|
344 | ASSERT (HobLength >= Length);
|
---|
345 | DEBUG ((DEBUG_INFO, " Revision = 0x%x\n", PciRootBridges->Header.Revision));
|
---|
346 | DEBUG ((DEBUG_INFO, " Length = 0x%x\n", PciRootBridges->Header.Length));
|
---|
347 | DEBUG ((DEBUG_INFO, " Count = 0x%x\n", PciRootBridges->Count));
|
---|
348 | DEBUG ((DEBUG_INFO, " ResourceAssigned = %a\n", (PciRootBridges->ResourceAssigned ? "True" : "False")));
|
---|
349 |
|
---|
350 | while (Index < PciRootBridges->Count) {
|
---|
351 | DEBUG ((DEBUG_INFO, " Root Bridge Index[%d]:\n", Index));
|
---|
352 | DEBUG ((DEBUG_INFO, " Segment = 0x%x\n", PciRootBridges->RootBridge[Index].Segment));
|
---|
353 | DEBUG ((DEBUG_INFO, " Supports = 0x%lx\n", PciRootBridges->RootBridge[Index].Supports));
|
---|
354 | DEBUG ((DEBUG_INFO, " Attributes = 0x%lx\n", PciRootBridges->RootBridge[Index].Attributes));
|
---|
355 | DEBUG ((DEBUG_INFO, " DmaAbove4G = 0x%x\n", PciRootBridges->RootBridge[Index].DmaAbove4G));
|
---|
356 | DEBUG ((DEBUG_INFO, " NoExtendedConfigSpace = 0x%x\n", PciRootBridges->RootBridge[Index].NoExtendedConfigSpace));
|
---|
357 | DEBUG ((DEBUG_INFO, " AllocationAttributes = 0x%lx\n", PciRootBridges->RootBridge[Index].AllocationAttributes));
|
---|
358 | DEBUG ((DEBUG_INFO, " Bus.Base = 0x%lx\n", PciRootBridges->RootBridge[Index].Bus.Base));
|
---|
359 | DEBUG ((DEBUG_INFO, " Bus.Limit = 0x%lx\n", PciRootBridges->RootBridge[Index].Bus.Limit));
|
---|
360 | DEBUG ((DEBUG_INFO, " Bus.Translation = 0x%lx\n", PciRootBridges->RootBridge[Index].Bus.Translation));
|
---|
361 | DEBUG ((DEBUG_INFO, " Io.Base = 0x%lx\n", PciRootBridges->RootBridge[Index].Io.Base));
|
---|
362 | DEBUG ((DEBUG_INFO, " Io.Limit = 0x%lx\n", PciRootBridges->RootBridge[Index].Io.Limit));
|
---|
363 | DEBUG ((DEBUG_INFO, " Io.Translation = 0x%lx\n", PciRootBridges->RootBridge[Index].Io.Translation));
|
---|
364 | DEBUG ((DEBUG_INFO, " Mem.Base = 0x%lx\n", PciRootBridges->RootBridge[Index].Mem.Base));
|
---|
365 | DEBUG ((DEBUG_INFO, " Mem.Limit = 0x%lx\n", PciRootBridges->RootBridge[Index].Mem.Limit));
|
---|
366 | DEBUG ((DEBUG_INFO, " Mem.Translation = 0x%lx\n", PciRootBridges->RootBridge[Index].Mem.Translation));
|
---|
367 | DEBUG ((DEBUG_INFO, " MemAbove4G.Base = 0x%lx\n", PciRootBridges->RootBridge[Index].MemAbove4G.Base));
|
---|
368 | DEBUG ((DEBUG_INFO, " MemAbove4G.Limit = 0x%lx\n", PciRootBridges->RootBridge[Index].MemAbove4G.Limit));
|
---|
369 | DEBUG ((DEBUG_INFO, " MemAbove4G.Translation = 0x%lx\n", PciRootBridges->RootBridge[Index].MemAbove4G.Translation));
|
---|
370 | DEBUG ((DEBUG_INFO, " PMem.Base = 0x%lx\n", PciRootBridges->RootBridge[Index].PMem.Base));
|
---|
371 | DEBUG ((DEBUG_INFO, " PMem.Limit = 0x%lx\n", PciRootBridges->RootBridge[Index].PMem.Limit));
|
---|
372 | DEBUG ((DEBUG_INFO, " PMem.Translation = 0x%lx\n", PciRootBridges->RootBridge[Index].PMem.Translation));
|
---|
373 | DEBUG ((DEBUG_INFO, " PMemAbove4G.Base = 0x%lx\n", PciRootBridges->RootBridge[Index].PMemAbove4G.Base));
|
---|
374 | DEBUG ((DEBUG_INFO, " PMemAbove4G.Limit = 0x%lx\n", PciRootBridges->RootBridge[Index].PMemAbove4G.Limit));
|
---|
375 | DEBUG ((DEBUG_INFO, " PMemAbove4G.Translation = 0x%lx\n", PciRootBridges->RootBridge[Index].PMemAbove4G.Translation));
|
---|
376 | Index += 1;
|
---|
377 | }
|
---|
378 |
|
---|
379 | return EFI_SUCCESS;
|
---|
380 | }
|
---|
381 |
|
---|
382 | /**
|
---|
383 | Print the information in Extra Data Guid Hob.
|
---|
384 | @param[in] HobRaw A pointer to the start of gUniversalPayloadExtraDataGuid HOB.
|
---|
385 | @param[in] HobLength The size of the HOB data buffer.
|
---|
386 |
|
---|
387 | @retval EFI_SUCCESS If it completed successfully.
|
---|
388 | **/
|
---|
389 | EFI_STATUS
|
---|
390 | PrintExtraDataGuidHob (
|
---|
391 | IN UINT8 *HobRaw,
|
---|
392 | IN UINT16 HobLength
|
---|
393 | )
|
---|
394 | {
|
---|
395 | UNIVERSAL_PAYLOAD_EXTRA_DATA *ExtraData;
|
---|
396 | UINTN Index;
|
---|
397 | UINTN Length;
|
---|
398 |
|
---|
399 | Index = 0;
|
---|
400 | ExtraData = (UNIVERSAL_PAYLOAD_EXTRA_DATA *)GET_GUID_HOB_DATA (HobRaw);
|
---|
401 | Length = sizeof (UNIVERSAL_PAYLOAD_EXTRA_DATA) + ExtraData->Count * sizeof (UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY);
|
---|
402 | ASSERT (HobLength >= Length);
|
---|
403 | DEBUG ((DEBUG_INFO, " Revision = 0x%x\n", ExtraData->Header.Revision));
|
---|
404 | DEBUG ((DEBUG_INFO, " Length = 0x%x\n", ExtraData->Header.Length));
|
---|
405 | DEBUG ((DEBUG_INFO, " Count = 0x%x\n", ExtraData->Count));
|
---|
406 |
|
---|
407 | while (Index < ExtraData->Count) {
|
---|
408 | DEBUG ((DEBUG_INFO, " Id[%d] = %a\n", Index, ExtraData->Entry[Index].Identifier));
|
---|
409 | DEBUG ((DEBUG_INFO, " Base[%d] = 0x%lx\n", Index, ExtraData->Entry[Index].Base));
|
---|
410 | DEBUG ((DEBUG_INFO, " Size[%d] = 0x%lx\n", Index, ExtraData->Entry[Index].Size));
|
---|
411 | Index += 1;
|
---|
412 | }
|
---|
413 |
|
---|
414 | return EFI_SUCCESS;
|
---|
415 | }
|
---|
416 |
|
---|
417 | /**
|
---|
418 | Print the information in MemoryTypeInfoGuidHob.
|
---|
419 | @param[in] HobRaw A pointer to the start of gEfiMemoryTypeInformationGuid HOB.
|
---|
420 | @param[in] HobLength The size of the HOB data buffer.
|
---|
421 |
|
---|
422 | @retval EFI_SUCCESS If it completed successfully.
|
---|
423 | **/
|
---|
424 | EFI_STATUS
|
---|
425 | PrintMemoryTypeInfoGuidHob (
|
---|
426 | IN UINT8 *HobRaw,
|
---|
427 | IN UINT16 HobLength
|
---|
428 | )
|
---|
429 | {
|
---|
430 | EFI_MEMORY_TYPE_INFORMATION *MemoryTypeInfo;
|
---|
431 |
|
---|
432 | MemoryTypeInfo = (EFI_MEMORY_TYPE_INFORMATION *)GET_GUID_HOB_DATA (HobRaw);
|
---|
433 | ASSERT (HobLength >= sizeof (*MemoryTypeInfo));
|
---|
434 | DEBUG ((DEBUG_INFO, " Type = 0x%x\n", MemoryTypeInfo->Type));
|
---|
435 | DEBUG ((DEBUG_INFO, " NumberOfPages = 0x%x\n", MemoryTypeInfo->NumberOfPages));
|
---|
436 | return EFI_SUCCESS;
|
---|
437 | }
|
---|
438 |
|
---|
439 | //
|
---|
440 | // Mappint table for dump Guid Hob information.
|
---|
441 | // This table can be easily extented.
|
---|
442 | //
|
---|
443 | GUID_HOB_PRINT_HANDLE GuidHobPrintHandleTable[] = {
|
---|
444 | { &gUniversalPayloadAcpiTableGuid, PrintAcpiGuidHob, "gUniversalPayloadAcpiTableGuid(ACPI table Guid)" },
|
---|
445 | { &gUniversalPayloadSerialPortInfoGuid, PrintSerialGuidHob, "gUniversalPayloadSerialPortInfoGuid(Serial Port Info)" },
|
---|
446 | { &gUniversalPayloadSmbios3TableGuid, PrintSmbios3GuidHob, "gUniversalPayloadSmbios3TableGuid(SmBios Guid)" },
|
---|
447 | { &gUniversalPayloadSmbiosTableGuid, PrintSmbiosTablGuidHob, "gUniversalPayloadSmbiosTableGuid(SmBios Guid)" },
|
---|
448 | { &gUefiAcpiBoardInfoGuid, PrintAcpiBoardInfoGuidHob, "gUefiAcpiBoardInfoGuid(Acpi Guid)" },
|
---|
449 | { &gUniversalPayloadPciRootBridgeInfoGuid, PrintPciRootBridgeInfoGuidHob, "gUniversalPayloadPciRootBridgeInfoGuid(Pci Guid)" },
|
---|
450 | { &gEfiMemoryTypeInformationGuid, PrintMemoryTypeInfoGuidHob, "gEfiMemoryTypeInformationGuid(Memory Type Information Guid)" },
|
---|
451 | { &gUniversalPayloadExtraDataGuid, PrintExtraDataGuidHob, "gUniversalPayloadExtraDataGuid(PayLoad Extra Data Guid)" }
|
---|
452 | };
|
---|
453 |
|
---|
454 | /**
|
---|
455 | Print the Guid Hob using related print handle function.
|
---|
456 | @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_GUID_EXTENSION.
|
---|
457 | @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_GUID_EXTENSION.
|
---|
458 | @retval EFI_SUCCESS If it completed successfully.
|
---|
459 | **/
|
---|
460 | EFI_STATUS
|
---|
461 | PrintGuidHob (
|
---|
462 | IN VOID *HobStart,
|
---|
463 | IN UINT16 HobLength
|
---|
464 | )
|
---|
465 | {
|
---|
466 | EFI_PEI_HOB_POINTERS Hob;
|
---|
467 | UINTN Index;
|
---|
468 | EFI_STATUS Status;
|
---|
469 |
|
---|
470 | Hob.Raw = (UINT8 *)HobStart;
|
---|
471 | ASSERT (HobLength >= sizeof (Hob.Guid));
|
---|
472 |
|
---|
473 | for (Index = 0; Index < ARRAY_SIZE (GuidHobPrintHandleTable); Index++) {
|
---|
474 | if (CompareGuid (&Hob.Guid->Name, GuidHobPrintHandleTable[Index].Guid)) {
|
---|
475 | DEBUG ((DEBUG_INFO, " Guid = %a\n", GuidHobPrintHandleTable[Index].GuidName));
|
---|
476 | Status = GuidHobPrintHandleTable[Index].PrintHandler (Hob.Raw, GET_GUID_HOB_DATA_SIZE (Hob.Raw));
|
---|
477 | return Status;
|
---|
478 | }
|
---|
479 | }
|
---|
480 |
|
---|
481 | DEBUG ((DEBUG_INFO, " Name = %g\n", &Hob.Guid->Name));
|
---|
482 | PrintHex (GET_GUID_HOB_DATA (Hob.Raw), GET_GUID_HOB_DATA_SIZE (Hob.Raw));
|
---|
483 | return EFI_SUCCESS;
|
---|
484 | }
|
---|
485 |
|
---|
486 | /**
|
---|
487 | Print the information in FV Hob.
|
---|
488 | @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_FV.
|
---|
489 | @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_FV.
|
---|
490 | @retval EFI_SUCCESS If it completed successfully.
|
---|
491 | **/
|
---|
492 | EFI_STATUS
|
---|
493 | PrintFvHob (
|
---|
494 | IN VOID *HobStart,
|
---|
495 | IN UINT16 HobLength
|
---|
496 | )
|
---|
497 | {
|
---|
498 | EFI_PEI_HOB_POINTERS Hob;
|
---|
499 |
|
---|
500 | Hob.Raw = (UINT8 *)HobStart;
|
---|
501 | ASSERT (HobLength >= sizeof (*Hob.FirmwareVolume));
|
---|
502 |
|
---|
503 | DEBUG ((DEBUG_INFO, " BaseAddress = 0x%lx\n", Hob.FirmwareVolume->BaseAddress));
|
---|
504 | DEBUG ((DEBUG_INFO, " Length = 0x%lx\n", Hob.FirmwareVolume->Length));
|
---|
505 | return EFI_SUCCESS;
|
---|
506 | }
|
---|
507 |
|
---|
508 | /**
|
---|
509 | Print the information in Cpu Hob.
|
---|
510 | @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_CPU.
|
---|
511 | @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_CPU.
|
---|
512 | @retval EFI_SUCCESS If it completed successfully.
|
---|
513 | **/
|
---|
514 | EFI_STATUS
|
---|
515 | PrintCpuHob (
|
---|
516 | IN VOID *HobStart,
|
---|
517 | IN UINT16 HobLength
|
---|
518 | )
|
---|
519 | {
|
---|
520 | EFI_PEI_HOB_POINTERS Hob;
|
---|
521 |
|
---|
522 | Hob.Raw = (UINT8 *)HobStart;
|
---|
523 | ASSERT (HobLength >= sizeof (*Hob.Cpu));
|
---|
524 |
|
---|
525 | DEBUG ((DEBUG_INFO, " SizeOfMemorySpace = 0x%lx\n", Hob.Cpu->SizeOfMemorySpace));
|
---|
526 | DEBUG ((DEBUG_INFO, " SizeOfIoSpace = 0x%lx\n", Hob.Cpu->SizeOfIoSpace));
|
---|
527 | return EFI_SUCCESS;
|
---|
528 | }
|
---|
529 |
|
---|
530 | /**
|
---|
531 | Print the information in MemoryPoolHob.
|
---|
532 | @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_MEMORY_POOL.
|
---|
533 | @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_MEMORY_POOL.
|
---|
534 | @retval EFI_SUCCESS If it completed successfully.
|
---|
535 | **/
|
---|
536 | EFI_STATUS
|
---|
537 | PrintMemoryPoolHob (
|
---|
538 | IN VOID *HobStart,
|
---|
539 | IN UINT16 HobLength
|
---|
540 | )
|
---|
541 | {
|
---|
542 | return EFI_SUCCESS;
|
---|
543 | }
|
---|
544 |
|
---|
545 | /**
|
---|
546 | Print the information in Fv2Hob.
|
---|
547 | @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_FV2.
|
---|
548 | @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_FV2.
|
---|
549 | @retval EFI_SUCCESS If it completed successfully.
|
---|
550 | **/
|
---|
551 | EFI_STATUS
|
---|
552 | PrintFv2Hob (
|
---|
553 | IN VOID *HobStart,
|
---|
554 | IN UINT16 HobLength
|
---|
555 | )
|
---|
556 | {
|
---|
557 | EFI_PEI_HOB_POINTERS Hob;
|
---|
558 |
|
---|
559 | Hob.Raw = (UINT8 *)HobStart;
|
---|
560 | ASSERT (HobLength >= sizeof (*Hob.FirmwareVolume2));
|
---|
561 |
|
---|
562 | DEBUG ((DEBUG_INFO, " BaseAddress = 0x%lx\n", Hob.FirmwareVolume2->BaseAddress));
|
---|
563 | DEBUG ((DEBUG_INFO, " Length = 0x%lx\n", Hob.FirmwareVolume2->Length));
|
---|
564 | DEBUG ((DEBUG_INFO, " FvName = %g\n", &Hob.FirmwareVolume2->FvName));
|
---|
565 | DEBUG ((DEBUG_INFO, " FileName = %g\n", &Hob.FirmwareVolume2->FileName));
|
---|
566 | return EFI_SUCCESS;
|
---|
567 | }
|
---|
568 |
|
---|
569 | /**
|
---|
570 | Print the information in Capsule Hob.
|
---|
571 | @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_UEFI_CAPSULE.
|
---|
572 | @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_UEFI_CAPSULE.
|
---|
573 | @retval EFI_SUCCESS If it completed successfully.
|
---|
574 | **/
|
---|
575 | EFI_STATUS
|
---|
576 | PrintCapsuleHob (
|
---|
577 | IN VOID *HobStart,
|
---|
578 | IN UINT16 HobLength
|
---|
579 | )
|
---|
580 | {
|
---|
581 | EFI_PEI_HOB_POINTERS Hob;
|
---|
582 |
|
---|
583 | Hob.Raw = (UINT8 *)HobStart;
|
---|
584 | ASSERT (HobLength >= sizeof (*Hob.Capsule));
|
---|
585 |
|
---|
586 | DEBUG ((DEBUG_INFO, " BaseAddress = 0x%lx\n", Hob.Capsule->BaseAddress));
|
---|
587 | DEBUG ((DEBUG_INFO, " Length = 0x%lx\n", Hob.Capsule->Length));
|
---|
588 | return EFI_SUCCESS;
|
---|
589 | }
|
---|
590 |
|
---|
591 | /**
|
---|
592 | Print the information in Fv3 Hob.
|
---|
593 | @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_FV3.
|
---|
594 | @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_FV3.
|
---|
595 | @retval EFI_SUCCESS If it completed successfully.
|
---|
596 | **/
|
---|
597 | EFI_STATUS
|
---|
598 | PrintFv3Hob (
|
---|
599 | IN VOID *HobStart,
|
---|
600 | IN UINT16 HobLength
|
---|
601 | )
|
---|
602 | {
|
---|
603 | EFI_PEI_HOB_POINTERS Hob;
|
---|
604 |
|
---|
605 | Hob.Raw = (UINT8 *)HobStart;
|
---|
606 | ASSERT (HobLength >= sizeof (*Hob.FirmwareVolume3));
|
---|
607 |
|
---|
608 | DEBUG ((DEBUG_INFO, " BaseAddress = 0x%lx\n", Hob.FirmwareVolume3->BaseAddress));
|
---|
609 | DEBUG ((DEBUG_INFO, " Length = 0x%lx\n", Hob.FirmwareVolume3->Length));
|
---|
610 | DEBUG ((DEBUG_INFO, " AuthenticationStatus = 0x%x\n", Hob.FirmwareVolume3->AuthenticationStatus));
|
---|
611 | DEBUG ((DEBUG_INFO, " ExtractedFv = %a\n", (Hob.FirmwareVolume3->ExtractedFv ? "True" : "False")));
|
---|
612 | DEBUG ((DEBUG_INFO, " FVName = %g\n", &Hob.FirmwareVolume3->FvName));
|
---|
613 | DEBUG ((DEBUG_INFO, " FileName = %g\n", &Hob.FirmwareVolume3->FileName));
|
---|
614 | return EFI_SUCCESS;
|
---|
615 | }
|
---|
616 |
|
---|
617 | //
|
---|
618 | // Mappint table from Hob type to Hob print function.
|
---|
619 | //
|
---|
620 | HOB_PRINT_HANDLER_TABLE mHobHandles[] = {
|
---|
621 | { EFI_HOB_TYPE_HANDOFF, "EFI_HOB_TYPE_HANDOFF", PrintHandOffHob },
|
---|
622 | { EFI_HOB_TYPE_MEMORY_ALLOCATION, "EFI_HOB_TYPE_MEMORY_ALLOCATION", PrintMemoryAllocationHob },
|
---|
623 | { EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, "EFI_HOB_TYPE_RESOURCE_DESCRIPTOR", PrintResourceDiscriptorHob },
|
---|
624 | { EFI_HOB_TYPE_GUID_EXTENSION, "EFI_HOB_TYPE_GUID_EXTENSION", PrintGuidHob },
|
---|
625 | { EFI_HOB_TYPE_FV, "EFI_HOB_TYPE_FV", PrintFvHob },
|
---|
626 | { EFI_HOB_TYPE_CPU, "EFI_HOB_TYPE_CPU", PrintCpuHob },
|
---|
627 | { EFI_HOB_TYPE_MEMORY_POOL, "EFI_HOB_TYPE_MEMORY_POOL", PrintMemoryPoolHob },
|
---|
628 | { EFI_HOB_TYPE_FV2, "EFI_HOB_TYPE_FV2", PrintFv2Hob },
|
---|
629 | { EFI_HOB_TYPE_UEFI_CAPSULE, "EFI_HOB_TYPE_UEFI_CAPSULE", PrintCapsuleHob },
|
---|
630 | { EFI_HOB_TYPE_FV3, "EFI_HOB_TYPE_FV3", PrintFv3Hob }
|
---|
631 | };
|
---|
632 |
|
---|
633 | /**
|
---|
634 | Print all HOBs info from the HOB list.
|
---|
635 | @param[in] HobStart A pointer to the HOB list
|
---|
636 | @return The pointer to the HOB list.
|
---|
637 | **/
|
---|
638 | VOID
|
---|
639 | PrintHob (
|
---|
640 | IN CONST VOID *HobStart
|
---|
641 | )
|
---|
642 | {
|
---|
643 | EFI_PEI_HOB_POINTERS Hob;
|
---|
644 | UINTN Count;
|
---|
645 | UINTN Index;
|
---|
646 |
|
---|
647 | ASSERT (HobStart != NULL);
|
---|
648 |
|
---|
649 | Hob.Raw = (UINT8 *)HobStart;
|
---|
650 | DEBUG ((DEBUG_INFO, "Print all Hob information from Hob 0x%p\n", Hob.Raw));
|
---|
651 |
|
---|
652 | Count = 0;
|
---|
653 | //
|
---|
654 | // Parse the HOB list to see which type it is, and print the information.
|
---|
655 | //
|
---|
656 | while (!END_OF_HOB_LIST (Hob)) {
|
---|
657 | for (Index = 0; Index < ARRAY_SIZE (mHobHandles); Index++) {
|
---|
658 | if (Hob.Header->HobType == mHobHandles[Index].Type) {
|
---|
659 | DEBUG ((DEBUG_INFO, "HOB[%d]: Type = %a, Offset = 0x%p, Length = 0x%x\n", Count, mHobHandles[Index].Name, (Hob.Raw - (UINT8 *)HobStart), Hob.Header->HobLength));
|
---|
660 | mHobHandles[Index].PrintHandler (Hob.Raw, Hob.Header->HobLength);
|
---|
661 | break;
|
---|
662 | }
|
---|
663 | }
|
---|
664 |
|
---|
665 | if (Index == ARRAY_SIZE (mHobHandles)) {
|
---|
666 | DEBUG ((DEBUG_INFO, "HOB[%d]: Type = %d, Offset = 0x%p, Length = 0x%x\n", Count, Hob.Header->HobType, (Hob.Raw - (UINT8 *)HobStart), Hob.Header->HobLength));
|
---|
667 | DEBUG ((DEBUG_INFO, " Unkown Hob type\n"));
|
---|
668 | PrintHex (Hob.Raw, Hob.Header->HobLength);
|
---|
669 | }
|
---|
670 |
|
---|
671 | Count++;
|
---|
672 | Hob.Raw = GET_NEXT_HOB (Hob);
|
---|
673 | }
|
---|
674 |
|
---|
675 | DEBUG ((DEBUG_INFO, "There are totally %d Hobs, the End Hob address is %p\n", Count, Hob.Raw));
|
---|
676 | }
|
---|