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>
14 #define ROW_LIMITER 16
18 (*HOB_PRINT_HANDLER
) (
26 HOB_PRINT_HANDLER PrintHandler
;
27 } HOB_PRINT_HANDLER_TABLE
;
29 CHAR8
* mMemoryTypeStr
[] = {
30 "EfiReservedMemoryType",
33 "EfiBootServicesCode",
34 "EfiBootServicesData",
35 "EfiRuntimeServicesCode",
36 "EfiRuntimeServicesData",
37 "EfiConventionalMemory",
39 "EfiACPIReclaimMemory",
42 "EfiMemoryMappedIOPortSpace",
44 "EfiPersistentMemory",
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
68 GUID_HOB_PRINT PrintHandler
;
70 } GUID_HOB_PRINT_HANDLE
;
75 } 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
));
101 DEBUG ((DEBUG_VERBOSE
, "\n"));
108 Print the information in HandOffHob.
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.
120 EFI_PEI_HOB_POINTERS Hob
;
121 Hob
.Raw
= (UINT8
*) HobStart
;
122 ASSERT (HobLength
>= sizeof (*Hob
.HandoffInformationTable
));
123 DEBUG ((DEBUG_INFO
, " BootMode = 0x%x\n", Hob
.HandoffInformationTable
->BootMode
));
124 DEBUG ((DEBUG_INFO
, " EfiMemoryTop = 0x%lx\n", Hob
.HandoffInformationTable
->EfiMemoryTop
));
125 DEBUG ((DEBUG_INFO
, " EfiMemoryBottom = 0x%lx\n", Hob
.HandoffInformationTable
->EfiMemoryBottom
));
126 DEBUG ((DEBUG_INFO
, " EfiFreeMemoryTop = 0x%lx\n", Hob
.HandoffInformationTable
->EfiFreeMemoryTop
));
127 DEBUG ((DEBUG_INFO
, " EfiFreeMemoryBottom = 0x%lx\n", Hob
.HandoffInformationTable
->EfiFreeMemoryBottom
));
128 DEBUG ((DEBUG_INFO
, " EfiEndOfHobList = 0x%lx\n", Hob
.HandoffInformationTable
->EfiEndOfHobList
));
133 Print the information in Memory Allocation Hob.
134 @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_MEMORY_ALLOCATION.
135 @param[in] HobLength The length in bytes of HOB of type EFI_HOB_TYPE_MEMORY_ALLOCATION.
136 @retval EFI_SUCCESS If it completed successfully.
139 PrintMemoryAllocationHob (
144 EFI_PEI_HOB_POINTERS Hob
;
146 Hob
.Raw
= (UINT8
*) HobStart
;
148 if(CompareGuid (&Hob
.MemoryAllocation
->AllocDescriptor
.Name
, &gEfiHobMemoryAllocStackGuid
)) {
149 ASSERT (HobLength
>= sizeof (*Hob
.MemoryAllocationStack
));
150 DEBUG ((DEBUG_INFO
, " Type = EFI_HOB_MEMORY_ALLOCATION_STACK\n"));
151 } else if (CompareGuid (&Hob
.MemoryAllocation
->AllocDescriptor
.Name
, &gEfiHobMemoryAllocBspStoreGuid
)) {
152 ASSERT (HobLength
>= sizeof (*Hob
.MemoryAllocationBspStore
));
153 DEBUG ((DEBUG_INFO
, " Type = EFI_HOB_MEMORY_ALLOCATION_BSP_STORE\n"));
154 } else if (CompareGuid (&Hob
.MemoryAllocation
->AllocDescriptor
.Name
, &gEfiHobMemoryAllocModuleGuid
)) {
155 ASSERT (HobLength
>= sizeof (*Hob
.MemoryAllocationModule
));
156 DEBUG ((DEBUG_INFO
, " Type = EFI_HOB_MEMORY_ALLOCATION_MODULE\n"));
157 DEBUG ((DEBUG_INFO
, " Module Name = %g\n", Hob
.MemoryAllocationModule
->ModuleName
));
158 DEBUG ((DEBUG_INFO
, " Physical Address = 0x%lx\n", Hob
.MemoryAllocationModule
->EntryPoint
));
160 ASSERT (HobLength
>= sizeof (*Hob
.MemoryAllocation
));
161 DEBUG ((DEBUG_INFO
, " Type = EFI_HOB_TYPE_MEMORY_ALLOCATION\n"));
163 DEBUG ((DEBUG_INFO
, " MemoryBaseAddress = 0x%lx\n", Hob
.MemoryAllocationStack
->AllocDescriptor
.MemoryBaseAddress
));
164 DEBUG ((DEBUG_INFO
, " MemoryLength = 0x%lx\n", Hob
.MemoryAllocationStack
->AllocDescriptor
.MemoryLength
));
165 DEBUG ((DEBUG_INFO
, " MemoryType = %a \n", mMemoryTypeStr
[Hob
.MemoryAllocationStack
->AllocDescriptor
.MemoryType
]));
170 Print the information in Resource Discriptor Hob.
171 @param[in] HobStart A pointer to HOB of type EFI_HOB_TYPE_RESOURCE_DESCRIPTOR.
172 @param[in] HobLength The Length in bytes of HOB of type EFI_HOB_TYPE_RESOURCE_DESCRIPTOR.
173 @retval EFI_SUCCESS If it completed successfully.
176 PrintResourceDiscriptorHob (
181 EFI_PEI_HOB_POINTERS Hob
;
183 Hob
.Raw
= (UINT8
*) HobStart
;
184 ASSERT (HobLength
>= sizeof (*Hob
.ResourceDescriptor
));
186 DEBUG ((DEBUG_INFO
, " ResourceType = %a\n", mResource_Type_List
[Hob
.ResourceDescriptor
->ResourceType
]));
187 if(!IsZeroGuid (&Hob
.ResourceDescriptor
->Owner
)) {
188 DEBUG ((DEBUG_INFO
, " Owner = %g\n", Hob
.ResourceDescriptor
->Owner
));
190 DEBUG ((DEBUG_INFO
, " ResourceAttribute = 0x%x\n", Hob
.ResourceDescriptor
->ResourceAttribute
));
191 DEBUG ((DEBUG_INFO
, " PhysicalStart = 0x%lx\n", Hob
.ResourceDescriptor
->PhysicalStart
));
192 DEBUG ((DEBUG_INFO
, " ResourceLength = 0x%lx\n", Hob
.ResourceDescriptor
->ResourceLength
));
197 Print the information in Acpi Guid Hob.
198 @param[in] HobRaw A pointer to the start of gUniversalPayloadAcpiTableGuid HOB.
199 @retval EFI_SUCCESS If it completed successfully.
207 UNIVERSAL_PAYLOAD_ACPI_TABLE
*AcpiTableHob
;
208 AcpiTableHob
= (UNIVERSAL_PAYLOAD_ACPI_TABLE
*) GET_GUID_HOB_DATA (HobRaw
);
209 ASSERT (HobLength
>= AcpiTableHob
->Header
.Length
);
210 DEBUG ((DEBUG_INFO
, " Revision = 0x%x\n", AcpiTableHob
->Header
.Revision
));
211 DEBUG ((DEBUG_INFO
, " Length = 0x%x\n", AcpiTableHob
->Header
.Length
));
212 DEBUG ((DEBUG_INFO
, " Rsdp = 0x%p\n", (UINT64
) AcpiTableHob
->Rsdp
));
217 Print the information in Serial Guid Hob.
218 @param[in] HobRaw A pointer to the start of gUniversalPayloadSerialPortInfoGuid HOB.
219 @retval EFI_SUCCESS If it completed successfully.
227 UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO
*SerialPortInfo
;
228 SerialPortInfo
= (UNIVERSAL_PAYLOAD_SERIAL_PORT_INFO
*) GET_GUID_HOB_DATA (HobRaw
);
229 ASSERT (HobLength
>= SerialPortInfo
->Header
.Length
);
230 DEBUG ((DEBUG_INFO
, " Revision = 0x%x\n", SerialPortInfo
->Header
.Revision
));
231 DEBUG ((DEBUG_INFO
, " Length = 0x%x\n", SerialPortInfo
->Header
.Length
));
232 DEBUG ((DEBUG_INFO
, " UseMmio = 0x%x\n", SerialPortInfo
->UseMmio
));
233 DEBUG ((DEBUG_INFO
, " RegisterStride = 0x%x\n", SerialPortInfo
->RegisterStride
));
234 DEBUG ((DEBUG_INFO
, " BaudRate = %d\n", SerialPortInfo
->BaudRate
));
235 DEBUG ((DEBUG_INFO
, " RegisterBase = 0x%lx\n", SerialPortInfo
->RegisterBase
));
240 Print the information in Smbios Guid Hob.
241 @param[in] HobRaw A pointer to the start of gUniversalPayloadSmbios3TableGuid HOB.
242 @retval EFI_SUCCESS If it completed successfully.
245 PrintSmbios3GuidHob (
250 UNIVERSAL_PAYLOAD_SMBIOS_TABLE
*SmBiosTable
;
251 SmBiosTable
= (UNIVERSAL_PAYLOAD_SMBIOS_TABLE
*) GET_GUID_HOB_DATA (HobRaw
);
252 ASSERT (HobLength
>= SmBiosTable
->Header
.Length
);
253 DEBUG ((DEBUG_INFO
, " Revision = 0x%x\n", SmBiosTable
->Header
.Revision
));
254 DEBUG ((DEBUG_INFO
, " Length = 0x%x\n", SmBiosTable
->Header
.Length
));
255 DEBUG ((DEBUG_INFO
, " SmBiosEntryPoint = 0x%lx\n", (UINT64
) SmBiosTable
->SmBiosEntryPoint
));
260 Print the information in Smbios Guid Hob.
261 @param[in] HobRaw A pointer to the start of gUniversalPayloadSmbiosTableGuid HOB.
262 @retval EFI_SUCCESS If it completed successfully.
265 PrintSmbiosTablGuidHob (
270 UNIVERSAL_PAYLOAD_SMBIOS_TABLE
*SmBiosTable
;
271 SmBiosTable
= (UNIVERSAL_PAYLOAD_SMBIOS_TABLE
*) GET_GUID_HOB_DATA (HobRaw
);
272 ASSERT (HobLength
>= SmBiosTable
->Header
.Length
);
273 DEBUG ((DEBUG_INFO
, " Revision = 0x%x\n", SmBiosTable
->Header
.Revision
));
274 DEBUG ((DEBUG_INFO
, " Length = 0x%x\n", SmBiosTable
->Header
.Length
));
275 DEBUG ((DEBUG_INFO
, " SmBiosEntryPoint = 0x%lx\n", (UINT64
) SmBiosTable
->SmBiosEntryPoint
));
280 Print the information in Acpi BoardInfo Guid Hob.
281 @param[in] HobRaw A pointer to the start of gUefiAcpiBoardInfoGuid HOB.
282 @retval EFI_SUCCESS If it completed successfully.
285 PrintAcpiBoardInfoGuidHob (
290 ACPI_BOARD_INFO
*AcpBoardInfo
;
291 AcpBoardInfo
= (ACPI_BOARD_INFO
*) GET_GUID_HOB_DATA (HobRaw
);
292 ASSERT (HobLength
>= sizeof (*AcpBoardInfo
));
293 DEBUG ((DEBUG_INFO
, " Revision = 0x%x\n", AcpBoardInfo
->Revision
));
294 DEBUG ((DEBUG_INFO
, " Reserved0 = 0x%x\n", AcpBoardInfo
->Reserved0
));
295 DEBUG ((DEBUG_INFO
, " ResetValue = 0x%x\n", AcpBoardInfo
->ResetValue
));
296 DEBUG ((DEBUG_INFO
, " PmEvtBase = 0x%lx\n", AcpBoardInfo
->PmEvtBase
));
297 DEBUG ((DEBUG_INFO
, " PmGpeEnBase = 0x%lx\n", AcpBoardInfo
->PmGpeEnBase
));
298 DEBUG ((DEBUG_INFO
, " PmCtrlRegBase = 0x%lx\n", AcpBoardInfo
->PmCtrlRegBase
));
299 DEBUG ((DEBUG_INFO
, " PmTimerRegBase = 0x%lx\n", AcpBoardInfo
->PmTimerRegBase
));
300 DEBUG ((DEBUG_INFO
, " ResetRegAddress = 0x%lx\n", AcpBoardInfo
->ResetRegAddress
));
301 DEBUG ((DEBUG_INFO
, " PcieBaseAddress = 0x%lx\n", AcpBoardInfo
->PcieBaseAddress
));
302 DEBUG ((DEBUG_INFO
, " PcieBaseSize = 0x%lx\n", AcpBoardInfo
->PcieBaseSize
));
307 Print the information in Pci RootBridge Info Guid Hob.
308 @param[in] HobRaw A pointer to the start of gUniversalPayloadPciRootBridgeInfoGuid HOB.
310 @retval EFI_SUCCESS If it completed successfully.
313 PrintPciRootBridgeInfoGuidHob (
318 UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES
*PciRootBridges
;
321 PciRootBridges
= (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES
*) GET_GUID_HOB_DATA (HobRaw
);
322 ASSERT (HobLength
>= sizeof (UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES
));
323 DEBUG ((DEBUG_INFO
, " Revision = 0x%x\n", PciRootBridges
->Header
.Revision
));
324 DEBUG ((DEBUG_INFO
, " Length = 0x%x\n", PciRootBridges
->Header
.Length
));
325 DEBUG ((DEBUG_INFO
, " Count = 0x%x\n", PciRootBridges
->Count
));
326 DEBUG ((DEBUG_INFO
, " ResourceAssigned = %a\n", (PciRootBridges
->ResourceAssigned
? "True" : "False")));
328 while(Index
< PciRootBridges
->Count
) {
329 DEBUG ((DEBUG_INFO
, " Root Bridge Index[%d]:\n", Index
));
330 DEBUG ((DEBUG_INFO
, " Segment = 0x%x\n", PciRootBridges
->RootBridge
[Index
].Segment
));
331 DEBUG ((DEBUG_INFO
, " Supports = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Supports
));
332 DEBUG ((DEBUG_INFO
, " Attributes = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Attributes
));
333 DEBUG ((DEBUG_INFO
, " DmaAbove4G = 0x%x\n", PciRootBridges
->RootBridge
[Index
].DmaAbove4G
));
334 DEBUG ((DEBUG_INFO
, " NoExtendedConfigSpace = 0x%x\n", PciRootBridges
->RootBridge
[Index
].NoExtendedConfigSpace
));
335 DEBUG ((DEBUG_INFO
, " AllocationAttributes = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].AllocationAttributes
));
336 DEBUG ((DEBUG_INFO
, " Bus.Base = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Bus
.Base
));
337 DEBUG ((DEBUG_INFO
, " Bus.Limit = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Bus
.Limit
));
338 DEBUG ((DEBUG_INFO
, " Bus.Translation = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Bus
.Translation
));
339 DEBUG ((DEBUG_INFO
, " Io.Base = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Io
.Base
));
340 DEBUG ((DEBUG_INFO
, " Io.Limit = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Io
.Limit
));
341 DEBUG ((DEBUG_INFO
, " Io.Translation = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Io
.Translation
));
342 DEBUG ((DEBUG_INFO
, " Mem.Base = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Mem
.Base
));
343 DEBUG ((DEBUG_INFO
, " Mem.Limit = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Mem
.Limit
));
344 DEBUG ((DEBUG_INFO
, " Mem.Translation = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].Mem
.Translation
));
345 DEBUG ((DEBUG_INFO
, " MemAbove4G.Base = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].MemAbove4G
.Base
));
346 DEBUG ((DEBUG_INFO
, " MemAbove4G.Limit = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].MemAbove4G
.Limit
));
347 DEBUG ((DEBUG_INFO
, " MemAbove4G.Translation = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].MemAbove4G
.Translation
));
348 DEBUG ((DEBUG_INFO
, " PMem.Base = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].PMem
.Base
));
349 DEBUG ((DEBUG_INFO
, " PMem.Limit = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].PMem
.Limit
));
350 DEBUG ((DEBUG_INFO
, " PMem.Translation = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].PMem
.Translation
));
351 DEBUG ((DEBUG_INFO
, " PMemAbove4G.Base = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].PMemAbove4G
.Base
));
352 DEBUG ((DEBUG_INFO
, " PMemAbove4G.Limit = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].PMemAbove4G
.Limit
));
353 DEBUG ((DEBUG_INFO
, " PMemAbove4G.Translation = 0x%lx\n", PciRootBridges
->RootBridge
[Index
].PMemAbove4G
.Translation
));
360 Print the information in Extra Data Guid Hob.
361 @param[in] HobRaw A pointer to the start of gUniversalPayloadExtraDataGuid HOB.
362 @retval EFI_SUCCESS If it completed successfully.
365 PrintExtraDataGuidHob (
370 UNIVERSAL_PAYLOAD_EXTRA_DATA
*ExtraData
;
374 ExtraData
= (UNIVERSAL_PAYLOAD_EXTRA_DATA
*) GET_GUID_HOB_DATA (HobRaw
);
375 ASSERT (HobLength
>= ExtraData
->Header
.Length
);
376 DEBUG ((DEBUG_INFO
, " Revision = 0x%x\n", ExtraData
->Header
.Revision
));
377 DEBUG ((DEBUG_INFO
, " Length = 0x%x\n", ExtraData
->Header
.Length
));
378 DEBUG ((DEBUG_INFO
, " Count = 0x%x\n", ExtraData
->Count
));
380 while (Index
< ExtraData
->Count
) {
381 DEBUG ((DEBUG_INFO
, " Id[%d] = %a\n", Index
,ExtraData
->Entry
[Index
].Identifier
));
382 DEBUG ((DEBUG_INFO
, " Base[%d] = 0x%lx\n", Index
,ExtraData
->Entry
[Index
].Base
));
383 DEBUG ((DEBUG_INFO
, " Size[%d] = 0x%lx\n", Index
,ExtraData
->Entry
[Index
].Size
));
390 Print the information in MemoryTypeInfoGuidHob.
391 @param[in] HobRaw A pointer to the start of gEfiMemoryTypeInformationGuid HOB.
392 @retval EFI_SUCCESS If it completed successfully.
395 PrintMemoryTypeInfoGuidHob (
400 EFI_MEMORY_TYPE_INFORMATION
*MemoryTypeInfo
;
402 MemoryTypeInfo
= (EFI_MEMORY_TYPE_INFORMATION
*) GET_GUID_HOB_DATA (HobRaw
);
403 ASSERT (HobLength
>= sizeof (*MemoryTypeInfo
));
404 DEBUG ((DEBUG_INFO
, " Type = 0x%x\n", MemoryTypeInfo
->Type
));
405 DEBUG ((DEBUG_INFO
, " NumberOfPages = 0x%x\n", MemoryTypeInfo
->NumberOfPages
));
410 // Mappint table for dump Guid Hob information.
411 // This table can be easily extented.
413 GUID_HOB_PRINT_HANDLE GuidHobPrintHandleTable
[] = {
414 {&gUniversalPayloadAcpiTableGuid
, PrintAcpiGuidHob
, "gUniversalPayloadAcpiTableGuid(ACPI table Guid)"},
415 {&gUniversalPayloadSerialPortInfoGuid
, PrintSerialGuidHob
, "gUniversalPayloadSerialPortInfoGuid(Serial Port Info)"},
416 {&gUniversalPayloadSmbios3TableGuid
, PrintSmbios3GuidHob
, "gUniversalPayloadSmbios3TableGuid(SmBios Guid)"},
417 {&gUniversalPayloadSmbiosTableGuid
, PrintSmbiosTablGuidHob
, "gUniversalPayloadSmbiosTableGuid(SmBios Guid)"},
418 {&gUefiAcpiBoardInfoGuid
, PrintAcpiBoardInfoGuidHob
, "gUefiAcpiBoardInfoGuid(Acpi Guid)"},
419 {&gUniversalPayloadPciRootBridgeInfoGuid
, PrintPciRootBridgeInfoGuidHob
, "gUniversalPayloadPciRootBridgeInfoGuid(Pci Guid)"},
420 {&gEfiMemoryTypeInformationGuid
, PrintMemoryTypeInfoGuidHob
, "gEfiMemoryTypeInformationGuid(Memory Type Information Guid)"},
421 {&gUniversalPayloadExtraDataGuid
, PrintExtraDataGuidHob
, "gUniversalPayloadExtraDataGuid(PayLoad Extra Data Guid)"}
425 Print the Guid Hob using related print handle function.
426 @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_GUID_EXTENSION.
427 @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_GUID_EXTENSION.
428 @retval EFI_SUCCESS If it completed successfully.
436 EFI_PEI_HOB_POINTERS Hob
;
440 Hob
.Raw
= (UINT8
*) HobStart
;
441 ASSERT (HobLength
>= sizeof (Hob
.Guid
));
443 for (Index
= 0; Index
< ARRAY_SIZE (GuidHobPrintHandleTable
); Index
++) {
444 if (CompareGuid (&Hob
.Guid
->Name
, GuidHobPrintHandleTable
[Index
].Guid
)) {
445 DEBUG ((DEBUG_INFO
, " Guid = %a\n", GuidHobPrintHandleTable
[Index
].GuidName
));
446 Status
= GuidHobPrintHandleTable
[Index
].PrintHandler (Hob
.Raw
, Hob
.Header
->HobLength
);
450 DEBUG ((DEBUG_INFO
, " Name = %g\n", &Hob
.Guid
->Name
));
451 PrintHex (GET_GUID_HOB_DATA (Hob
.Raw
), GET_GUID_HOB_DATA_SIZE (Hob
.Raw
));
456 Print the information in FV Hob.
457 @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_FV.
458 @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_FV.
459 @retval EFI_SUCCESS If it completed successfully.
467 EFI_PEI_HOB_POINTERS Hob
;
469 Hob
.Raw
= (UINT8
*) HobStart
;
470 ASSERT (HobLength
>= sizeof (*Hob
.FirmwareVolume
));
472 DEBUG ((DEBUG_INFO
, " BaseAddress = 0x%lx\n", Hob
.FirmwareVolume
->BaseAddress
));
473 DEBUG ((DEBUG_INFO
, " Length = 0x%lx\n", Hob
.FirmwareVolume
->Length
));
478 Print the information in Cpu Hob.
479 @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_CPU.
480 @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_CPU.
481 @retval EFI_SUCCESS If it completed successfully.
489 EFI_PEI_HOB_POINTERS Hob
;
491 Hob
.Raw
= (UINT8
*) HobStart
;
492 ASSERT (HobLength
>= sizeof (*Hob
.Cpu
));
494 DEBUG ((DEBUG_INFO
, " SizeOfMemorySpace = 0x%lx\n", Hob
.Cpu
->SizeOfMemorySpace
));
495 DEBUG ((DEBUG_INFO
, " SizeOfIoSpace = 0x%lx\n", Hob
.Cpu
->SizeOfIoSpace
));
500 Print the information in MemoryPoolHob.
501 @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_MEMORY_POOL.
502 @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_MEMORY_POOL.
503 @retval EFI_SUCCESS If it completed successfully.
515 Print the information in Fv2Hob.
516 @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_FV2.
517 @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_FV2.
518 @retval EFI_SUCCESS If it completed successfully.
526 EFI_PEI_HOB_POINTERS Hob
;
528 Hob
.Raw
= (UINT8
*) HobStart
;
529 ASSERT (HobLength
>= sizeof (*Hob
.FirmwareVolume2
));
531 DEBUG ((DEBUG_INFO
, " BaseAddress = 0x%lx\n", Hob
.FirmwareVolume2
->BaseAddress
));
532 DEBUG ((DEBUG_INFO
, " Length = 0x%lx\n", Hob
.FirmwareVolume2
->Length
));
533 DEBUG ((DEBUG_INFO
, " FvName = %g\n", &Hob
.FirmwareVolume2
->FvName
));
534 DEBUG ((DEBUG_INFO
, " FileName = %g\n", &Hob
.FirmwareVolume2
->FileName
));
539 Print the information in Capsule Hob.
540 @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_UEFI_CAPSULE.
541 @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_UEFI_CAPSULE.
542 @retval EFI_SUCCESS If it completed successfully.
550 EFI_PEI_HOB_POINTERS Hob
;
552 Hob
.Raw
= (UINT8
*) HobStart
;
553 ASSERT (HobLength
>= sizeof (*Hob
.Capsule
));
555 DEBUG ((DEBUG_INFO
, " BaseAddress = 0x%lx\n", Hob
.Capsule
->BaseAddress
));
556 DEBUG ((DEBUG_INFO
, " Length = 0x%lx\n", Hob
.Capsule
->Length
));
561 Print the information in Fv3 Hob.
562 @param[in] HobStart A pointer to the HOB of type EFI_HOB_TYPE_FV3.
563 @param[in] HobLength The length in bytes of the HOB of type EFI_HOB_TYPE_FV3.
564 @retval EFI_SUCCESS If it completed successfully.
572 EFI_PEI_HOB_POINTERS Hob
;
573 Hob
.Raw
= (UINT8
*) HobStart
;
574 ASSERT (HobLength
>= sizeof (*Hob
.FirmwareVolume3
));
576 DEBUG ((DEBUG_INFO
, " BaseAddress = 0x%lx\n", Hob
.FirmwareVolume3
->BaseAddress
));
577 DEBUG ((DEBUG_INFO
, " Length = 0x%lx\n", Hob
.FirmwareVolume3
->Length
));
578 DEBUG ((DEBUG_INFO
, " AuthenticationStatus = 0x%x\n", Hob
.FirmwareVolume3
->AuthenticationStatus
));
579 DEBUG ((DEBUG_INFO
, " ExtractedFv = %a\n", (Hob
.FirmwareVolume3
->ExtractedFv
? "True" : "False")));
580 DEBUG ((DEBUG_INFO
, " FVName = %g\n", &Hob
.FirmwareVolume3
->FvName
));
581 DEBUG ((DEBUG_INFO
, " FileName = %g\n", &Hob
.FirmwareVolume3
->FileName
));
586 // Mappint table from Hob type to Hob print function.
588 HOB_PRINT_HANDLER_TABLE mHobHandles
[] = {
589 {EFI_HOB_TYPE_HANDOFF
, "EFI_HOB_TYPE_HANDOFF", PrintHandOffHob
},
590 {EFI_HOB_TYPE_MEMORY_ALLOCATION
, "EFI_HOB_TYPE_MEMORY_ALLOCATION", PrintMemoryAllocationHob
},
591 {EFI_HOB_TYPE_RESOURCE_DESCRIPTOR
, "EFI_HOB_TYPE_RESOURCE_DESCRIPTOR", PrintResourceDiscriptorHob
},
592 {EFI_HOB_TYPE_GUID_EXTENSION
, "EFI_HOB_TYPE_GUID_EXTENSION", PrintGuidHob
},
593 {EFI_HOB_TYPE_FV
, "EFI_HOB_TYPE_FV", PrintFvHob
},
594 {EFI_HOB_TYPE_CPU
, "EFI_HOB_TYPE_CPU", PrintCpuHob
},
595 {EFI_HOB_TYPE_MEMORY_POOL
, "EFI_HOB_TYPE_MEMORY_POOL", PrintMemoryPoolHob
},
596 {EFI_HOB_TYPE_FV2
, "EFI_HOB_TYPE_FV2", PrintFv2Hob
},
597 {EFI_HOB_TYPE_UEFI_CAPSULE
, "EFI_HOB_TYPE_UEFI_CAPSULE", PrintCapsuleHob
},
598 {EFI_HOB_TYPE_FV3
, "EFI_HOB_TYPE_FV3", PrintFv3Hob
}
603 Print all HOBs info from the HOB list.
604 @param[in] HobStart A pointer to the HOB list
605 @return The pointer to the HOB list.
609 IN CONST VOID
*HobStart
612 EFI_PEI_HOB_POINTERS Hob
;
615 ASSERT (HobStart
!= NULL
);
617 Hob
.Raw
= (UINT8
*) HobStart
;
618 DEBUG ((DEBUG_INFO
, "Print all Hob information from Hob 0x%p\n", Hob
.Raw
));
622 // Parse the HOB list to see which type it is, and print the information.
624 while (!END_OF_HOB_LIST (Hob
)) {
625 for (Index
= 0; Index
< ARRAY_SIZE (mHobHandles
); Index
++) {
626 if (Hob
.Header
->HobType
== mHobHandles
[Index
].Type
) {
627 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
));
628 mHobHandles
[Index
].PrintHandler (Hob
.Raw
, Hob
.Header
->HobLength
);
632 if (Index
== ARRAY_SIZE (mHobHandles
)) {
633 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
));
634 DEBUG ((DEBUG_INFO
, " Unkown Hob type\n"));
635 PrintHex (Hob
.Raw
, Hob
.Header
->HobLength
);
638 Hob
.Raw
= GET_NEXT_HOB (Hob
);
640 DEBUG ((DEBUG_INFO
, "There are totally %d Hobs, the End Hob address is %p\n", Count
, Hob
.Raw
));