2 Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
3 SPDX-License-Identifier: BSD-2-Clause-Patent
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 #include <Guid/BootManagerMenu.h>
15 #define ROW_LIMITER 16
19 (*HOB_PRINT_HANDLER
) (
27 HOB_PRINT_HANDLER PrintHandler
;
28 } HOB_PRINT_HANDLER_TABLE
;
30 CHAR8
*mMemoryTypeStr
[] = {
31 "EfiReservedMemoryType",
34 "EfiBootServicesCode",
35 "EfiBootServicesData",
36 "EfiRuntimeServicesCode",
37 "EfiRuntimeServicesData",
38 "EfiConventionalMemory",
40 "EfiACPIReclaimMemory",
43 "EfiMemoryMappedIOPortSpace",
45 "EfiPersistentMemory",
49 CHAR8
*mResource_Type_List
[] = {
50 "EFI_RESOURCE_SYSTEM_MEMORY ", // 0x00000000
51 "EFI_RESOURCE_MEMORY_MAPPED_IO ", // 0x00000001
52 "EFI_RESOURCE_IO ", // 0x00000002
53 "EFI_RESOURCE_FIRMWARE_DEVICE ", // 0x00000003
54 "EFI_RESOURCE_MEMORY_MAPPED_IO_PORT ", // 0x00000004
55 "EFI_RESOURCE_MEMORY_RESERVED ", // 0x00000005
56 "EFI_RESOURCE_IO_RESERVED ", // 0x00000006
57 "EFI_RESOURCE_MAX_MEMORY_TYPE " // 0x00000007
69 GUID_HOB_PRINT PrintHandler
;
71 } GUID_HOB_PRINT_HANDLE
;
76 } PRINT_MEMORY_ALLOCCATION_HOB
;
79 Print the Hex value of a given range.
80 @param[in] DataStart A pointer to the start of data to be printed.
81 @param[in] DataSize The length of the data to be printed.
82 @retval EFI_SUCCESS If it completed successfully.
94 StartAddr
= DataStart
;
95 for (Index1
= 0; Index1
* ROW_LIMITER
< DataSize
; Index1
++) {
96 DEBUG ((DEBUG_VERBOSE
, " 0x%04p:", (DataStart
- StartAddr
)));
97 for (Index2
= 0; (Index2
< ROW_LIMITER
) && (Index1
* ROW_LIMITER
+ Index2
< DataSize
); Index2
++) {
98 DEBUG ((DEBUG_VERBOSE
, " %02x", *DataStart
));
102 DEBUG ((DEBUG_VERBOSE
, "\n"));
109 Print the information in HandOffHob.
111 @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_HANDOFF.
112 @param[in] HobLength The length in bytes of HOB of type EFI_HOB_TYPE_HANDOFF.
113 @retval EFI_SUCCESS If it completed successfully.
121 EFI_PEI_HOB_POINTERS Hob
;
123 Hob
.Raw
= (UINT8
*)HobStart
;
124 ASSERT (HobLength
>= sizeof (*Hob
.HandoffInformationTable
));
125 DEBUG ((DEBUG_INFO
, " BootMode = 0x%x\n", Hob
.HandoffInformationTable
->BootMode
));
126 DEBUG ((DEBUG_INFO
, " EfiMemoryTop = 0x%lx\n", Hob
.HandoffInformationTable
->EfiMemoryTop
));
127 DEBUG ((DEBUG_INFO
, " EfiMemoryBottom = 0x%lx\n", Hob
.HandoffInformationTable
->EfiMemoryBottom
));
128 DEBUG ((DEBUG_INFO
, " EfiFreeMemoryTop = 0x%lx\n", Hob
.HandoffInformationTable
->EfiFreeMemoryTop
));
129 DEBUG ((DEBUG_INFO
, " EfiFreeMemoryBottom = 0x%lx\n", Hob
.HandoffInformationTable
->EfiFreeMemoryBottom
));
130 DEBUG ((DEBUG_INFO
, " EfiEndOfHobList = 0x%lx\n", Hob
.HandoffInformationTable
->EfiEndOfHobList
));
135 Print the information in Memory Allocation Hob.
136 @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_MEMORY_ALLOCATION.
137 @param[in] HobLength The length in bytes of HOB of type EFI_HOB_TYPE_MEMORY_ALLOCATION.
138 @retval EFI_SUCCESS If it completed successfully.
141 PrintMemoryAllocationHob (
146 EFI_PEI_HOB_POINTERS Hob
;
148 Hob
.Raw
= (UINT8
*)HobStart
;
150 if (CompareGuid (&Hob
.MemoryAllocation
->AllocDescriptor
.Name
, &gEfiHobMemoryAllocStackGuid
)) {
151 ASSERT (HobLength
>= sizeof (*Hob
.MemoryAllocationStack
));
152 DEBUG ((DEBUG_INFO
, " Type = EFI_HOB_MEMORY_ALLOCATION_STACK\n"));
153 } else if (CompareGuid (&Hob
.MemoryAllocation
->AllocDescriptor
.Name
, &gEfiHobMemoryAllocBspStoreGuid
)) {
154 ASSERT (HobLength
>= sizeof (*Hob
.MemoryAllocationBspStore
));
155 DEBUG ((DEBUG_INFO
, " Type = EFI_HOB_MEMORY_ALLOCATION_BSP_STORE\n"));
156 } else if (CompareGuid (&Hob
.MemoryAllocation
->AllocDescriptor
.Name
, &gEfiHobMemoryAllocModuleGuid
)) {
157 ASSERT (HobLength
>= sizeof (*Hob
.MemoryAllocationModule
));
158 DEBUG ((DEBUG_INFO
, " Type = EFI_HOB_MEMORY_ALLOCATION_MODULE\n"));
159 DEBUG ((DEBUG_INFO
, " Module Name = %g\n", Hob
.MemoryAllocationModule
->ModuleName
));
160 DEBUG ((DEBUG_INFO
, " Physical Address = 0x%lx\n", Hob
.MemoryAllocationModule
->EntryPoint
));
162 ASSERT (HobLength
>= sizeof (*Hob
.MemoryAllocation
));
163 DEBUG ((DEBUG_INFO
, " Type = EFI_HOB_TYPE_MEMORY_ALLOCATION\n"));
166 DEBUG ((DEBUG_INFO
, " MemoryBaseAddress = 0x%lx\n", Hob
.MemoryAllocationStack
->AllocDescriptor
.MemoryBaseAddress
));
167 DEBUG ((DEBUG_INFO
, " MemoryLength = 0x%lx\n", Hob
.MemoryAllocationStack
->AllocDescriptor
.MemoryLength
));
168 DEBUG ((DEBUG_INFO
, " MemoryType = %a \n", mMemoryTypeStr
[Hob
.MemoryAllocationStack
->AllocDescriptor
.MemoryType
]));
173 Print the information in Resource Discriptor Hob.
174 @param[in] HobStart A pointer to HOB of type EFI_HOB_TYPE_RESOURCE_DESCRIPTOR.
175 @param[in] HobLength The Length in bytes of HOB of type EFI_HOB_TYPE_RESOURCE_DESCRIPTOR.
176 @retval EFI_SUCCESS If it completed successfully.
179 PrintResourceDiscriptorHob (
184 EFI_PEI_HOB_POINTERS Hob
;
186 Hob
.Raw
= (UINT8
*)HobStart
;
187 ASSERT (HobLength
>= sizeof (*Hob
.ResourceDescriptor
));
189 DEBUG ((DEBUG_INFO
, " ResourceType = %a\n", mResource_Type_List
[Hob
.ResourceDescriptor
->ResourceType
]));
190 if (!IsZeroGuid (&Hob
.ResourceDescriptor
->Owner
)) {
191 DEBUG ((DEBUG_INFO
, " Owner = %g\n", Hob
.ResourceDescriptor
->Owner
));
194 DEBUG ((DEBUG_INFO
, " ResourceAttribute = 0x%x\n", Hob
.ResourceDescriptor
->ResourceAttribute
));
195 DEBUG ((DEBUG_INFO
, " PhysicalStart = 0x%lx\n", Hob
.ResourceDescriptor
->PhysicalStart
));
196 DEBUG ((DEBUG_INFO
, " ResourceLength = 0x%lx\n", Hob
.ResourceDescriptor
->ResourceLength
));
201 Print the information in Acpi Guid Hob.
203 @param[in] HobRaw A pointer to the start of gUniversalPayloadAcpiTableGuid HOB.
204 @param[in] HobLength The size of the HOB data buffer.
206 @retval EFI_SUCCESS If it completed successfully.
214 UNIVERSAL_PAYLOAD_ACPI_TABLE
*AcpiTableHob
;
216 AcpiTableHob
= (UNIVERSAL_PAYLOAD_ACPI_TABLE
*)GET_GUID_HOB_DATA (HobRaw
);
217 ASSERT (HobLength
>= AcpiTableHob
->Header
.Length
);
218 DEBUG ((DEBUG_INFO
, " Revision = 0x%x\n", AcpiTableHob
->Header
.Revision
));
219 DEBUG ((DEBUG_INFO
, " Length = 0x%x\n", AcpiTableHob
->Header
.Length
));
220 DEBUG ((DEBUG_INFO
, " Rsdp = 0x%p\n", (UINT64
)AcpiTableHob
->Rsdp
));
225 Print the information in Serial Guid Hob.
226 @param[in] HobRaw A pointer to the start of gUniversalPayloadSerialPortInfoGuid HOB.
227 @param[in] HobLength The size of the HOB data buffer.
229 @retval EFI_SUCCESS If it completed successfully.
237 UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO
*SerialPortInfo
;
239 SerialPortInfo
= (UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO
*)GET_GUID_HOB_DATA (HobRaw
);
240 ASSERT (HobLength
>= SerialPortInfo
->Header
.Length
);
241 DEBUG ((DEBUG_INFO
, " Revision = 0x%x\n", SerialPortInfo
->Header
.Revision
));
242 DEBUG ((DEBUG_INFO
, " Length = 0x%x\n", SerialPortInfo
->Header
.Length
));
243 DEBUG ((DEBUG_INFO
, " UseMmio = 0x%x\n", SerialPortInfo
->UseMmio
));
244 DEBUG ((DEBUG_INFO
, " RegisterStride = 0x%x\n", SerialPortInfo
->RegisterStride
));
245 DEBUG ((DEBUG_INFO
, " BaudRate = %d\n", SerialPortInfo
->BaudRate
));
246 DEBUG ((DEBUG_INFO
, " RegisterBase = 0x%lx\n", SerialPortInfo
->RegisterBase
));
251 Print the information in Smbios Guid Hob.
252 @param[in] HobRaw A pointer to the start of gUniversalPayloadSmbios3TableGuid HOB.
253 @param[in] HobLength The size of the HOB data buffer.
254 @retval EFI_SUCCESS If it completed successfully.
257 PrintSmbios3GuidHob (
262 UNIVERSAL_PAYLOAD_SMBIOS_TABLE
*SmBiosTable
;
264 SmBiosTable
= (UNIVERSAL_PAYLOAD_SMBIOS_TABLE
*)GET_GUID_HOB_DATA (HobRaw
);
265 ASSERT (HobLength
>= SmBiosTable
->Header
.Length
);
266 DEBUG ((DEBUG_INFO
, " Revision = 0x%x\n", SmBiosTable
->Header
.Revision
));
267 DEBUG ((DEBUG_INFO
, " Length = 0x%x\n", SmBiosTable
->Header
.Length
));
268 DEBUG ((DEBUG_INFO
, " SmBiosEntryPoint = 0x%lx\n", (UINT64
)SmBiosTable
->SmBiosEntryPoint
));
273 Print the information in Smbios Guid Hob.
274 @param[in] HobRaw A pointer to the start of gUniversalPayloadSmbiosTableGuid HOB.
275 @param[in] HobLength The size of the HOB data buffer.
277 @retval EFI_SUCCESS If it completed successfully.
280 PrintSmbiosTablGuidHob (
285 UNIVERSAL_PAYLOAD_SMBIOS_TABLE
*SmBiosTable
;
287 SmBiosTable
= (UNIVERSAL_PAYLOAD_SMBIOS_TABLE
*)GET_GUID_HOB_DATA (HobRaw
);
288 ASSERT (HobLength
>= SmBiosTable
->Header
.Length
);
289 DEBUG ((DEBUG_INFO
, " Revision = 0x%x\n", SmBiosTable
->Header
.Revision
));
290 DEBUG ((DEBUG_INFO
, " Length = 0x%x\n", SmBiosTable
->Header
.Length
));
291 DEBUG ((DEBUG_INFO
, " SmBiosEntryPoint = 0x%lx\n", (UINT64
)SmBiosTable
->SmBiosEntryPoint
));
296 Print the information in Acpi BoardInfo Guid Hob.
297 @param[in] HobRaw A pointer to the start of gUefiAcpiBoardInfoGuid HOB.
298 @param[in] HobLength The size of the HOB data buffer.
300 @retval EFI_SUCCESS If it completed successfully.
303 PrintAcpiBoardInfoGuidHob (
308 ACPI_BOARD_INFO
*AcpBoardInfo
;
310 AcpBoardInfo
= (ACPI_BOARD_INFO
*)GET_GUID_HOB_DATA (HobRaw
);
311 ASSERT (HobLength
>= sizeof (*AcpBoardInfo
));
312 DEBUG ((DEBUG_INFO
, " Revision = 0x%x\n", AcpBoardInfo
->Revision
));
313 DEBUG ((DEBUG_INFO
, " Reserved0 = 0x%x\n", AcpBoardInfo
->Reserved0
));
314 DEBUG ((DEBUG_INFO
, " ResetValue = 0x%x\n", AcpBoardInfo
->ResetValue
));
315 DEBUG ((DEBUG_INFO
, " PmEvtBase = 0x%lx\n", AcpBoardInfo
->PmEvtBase
));
316 DEBUG ((DEBUG_INFO
, " PmGpeEnBase = 0x%lx\n", AcpBoardInfo
->PmGpeEnBase
));
317 DEBUG ((DEBUG_INFO
, " PmCtrlRegBase = 0x%lx\n", AcpBoardInfo
->PmCtrlRegBase
));
318 DEBUG ((DEBUG_INFO
, " PmTimerRegBase = 0x%lx\n", AcpBoardInfo
->PmTimerRegBase
));
319 DEBUG ((DEBUG_INFO
, " ResetRegAddress = 0x%lx\n", AcpBoardInfo
->ResetRegAddress
));
320 DEBUG ((DEBUG_INFO
, " PcieBaseAddress = 0x%lx\n", AcpBoardInfo
->PcieBaseAddress
));
321 DEBUG ((DEBUG_INFO
, " PcieBaseSize = 0x%lx\n", AcpBoardInfo
->PcieBaseSize
));
326 Print the information in Pci RootBridge Info Guid Hob.
327 @param[in] HobRaw A pointer to the start of gUniversalPayloadPciRootBridgeInfoGuid HOB.
328 @param[in] HobLength The size of the HOB data buffer.
330 @retval EFI_SUCCESS If it completed successfully.
333 PrintPciRootBridgeInfoGuidHob (
338 UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES
*PciRootBridges
;
343 PciRootBridges
= (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES
*)GET_GUID_HOB_DATA (HobRaw
);
344 Length
= sizeof (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES
) + PciRootBridges
->Count
* sizeof (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGE
);
345 ASSERT (HobLength
>= Length
);
346 DEBUG ((DEBUG_INFO
, " Revision = 0x%x\n", PciRootBridges
->Header
.Revision
));
347 DEBUG ((DEBUG_INFO
, " Length = 0x%x\n", PciRootBridges
->Header
.Length
));
348 DEBUG ((DEBUG_INFO
, " Count = 0x%x\n", PciRootBridges
->Count
));
349 DEBUG ((DEBUG_INFO
, " ResourceAssigned = %a\n", (PciRootBridges
->ResourceAssigned
? "True" : "False")));
351 while (Index
< PciRootBridges
->Count
) {
352 DEBUG ((DEBUG_INFO
, " Root Bridge Index[%d]:\n", Index
));
353 DEBUG ((DEBUG_INFO
, " Segment = 0x%x\n", PciRootBridges
->RootBridge
[Index
].Segment
));
354 DEBUG ((DEBUG_INFO
, " Supports = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Supports
));
355 DEBUG ((DEBUG_INFO
, " Attributes = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Attributes
));
356 DEBUG ((DEBUG_INFO
, " DmaAbove4G = 0x%x\n", PciRootBridges
->RootBridge
[Index
].DmaAbove4G
));
357 DEBUG ((DEBUG_INFO
, " NoExtendedConfigSpace = 0x%x\n", PciRootBridges
->RootBridge
[Index
].NoExtendedConfigSpace
));
358 DEBUG ((DEBUG_INFO
, " AllocationAttributes = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].AllocationAttributes
));
359 DEBUG ((DEBUG_INFO
, " Bus.Base = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Bus
.Base
));
360 DEBUG ((DEBUG_INFO
, " Bus.Limit = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Bus
.Limit
));
361 DEBUG ((DEBUG_INFO
, " Bus.Translation = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Bus
.Translation
));
362 DEBUG ((DEBUG_INFO
, " Io.Base = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Io
.Base
));
363 DEBUG ((DEBUG_INFO
, " Io.Limit = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Io
.Limit
));
364 DEBUG ((DEBUG_INFO
, " Io.Translation = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Io
.Translation
));
365 DEBUG ((DEBUG_INFO
, " Mem.Base = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Mem
.Base
));
366 DEBUG ((DEBUG_INFO
, " Mem.Limit = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Mem
.Limit
));
367 DEBUG ((DEBUG_INFO
, " Mem.Translation = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Mem
.Translation
));
368 DEBUG ((DEBUG_INFO
, " MemAbove4G.Base = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].MemAbove4G
.Base
));
369 DEBUG ((DEBUG_INFO
, " MemAbove4G.Limit = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].MemAbove4G
.Limit
));
370 DEBUG ((DEBUG_INFO
, " MemAbove4G.Translation = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].MemAbove4G
.Translation
));
371 DEBUG ((DEBUG_INFO
, " PMem.Base = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].PMem
.Base
));
372 DEBUG ((DEBUG_INFO
, " PMem.Limit = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].PMem
.Limit
));
373 DEBUG ((DEBUG_INFO
, " PMem.Translation = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].PMem
.Translation
));
374 DEBUG ((DEBUG_INFO
, " PMemAbove4G.Base = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].PMemAbove4G
.Base
));
375 DEBUG ((DEBUG_INFO
, " PMemAbove4G.Limit = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].PMemAbove4G
.Limit
));
376 DEBUG ((DEBUG_INFO
, " PMemAbove4G.Translation = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].PMemAbove4G
.Translation
));
384 Print the information in Extra Data Guid Hob.
385 @param[in] HobRaw A pointer to the start of gUniversalPayloadExtraDataGuid HOB.
386 @param[in] HobLength The size of the HOB data buffer.
388 @retval EFI_SUCCESS If it completed successfully.
391 PrintExtraDataGuidHob (
396 UNIVERSAL_PAYLOAD_EXTRA_DATA
*ExtraData
;
401 ExtraData
= (UNIVERSAL_PAYLOAD_EXTRA_DATA
*)GET_GUID_HOB_DATA (HobRaw
);
402 Length
= sizeof (UNIVERSAL_PAYLOAD_EXTRA_DATA
) + ExtraData
->Count
* sizeof (UNIVERSAL_PAYLOAD_EXTRA_DATA_ENTRY
);
403 ASSERT (HobLength
>= Length
);
404 DEBUG ((DEBUG_INFO
, " Revision = 0x%x\n", ExtraData
->Header
.Revision
));
405 DEBUG ((DEBUG_INFO
, " Length = 0x%x\n", ExtraData
->Header
.Length
));
406 DEBUG ((DEBUG_INFO
, " Count = 0x%x\n", ExtraData
->Count
));
408 while (Index
< ExtraData
->Count
) {
409 DEBUG ((DEBUG_INFO
, " Id[%d] = %a\n", Index
, ExtraData
->Entry
[Index
].Identifier
));
410 DEBUG ((DEBUG_INFO
, " Base[%d] = 0x%lx\n", Index
, ExtraData
->Entry
[Index
].Base
));
411 DEBUG ((DEBUG_INFO
, " Size[%d] = 0x%lx\n", Index
, ExtraData
->Entry
[Index
].Size
));
419 Print the information in MemoryTypeInfoGuidHob.
420 @param[in] HobRaw A pointer to the start of gEfiMemoryTypeInformationGuid HOB.
421 @param[in] HobLength The size of the HOB data buffer.
423 @retval EFI_SUCCESS If it completed successfully.
426 PrintMemoryTypeInfoGuidHob (
431 EFI_MEMORY_TYPE_INFORMATION
*MemoryTypeInfo
;
433 MemoryTypeInfo
= (EFI_MEMORY_TYPE_INFORMATION
*)GET_GUID_HOB_DATA (HobRaw
);
434 ASSERT (HobLength
>= sizeof (*MemoryTypeInfo
));
435 DEBUG ((DEBUG_INFO
, " Type = 0x%x\n", MemoryTypeInfo
->Type
));
436 DEBUG ((DEBUG_INFO
, " NumberOfPages = 0x%x\n", MemoryTypeInfo
->NumberOfPages
));
441 Print the information in EdkiiBootManagerMenuFileGuid.
442 @param[in] HobRaw A pointer to the start of gEdkiiBootManagerMenuFileGuid HOB.
443 @param[in] HobLength The size of the HOB data buffer.
444 @retval EFI_SUCCESS If it completed successfully.
447 PrintBootManagerMenuGuidHob (
452 UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU
*BootManagerMenuFile
;
454 BootManagerMenuFile
= (UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU
*)GET_GUID_HOB_DATA (HobRaw
);
455 ASSERT (HobLength
>= sizeof (*BootManagerMenuFile
));
456 DEBUG ((DEBUG_INFO
, " Revision = 0x%x\n", BootManagerMenuFile
->Header
.Revision
));
457 DEBUG ((DEBUG_INFO
, " Length = 0x%x\n", BootManagerMenuFile
->Header
.Length
));
458 DEBUG ((DEBUG_INFO
, " FileName = %g\n", &BootManagerMenuFile
->FileName
));
463 // Mappint table for dump Guid Hob information.
464 // This table can be easily extented.
466 GUID_HOB_PRINT_HANDLE GuidHobPrintHandleTable
[] = {
467 { &gUniversalPayloadAcpiTableGuid
, PrintAcpiGuidHob
, "gUniversalPayloadAcpiTableGuid(ACPI table Guid)" },
468 { &gUniversalPayloadSerialPortInfoGuid
, PrintSerialGuidHob
, "gUniversalPayloadSerialPortInfoGuid(Serial Port Info)" },
469 { &gUniversalPayloadSmbios3TableGuid
, PrintSmbios3GuidHob
, "gUniversalPayloadSmbios3TableGuid(SmBios Guid)" },
470 { &gUniversalPayloadSmbiosTableGuid
, PrintSmbiosTablGuidHob
, "gUniversalPayloadSmbiosTableGuid(SmBios Guid)" },
471 { &gUefiAcpiBoardInfoGuid
, PrintAcpiBoardInfoGuidHob
, "gUefiAcpiBoardInfoGuid(Acpi Guid)" },
472 { &gUniversalPayloadPciRootBridgeInfoGuid
, PrintPciRootBridgeInfoGuidHob
, "gUniversalPayloadPciRootBridgeInfoGuid(Pci Guid)" },
473 { &gEfiMemoryTypeInformationGuid
, PrintMemoryTypeInfoGuidHob
, "gEfiMemoryTypeInformationGuid(Memory Type Information Guid)" },
474 { &gUniversalPayloadExtraDataGuid
, PrintExtraDataGuidHob
, "gUniversalPayloadExtraDataGuid(PayLoad Extra Data Guid)" },
475 { &gEdkiiBootManagerMenuFileGuid
, PrintBootManagerMenuGuidHob
, "gEdkiiBootManagerMenuFileGuid(Boot Manager Menu File Guid)" }
479 Print the Guid Hob using related print handle function.
480 @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_GUID_EXTENSION.
481 @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_GUID_EXTENSION.
482 @retval EFI_SUCCESS If it completed successfully.
490 EFI_PEI_HOB_POINTERS Hob
;
494 Hob
.Raw
= (UINT8
*)HobStart
;
495 ASSERT (HobLength
>= sizeof (Hob
.Guid
));
497 for (Index
= 0; Index
< ARRAY_SIZE (GuidHobPrintHandleTable
); Index
++) {
498 if (CompareGuid (&Hob
.Guid
->Name
, GuidHobPrintHandleTable
[Index
].Guid
)) {
499 DEBUG ((DEBUG_INFO
, " Guid = %a\n", GuidHobPrintHandleTable
[Index
].GuidName
));
500 Status
= GuidHobPrintHandleTable
[Index
].PrintHandler (Hob
.Raw
, GET_GUID_HOB_DATA_SIZE (Hob
.Raw
));
505 DEBUG ((DEBUG_INFO
, " Name = %g\n", &Hob
.Guid
->Name
));
506 PrintHex (GET_GUID_HOB_DATA (Hob
.Raw
), GET_GUID_HOB_DATA_SIZE (Hob
.Raw
));
511 Print the information in FV Hob.
512 @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_FV.
513 @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_FV.
514 @retval EFI_SUCCESS If it completed successfully.
522 EFI_PEI_HOB_POINTERS Hob
;
524 Hob
.Raw
= (UINT8
*)HobStart
;
525 ASSERT (HobLength
>= sizeof (*Hob
.FirmwareVolume
));
527 DEBUG ((DEBUG_INFO
, " BaseAddress = 0x%lx\n", Hob
.FirmwareVolume
->BaseAddress
));
528 DEBUG ((DEBUG_INFO
, " Length = 0x%lx\n", Hob
.FirmwareVolume
->Length
));
533 Print the information in Cpu Hob.
534 @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_CPU.
535 @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_CPU.
536 @retval EFI_SUCCESS If it completed successfully.
544 EFI_PEI_HOB_POINTERS Hob
;
546 Hob
.Raw
= (UINT8
*)HobStart
;
547 ASSERT (HobLength
>= sizeof (*Hob
.Cpu
));
549 DEBUG ((DEBUG_INFO
, " SizeOfMemorySpace = 0x%lx\n", Hob
.Cpu
->SizeOfMemorySpace
));
550 DEBUG ((DEBUG_INFO
, " SizeOfIoSpace = 0x%lx\n", Hob
.Cpu
->SizeOfIoSpace
));
555 Print the information in MemoryPoolHob.
556 @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_MEMORY_POOL.
557 @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_MEMORY_POOL.
558 @retval EFI_SUCCESS If it completed successfully.
570 Print the information in Fv2Hob.
571 @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_FV2.
572 @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_FV2.
573 @retval EFI_SUCCESS If it completed successfully.
581 EFI_PEI_HOB_POINTERS Hob
;
583 Hob
.Raw
= (UINT8
*)HobStart
;
584 ASSERT (HobLength
>= sizeof (*Hob
.FirmwareVolume2
));
586 DEBUG ((DEBUG_INFO
, " BaseAddress = 0x%lx\n", Hob
.FirmwareVolume2
->BaseAddress
));
587 DEBUG ((DEBUG_INFO
, " Length = 0x%lx\n", Hob
.FirmwareVolume2
->Length
));
588 DEBUG ((DEBUG_INFO
, " FvName = %g\n", &Hob
.FirmwareVolume2
->FvName
));
589 DEBUG ((DEBUG_INFO
, " FileName = %g\n", &Hob
.FirmwareVolume2
->FileName
));
594 Print the information in Capsule Hob.
595 @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_UEFI_CAPSULE.
596 @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_UEFI_CAPSULE.
597 @retval EFI_SUCCESS If it completed successfully.
605 EFI_PEI_HOB_POINTERS Hob
;
607 Hob
.Raw
= (UINT8
*)HobStart
;
608 ASSERT (HobLength
>= sizeof (*Hob
.Capsule
));
610 DEBUG ((DEBUG_INFO
, " BaseAddress = 0x%lx\n", Hob
.Capsule
->BaseAddress
));
611 DEBUG ((DEBUG_INFO
, " Length = 0x%lx\n", Hob
.Capsule
->Length
));
616 Print the information in Fv3 Hob.
617 @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_FV3.
618 @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_FV3.
619 @retval EFI_SUCCESS If it completed successfully.
627 EFI_PEI_HOB_POINTERS Hob
;
629 Hob
.Raw
= (UINT8
*)HobStart
;
630 ASSERT (HobLength
>= sizeof (*Hob
.FirmwareVolume3
));
632 DEBUG ((DEBUG_INFO
, " BaseAddress = 0x%lx\n", Hob
.FirmwareVolume3
->BaseAddress
));
633 DEBUG ((DEBUG_INFO
, " Length = 0x%lx\n", Hob
.FirmwareVolume3
->Length
));
634 DEBUG ((DEBUG_INFO
, " AuthenticationStatus = 0x%x\n", Hob
.FirmwareVolume3
->AuthenticationStatus
));
635 DEBUG ((DEBUG_INFO
, " ExtractedFv = %a\n", (Hob
.FirmwareVolume3
->ExtractedFv
? "True" : "False")));
636 DEBUG ((DEBUG_INFO
, " FVName = %g\n", &Hob
.FirmwareVolume3
->FvName
));
637 DEBUG ((DEBUG_INFO
, " FileName = %g\n", &Hob
.FirmwareVolume3
->FileName
));
642 // Mappint table from Hob type to Hob print function.
644 HOB_PRINT_HANDLER_TABLE mHobHandles
[] = {
645 { EFI_HOB_TYPE_HANDOFF
, "EFI_HOB_TYPE_HANDOFF", PrintHandOffHob
},
646 { EFI_HOB_TYPE_MEMORY_ALLOCATION
, "EFI_HOB_TYPE_MEMORY_ALLOCATION", PrintMemoryAllocationHob
},
647 { EFI_HOB_TYPE_RESOURCE_DESCRIPTOR
, "EFI_HOB_TYPE_RESOURCE_DESCRIPTOR", PrintResourceDiscriptorHob
},
648 { EFI_HOB_TYPE_GUID_EXTENSION
, "EFI_HOB_TYPE_GUID_EXTENSION", PrintGuidHob
},
649 { EFI_HOB_TYPE_FV
, "EFI_HOB_TYPE_FV", PrintFvHob
},
650 { EFI_HOB_TYPE_CPU
, "EFI_HOB_TYPE_CPU", PrintCpuHob
},
651 { EFI_HOB_TYPE_MEMORY_POOL
, "EFI_HOB_TYPE_MEMORY_POOL", PrintMemoryPoolHob
},
652 { EFI_HOB_TYPE_FV2
, "EFI_HOB_TYPE_FV2", PrintFv2Hob
},
653 { EFI_HOB_TYPE_UEFI_CAPSULE
, "EFI_HOB_TYPE_UEFI_CAPSULE", PrintCapsuleHob
},
654 { EFI_HOB_TYPE_FV3
, "EFI_HOB_TYPE_FV3", PrintFv3Hob
}
658 Print all HOBs info from the HOB list.
659 @param[in] HobStart A pointer to the HOB list
660 @return The pointer to the HOB list.
664 IN CONST VOID
*HobStart
667 EFI_PEI_HOB_POINTERS Hob
;
671 ASSERT (HobStart
!= NULL
);
673 Hob
.Raw
= (UINT8
*)HobStart
;
674 DEBUG ((DEBUG_INFO
, "Print all Hob information from Hob 0x%p\n", Hob
.Raw
));
678 // Parse the HOB list to see which type it is, and print the information.
680 while (!END_OF_HOB_LIST (Hob
)) {
681 for (Index
= 0; Index
< ARRAY_SIZE (mHobHandles
); Index
++) {
682 if (Hob
.Header
->HobType
== mHobHandles
[Index
].Type
) {
683 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
));
684 mHobHandles
[Index
].PrintHandler (Hob
.Raw
, Hob
.Header
->HobLength
);
689 if (Index
== ARRAY_SIZE (mHobHandles
)) {
690 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
));
691 DEBUG ((DEBUG_INFO
, " Unkown Hob type\n"));
692 PrintHex (Hob
.Raw
, Hob
.Header
->HobLength
);
696 Hob
.Raw
= GET_NEXT_HOB (Hob
);
699 DEBUG ((DEBUG_INFO
, "There are totally %d Hobs, the End Hob address is %p\n", Count
, Hob
.Raw
));