]>
Commit | Line | Data |
---|---|---|
2ef2b01e A |
1 | /** @file\r |
2 | Hob command for EBL (Embedded Boot Loader)\r | |
3 | \r | |
60274cca HT |
4 | Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r |
5 | Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r | |
50c6a4d2 | 6 | (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>\r |
2ef2b01e | 7 | \r |
60274cca | 8 | This program and the accompanying materials\r |
2ef2b01e A |
9 | are licensed and made available under the terms and conditions of the BSD License\r |
10 | which accompanies this distribution. The full text of the license may be found at\r | |
11 | http://opensource.org/licenses/bsd-license.php\r | |
12 | \r | |
13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
14 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
15 | \r | |
16 | Module Name: Hob.c\r | |
17 | \r | |
18 | Search/Replace Dir with the name of your new command\r | |
19 | \r | |
20 | Boot Mode:\r | |
21 | ==========\r | |
22 | BOOT_WITH_FULL_CONFIGURATION 0x00\r | |
23 | BOOT_WITH_MINIMAL_CONFIGURATION 0x01\r | |
24 | BOOT_ASSUMING_NO_CONFIGURATION_CHANGES 0x02\r | |
25 | BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS 0x03\r | |
26 | BOOT_WITH_DEFAULT_SETTINGS 0x04\r | |
27 | BOOT_ON_S4_RESUME 0x05\r | |
28 | BOOT_ON_S5_RESUME 0x06\r | |
29 | BOOT_ON_S2_RESUME 0x10\r | |
30 | BOOT_ON_S3_RESUME 0x11\r | |
31 | BOOT_ON_FLASH_UPDATE 0x12\r | |
32 | BOOT_IN_RECOVERY_MODE 0x20\r | |
33 | BOOT_IN_RECOVERY_MODE_MASK 0x40\r | |
34 | BOOT_SPECIAL_MASK 0x80\r | |
35 | \r | |
36 | Mem Alloc HOB Type:\r | |
37 | ===================\r | |
38 | typedef enum {\r | |
39 | EfiReservedMemoryType = 0x00\r | |
40 | EfiLoaderCode = 0x01\r | |
41 | EfiLoaderData = 0x02\r | |
42 | EfiBootServicesCode = 0x03\r | |
43 | EfiBootServicesData = 0x04\r | |
44 | EfiRuntimeServicesCode = 0x05\r | |
45 | EfiRuntimeServicesData = 0x06\r | |
46 | EfiConventionalMemory = 0x07\r | |
47 | EfiUnusableMemory = 0x08\r | |
48 | EfiACPIReclaimMemory = 0x09\r | |
49 | EfiACPIMemoryNVS = 0x0a\r | |
50 | EfiMemoryMappedIO = 0x0b\r | |
51 | EfiMemoryMappedIOPortSpace = 0x0c\r | |
52 | EfiPalCode = 0x0d\r | |
53 | EfiMaxMemoryType = 0x0e\r | |
54 | } EFI_MEMORY_TYPE;\r | |
55 | \r | |
56 | Resource Hob Tye:\r | |
57 | =================\r | |
58 | EFI_RESOURCE_SYSTEM_MEMORY 0\r | |
59 | EFI_RESOURCE_MEMORY_MAPPED_IO 1\r | |
60 | EFI_RESOURCE_IO 2\r | |
61 | EFI_RESOURCE_FIRMWARE_DEVICE 3\r | |
62 | EFI_RESOURCE_MEMORY_MAPPED_IO_PORT 4\r | |
63 | EFI_RESOURCE_MEMORY_RESERVED 5\r | |
64 | EFI_RESOURCE_IO_RESERVED 6\r | |
65 | EFI_RESOURCE_MAX_MEMORY_TYPE 7\r | |
66 | \r | |
67 | Resource Hob Attribute (last thing printed):\r | |
68 | ============================================\r | |
69 | EFI_RESOURCE_ATTRIBUTE_PRESENT 0x00000001\r | |
70 | EFI_RESOURCE_ATTRIBUTE_INITIALIZED 0x00000002\r | |
71 | EFI_RESOURCE_ATTRIBUTE_TESTED 0x00000004\r | |
72 | EFI_RESOURCE_ATTRIBUTE_SINGLE_BIT_ECC 0x00000008\r | |
73 | EFI_RESOURCE_ATTRIBUTE_MULTIPLE_BIT_ECC 0x00000010\r | |
74 | EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_1 0x00000020\r | |
75 | EFI_RESOURCE_ATTRIBUTE_ECC_RESERVED_2 0x00000040\r | |
76 | EFI_RESOURCE_ATTRIBUTE_READ_PROTECTED 0x00000080\r | |
77 | EFI_RESOURCE_ATTRIBUTE_WRITE_PROTECTED 0x00000100\r | |
78 | EFI_RESOURCE_ATTRIBUTE_EXECUTION_PROTECTED 0x00000200\r | |
79 | EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE 0x00000400\r | |
80 | EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE 0x00000800\r | |
81 | EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE 0x00001000\r | |
82 | EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE 0x00002000\r | |
83 | EFI_RESOURCE_ATTRIBUTE_16_BIT_IO 0x00004000\r | |
84 | EFI_RESOURCE_ATTRIBUTE_32_BIT_IO 0x00008000\r | |
85 | EFI_RESOURCE_ATTRIBUTE_64_BIT_IO 0x00010000\r | |
86 | EFI_RESOURCE_ATTRIBUTE_UNCACHED_EXPORTED 0x00020000\r | |
87 | \r | |
88 | **/\r | |
89 | \r | |
90 | #include "Ebl.h"\r | |
3402aac7 | 91 | // BugBug: Autogen does not allow this to be included currently\r |
2ef2b01e A |
92 | //#include <EdkModulePkg/Include/EdkDxe.h>\r |
93 | \r | |
94 | GLOBAL_REMOVE_IF_UNREFERENCED char *mHobResourceType[] = {\r | |
95 | "Memory ",\r | |
96 | "MMIO ",\r | |
97 | "IO ",\r | |
98 | "Firmware ",\r | |
99 | "MMIO Port ",\r | |
100 | "Reserved ",\r | |
101 | "IO Reserved",\r | |
102 | "Illegal "\r | |
103 | };\r | |
104 | \r | |
105 | \r | |
106 | /**\r | |
7ca9e5a4 | 107 | Dump out the HOBs in the system. HOBs are defined in the PI specification\r |
2ef2b01e A |
108 | and they are used to hand off information from PEI to DXE.\r |
109 | \r | |
110 | Argv[0] - "hob"\r | |
111 | \r | |
112 | @param Argc Number of command arguments in Argv\r | |
3402aac7 | 113 | @param Argv Array of strings that represent the parsed command line.\r |
7ca9e5a4 | 114 | Argv[0] is the command name\r |
2ef2b01e A |
115 | \r |
116 | @return EFI_SUCCESS\r | |
117 | \r | |
118 | **/\r | |
119 | EFI_STATUS\r | |
50c6a4d2 | 120 | EFIAPI\r |
2ef2b01e A |
121 | EblHobCmd (\r |
122 | IN UINTN Argc,\r | |
123 | IN CHAR8 **Argv\r | |
124 | )\r | |
125 | {\r | |
126 | UINTN CurrentRow;\r | |
127 | EFI_PEI_HOB_POINTERS Hob;\r | |
128 | EFI_MEMORY_TYPE_INFORMATION *EfiMemoryTypeInformation;\r | |
129 | UINTN Index;\r | |
130 | \r | |
131 | CurrentRow = 0;\r | |
132 | for (Hob.Raw = GetHobList (); !END_OF_HOB_LIST(Hob); Hob.Raw = GET_NEXT_HOB(Hob)) {\r | |
133 | if (Hob.Header->HobType == EFI_HOB_TYPE_HANDOFF) {\r | |
3402aac7 RC |
134 | AsciiPrint ("PHIT HOB Ver %x Boot Mode %02x Top %lx Bottom %lx\n",\r |
135 | Hob.HandoffInformationTable->Version,\r | |
136 | Hob.HandoffInformationTable->BootMode,\r | |
2ef2b01e A |
137 | Hob.HandoffInformationTable->EfiMemoryTop,\r |
138 | Hob.HandoffInformationTable->EfiMemoryBottom\r | |
139 | );\r | |
140 | \r | |
141 | if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {\r | |
142 | return EFI_SUCCESS;\r | |
143 | }\r | |
144 | \r | |
3402aac7 | 145 | AsciiPrint (" Free Top %lx Free Bottom %lx End Of HOB %lx\n",\r |
2ef2b01e A |
146 | Hob.HandoffInformationTable->EfiFreeMemoryTop,\r |
147 | Hob.HandoffInformationTable->EfiFreeMemoryBottom,\r | |
148 | Hob.HandoffInformationTable->EfiEndOfHobList\r | |
149 | );\r | |
150 | \r | |
151 | } else if (Hob.Header->HobType == EFI_HOB_TYPE_MEMORY_ALLOCATION) {\r | |
152 | // mod(%) on array index is just to prevent buffer overrun\r | |
153 | AsciiPrint ("Mem Alloc HOB %a %g %08lx:%lx\n",\r | |
3402aac7 RC |
154 | (Hob.MemoryAllocation->AllocDescriptor.MemoryType < EfiMaxMemoryType) ? gMemMapType[Hob.MemoryAllocation->AllocDescriptor.MemoryType] : "ILLEGAL TYPE",\r |
155 | &Hob.MemoryAllocation->AllocDescriptor.Name,\r | |
156 | Hob.MemoryAllocation->AllocDescriptor.MemoryBaseAddress,\r | |
2ef2b01e A |
157 | Hob.MemoryAllocation->AllocDescriptor.MemoryLength\r |
158 | );\r | |
159 | if (CompareGuid (&gEfiHobMemoryAllocModuleGuid, &Hob.MemoryAllocation->AllocDescriptor.Name)) {\r | |
160 | if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {\r | |
161 | return EFI_SUCCESS;\r | |
162 | }\r | |
163 | AsciiPrint (" Module Name %g EntryPoint %lx\n", &Hob.MemoryAllocationModule->ModuleName, Hob.MemoryAllocationModule->EntryPoint);\r | |
164 | }\r | |
165 | } else if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {\r | |
166 | AsciiPrint ("Resource HOB %a %g %08lx:%lx\n Attributes: %08x\n",\r | |
167 | (Hob.ResourceDescriptor->ResourceType < EFI_RESOURCE_MAX_MEMORY_TYPE) ? mHobResourceType[Hob.ResourceDescriptor->ResourceType] : mHobResourceType[EFI_RESOURCE_MAX_MEMORY_TYPE],\r | |
3402aac7 RC |
168 | &Hob.ResourceDescriptor->Owner,\r |
169 | Hob.ResourceDescriptor->PhysicalStart,\r | |
170 | Hob.ResourceDescriptor->ResourceLength,\r | |
2ef2b01e A |
171 | Hob.ResourceDescriptor->ResourceAttribute\r |
172 | );\r | |
173 | if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {\r | |
174 | return EFI_SUCCESS;\r | |
175 | }\r | |
176 | } else if (Hob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION) {\r | |
177 | AsciiPrint ("GUID HOB %g\n", &Hob.Guid->Name);\r | |
178 | if (CompareGuid (&gEfiMemoryTypeInformationGuid, &Hob.Guid->Name)) {\r | |
179 | EfiMemoryTypeInformation = GET_GUID_HOB_DATA (Hob.Guid);\r | |
180 | for (Index = 0; Index < (GET_GUID_HOB_DATA_SIZE (Hob.Guid)/sizeof (EFI_MEMORY_TYPE_INFORMATION)); Index++, EfiMemoryTypeInformation++) {\r | |
181 | if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {\r | |
182 | return EFI_SUCCESS;\r | |
183 | }\r | |
3402aac7 RC |
184 | AsciiPrint (" %a 0x%08x\n",\r |
185 | (EfiMemoryTypeInformation->Type < EfiMaxMemoryType) ? gMemMapType[EfiMemoryTypeInformation->Type] : "END ",\r | |
2ef2b01e A |
186 | EfiMemoryTypeInformation->NumberOfPages\r |
187 | );\r | |
188 | }\r | |
189 | }\r | |
190 | } else if (Hob.Header->HobType == EFI_HOB_TYPE_FV) {\r | |
3402aac7 | 191 | AsciiPrint ("FV HOB %08lx:%08lx\n", Hob.FirmwareVolume->BaseAddress, Hob.FirmwareVolume->Length);\r |
2ef2b01e | 192 | } else if (Hob.Header->HobType == EFI_HOB_TYPE_CPU) {\r |
3402aac7 | 193 | AsciiPrint ("CPU HOB: Mem %x IO %x\n", Hob.Cpu->SizeOfMemorySpace, Hob.Cpu->SizeOfIoSpace);\r |
2ef2b01e A |
194 | } else if (Hob.Header->HobType == EFI_HOB_TYPE_MEMORY_POOL) {\r |
195 | AsciiPrint ("Mem Pool HOB:\n");\r | |
196 | /* Not in PI\r | |
197 | } else if (Hob.Header->HobType == EFI_HOB_TYPE_CV) {\r | |
198 | AsciiPrint ("CV HOB: %08lx:%08lx\n", Hob.CapsuleVolume->BaseAddress, Hob.CapsuleVolume->Length);\r | |
199 | */\r | |
200 | }\r | |
201 | \r | |
202 | if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {\r | |
203 | break;\r | |
3402aac7 | 204 | }\r |
2ef2b01e A |
205 | }\r |
206 | \r | |
207 | return EFI_SUCCESS;\r | |
208 | }\r | |
209 | \r | |
210 | \r | |
211 | GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdHobTemplate[] =\r | |
212 | {\r | |
213 | {\r | |
214 | "hob",\r | |
215 | "; dump HOBs",\r | |
216 | NULL,\r | |
217 | EblHobCmd\r | |
218 | }\r | |
219 | };\r | |
220 | \r | |
221 | \r | |
222 | /**\r | |
223 | Initialize the commands in this in this file\r | |
224 | **/\r | |
225 | VOID\r | |
226 | EblInitializeHobCmd (\r | |
227 | VOID\r | |
228 | )\r | |
229 | {\r | |
230 | if (FeaturePcdGet (PcdEmbeddedHobCmd)) {\r | |
231 | EblAddCommands (mCmdHobTemplate, sizeof (mCmdHobTemplate)/sizeof (EBL_COMMAND_TABLE));\r | |
232 | }\r | |
233 | }\r | |
234 | \r |