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