2 Hob command for EBL (Embedded Boot Loader)
4 Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
5 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
6 (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Search/Replace Dir with the name of your new command
22 BOOT_WITH_FULL_CONFIGURATION 0x00
23 BOOT_WITH_MINIMAL_CONFIGURATION 0x01
24 BOOT_ASSUMING_NO_CONFIGURATION_CHANGES 0x02
25 BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS 0x03
26 BOOT_WITH_DEFAULT_SETTINGS 0x04
27 BOOT_ON_S4_RESUME 0x05
28 BOOT_ON_S5_RESUME 0x06
29 BOOT_ON_S2_RESUME 0x10
30 BOOT_ON_S3_RESUME 0x11
31 BOOT_ON_FLASH_UPDATE 0x12
32 BOOT_IN_RECOVERY_MODE 0x20
33 BOOT_IN_RECOVERY_MODE_MASK 0x40
34 BOOT_SPECIAL_MASK 0x80
39 EfiReservedMemoryType = 0x00
42 EfiBootServicesCode = 0x03
43 EfiBootServicesData = 0x04
44 EfiRuntimeServicesCode = 0x05
45 EfiRuntimeServicesData = 0x06
46 EfiConventionalMemory = 0x07
47 EfiUnusableMemory = 0x08
48 EfiACPIReclaimMemory = 0x09
49 EfiACPIMemoryNVS = 0x0a
50 EfiMemoryMappedIO = 0x0b
51 EfiMemoryMappedIOPortSpace = 0x0c
53 EfiMaxMemoryType = 0x0e
58 EFI_RESOURCE_SYSTEM_MEMORY 0
59 EFI_RESOURCE_MEMORY_MAPPED_IO 1
61 EFI_RESOURCE_FIRMWARE_DEVICE 3
62 EFI_RESOURCE_MEMORY_MAPPED_IO_PORT 4
63 EFI_RESOURCE_MEMORY_RESERVED 5
64 EFI_RESOURCE_IO_RESERVED 6
65 EFI_RESOURCE_MAX_MEMORY_TYPE 7
67 Resource Hob Attribute (last thing printed):
68 ============================================
69 EFI_RESOURCE_ATTRIBUTE_PRESENT 0x00000001
70 EFI_RESOURCE_ATTRIBUTE_INITIALIZED 0x00000002
71 EFI_RESOURCE_ATTRIBUTE_TESTED 0x00000004
72 EFI_RESOURCE_ATTRIBUTE_SINGLE_BIT_ECC 0x00000008
73 EFI_RESOURCE_ATTRIBUTE_MULTIPLE_BIT_ECC 0x00000010
74 EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_1 0x00000020
75 EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_2 0x00000040
76 EFI_RESOURCE_ATTRIBUTE_READ_PROTECTED 0x00000080
77 EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED 0x00000100
78 EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED 0x00000200
79 EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE 0x00000400
80 EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE 0x00000800
81 EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE 0x00001000
82 EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE 0x00002000
83 EFI_RESOURCE_ATTRIBUTE_16_BIT_IO 0x00004000
84 EFI_RESOURCE_ATTRIBUTE_32_BIT_IO 0x00008000
85 EFI_RESOURCE_ATTRIBUTE_64_BIT_IO 0x00010000
86 EFI_RESOURCE_ATTRIBUTE_UNCACHED_EXPORTED 0x00020000
91 // BugBug: Autogen does not allow this to be included currently
92 //#include <EdkModulePkg/Include/EdkDxe.h>
94 GLOBAL_REMOVE_IF_UNREFERENCED
char *mHobResourceType
[] = {
107 Dump out the HOBs in the system. HOBs are defined in the PI specification
108 and they are used to hand off information from PEI to DXE.
112 @param Argc Number of command arguments in Argv
113 @param Argv Array of strings that represent the parsed command line.
114 Argv[0] is the command name
127 EFI_PEI_HOB_POINTERS Hob
;
128 EFI_MEMORY_TYPE_INFORMATION
*EfiMemoryTypeInformation
;
132 for (Hob
.Raw
= GetHobList (); !END_OF_HOB_LIST(Hob
); Hob
.Raw
= GET_NEXT_HOB(Hob
)) {
133 if (Hob
.Header
->HobType
== EFI_HOB_TYPE_HANDOFF
) {
134 AsciiPrint ("PHIT HOB Ver %x Boot Mode %02x Top %lx Bottom %lx\n",
135 Hob
.HandoffInformationTable
->Version
,
136 Hob
.HandoffInformationTable
->BootMode
,
137 Hob
.HandoffInformationTable
->EfiMemoryTop
,
138 Hob
.HandoffInformationTable
->EfiMemoryBottom
141 if (EblAnyKeyToContinueQtoQuit (&CurrentRow
, FALSE
)) {
145 AsciiPrint (" Free Top %lx Free Bottom %lx End Of HOB %lx\n",
146 Hob
.HandoffInformationTable
->EfiFreeMemoryTop
,
147 Hob
.HandoffInformationTable
->EfiFreeMemoryBottom
,
148 Hob
.HandoffInformationTable
->EfiEndOfHobList
151 } else if (Hob
.Header
->HobType
== EFI_HOB_TYPE_MEMORY_ALLOCATION
) {
152 // mod(%) on array index is just to prevent buffer overrun
153 AsciiPrint ("Mem Alloc HOB %a %g %08lx:%lx\n",
154 (Hob
.MemoryAllocation
->AllocDescriptor
.MemoryType
< EfiMaxMemoryType
) ? gMemMapType
[Hob
.MemoryAllocation
->AllocDescriptor
.MemoryType
] : "ILLEGAL TYPE",
155 &Hob
.MemoryAllocation
->AllocDescriptor
.Name
,
156 Hob
.MemoryAllocation
->AllocDescriptor
.MemoryBaseAddress
,
157 Hob
.MemoryAllocation
->AllocDescriptor
.MemoryLength
159 if (CompareGuid (&gEfiHobMemoryAllocModuleGuid
, &Hob
.MemoryAllocation
->AllocDescriptor
.Name
)) {
160 if (EblAnyKeyToContinueQtoQuit (&CurrentRow
, FALSE
)) {
163 AsciiPrint (" Module Name %g EntryPoint %lx\n", &Hob
.MemoryAllocationModule
->ModuleName
, Hob
.MemoryAllocationModule
->EntryPoint
);
165 } else if (Hob
.Header
->HobType
== EFI_HOB_TYPE_RESOURCE_DESCRIPTOR
) {
166 AsciiPrint ("Resource HOB %a %g %08lx:%lx\n Attributes: %08x\n",
167 (Hob
.ResourceDescriptor
->ResourceType
< EFI_RESOURCE_MAX_MEMORY_TYPE
) ? mHobResourceType
[Hob
.ResourceDescriptor
->ResourceType
] : mHobResourceType
[EFI_RESOURCE_MAX_MEMORY_TYPE
],
168 &Hob
.ResourceDescriptor
->Owner
,
169 Hob
.ResourceDescriptor
->PhysicalStart
,
170 Hob
.ResourceDescriptor
->ResourceLength
,
171 Hob
.ResourceDescriptor
->ResourceAttribute
173 if (EblAnyKeyToContinueQtoQuit (&CurrentRow
, FALSE
)) {
176 } else if (Hob
.Header
->HobType
== EFI_HOB_TYPE_GUID_EXTENSION
) {
177 AsciiPrint ("GUID HOB %g\n", &Hob
.Guid
->Name
);
178 if (CompareGuid (&gEfiMemoryTypeInformationGuid
, &Hob
.Guid
->Name
)) {
179 EfiMemoryTypeInformation
= GET_GUID_HOB_DATA (Hob
.Guid
);
180 for (Index
= 0; Index
< (GET_GUID_HOB_DATA_SIZE (Hob
.Guid
)/sizeof (EFI_MEMORY_TYPE_INFORMATION
)); Index
++, EfiMemoryTypeInformation
++) {
181 if (EblAnyKeyToContinueQtoQuit (&CurrentRow
, FALSE
)) {
184 AsciiPrint (" %a 0x%08x\n",
185 (EfiMemoryTypeInformation
->Type
< EfiMaxMemoryType
) ? gMemMapType
[EfiMemoryTypeInformation
->Type
] : "END ",
186 EfiMemoryTypeInformation
->NumberOfPages
190 } else if (Hob
.Header
->HobType
== EFI_HOB_TYPE_FV
) {
191 AsciiPrint ("FV HOB %08lx:%08lx\n", Hob
.FirmwareVolume
->BaseAddress
, Hob
.FirmwareVolume
->Length
);
192 } else if (Hob
.Header
->HobType
== EFI_HOB_TYPE_CPU
) {
193 AsciiPrint ("CPU HOB: Mem %x IO %x\n", Hob
.Cpu
->SizeOfMemorySpace
, Hob
.Cpu
->SizeOfIoSpace
);
194 } else if (Hob
.Header
->HobType
== EFI_HOB_TYPE_MEMORY_POOL
) {
195 AsciiPrint ("Mem Pool HOB:\n");
197 } else if (Hob.Header->HobType == EFI_HOB_TYPE_CV) {
198 AsciiPrint ("CV HOB: %08lx:%08lx\n", Hob.CapsuleVolume->BaseAddress, Hob.CapsuleVolume->Length);
202 if (EblAnyKeyToContinueQtoQuit (&CurrentRow
, FALSE
)) {
211 GLOBAL_REMOVE_IF_UNREFERENCED
const EBL_COMMAND_TABLE mCmdHobTemplate
[] =
223 Initialize the commands in this in this file
226 EblInitializeHobCmd (
230 if (FeaturePcdGet (PcdEmbeddedHobCmd
)) {
231 EblAddCommands (mCmdHobTemplate
, sizeof (mCmdHobTemplate
)/sizeof (EBL_COMMAND_TABLE
));