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