Commit | Line | Data |
---|---|---|
ef99a95a | 1 | /*++\r |
2 | \r | |
ce8bd86e | 3 | Copyright (c) 2006 - 2007, Intel Corporation\r |
4 | All rights reserved. This program and the accompanying materials\r | |
5 | are licensed and made available under the terms and conditions of the BSD License\r | |
6 | which accompanies this distribution. The full text of the license may be found at\r | |
7 | http://opensource.org/licenses/bsd-license.php\r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
ef99a95a | 11 | \r |
12 | Module Name:\r | |
13 | \r | |
14 | DxeMain.c\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | DXE Core Main Entry Point\r | |
19 | \r | |
20 | --*/\r | |
21 | \r | |
22 | #include <DxeMain.h>\r | |
23 | \r | |
ef99a95a | 24 | //\r |
25 | // DXE Core Global Variables for Protocols from PEI\r | |
26 | //\r | |
27 | EFI_HANDLE mDecompressHandle = NULL;\r | |
28 | EFI_PEI_PE_COFF_LOADER_PROTOCOL *gEfiPeiPeCoffLoader = NULL;\r | |
29 | \r | |
30 | //\r | |
31 | // DXE Core globals for Architecture Protocols\r | |
32 | //\r | |
33 | EFI_SECURITY_ARCH_PROTOCOL *gSecurity = NULL;\r | |
34 | EFI_CPU_ARCH_PROTOCOL *gCpu = NULL;\r | |
35 | EFI_METRONOME_ARCH_PROTOCOL *gMetronome = NULL;\r | |
36 | EFI_TIMER_ARCH_PROTOCOL *gTimer = NULL;\r | |
37 | EFI_BDS_ARCH_PROTOCOL *gBds = NULL;\r | |
38 | EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *gWatchdogTimer = NULL;\r | |
3ec2611d | 39 | \r |
ef99a95a | 40 | \r |
41 | //\r | |
42 | // BugBug: I'n not runtime, but is the PPI?\r | |
43 | //\r | |
44 | EFI_STATUS_CODE_PROTOCOL gStatusCodeInstance = {\r | |
45 | NULL\r | |
46 | };\r | |
47 | \r | |
48 | EFI_STATUS_CODE_PROTOCOL *gStatusCode = &gStatusCodeInstance;\r | |
49 | \r | |
50 | \r | |
51 | //\r | |
52 | // DXE Core Global used to update core loaded image protocol handle\r | |
53 | //\r | |
54 | EFI_GUID *gDxeCoreFileName;\r | |
55 | EFI_LOADED_IMAGE_PROTOCOL *gDxeCoreLoadedImage;\r | |
56 | \r | |
57 | \r | |
58 | \r | |
59 | //\r | |
60 | // DXE Core Module Variables\r | |
61 | //\r | |
62 | \r | |
63 | EFI_BOOT_SERVICES mBootServices = {\r | |
64 | {\r | |
65 | EFI_BOOT_SERVICES_SIGNATURE, // Signature\r | |
66 | EFI_BOOT_SERVICES_REVISION, // Revision\r | |
67 | sizeof (EFI_BOOT_SERVICES), // HeaderSize\r | |
68 | 0, // CRC32\r | |
69 | 0 // Reserved\r | |
ce8bd86e | 70 | },\r |
ef99a95a | 71 | (EFI_RAISE_TPL) CoreRaiseTpl, // RaiseTPL\r |
72 | (EFI_RESTORE_TPL) CoreRestoreTpl, // RestoreTPL\r | |
73 | (EFI_ALLOCATE_PAGES) CoreAllocatePages, // AllocatePages\r | |
74 | (EFI_FREE_PAGES) CoreFreePages, // FreePages\r | |
75 | (EFI_GET_MEMORY_MAP) CoreGetMemoryMap, // GetMemoryMap\r | |
76 | (EFI_ALLOCATE_POOL) CoreAllocatePool, // AllocatePool\r | |
77 | (EFI_FREE_POOL) CoreFreePool, // FreePool\r | |
78 | (EFI_CREATE_EVENT) CoreCreateEvent, // CreateEvent\r | |
79 | (EFI_SET_TIMER) CoreSetTimer, // SetTimer\r | |
80 | (EFI_WAIT_FOR_EVENT) CoreWaitForEvent, // WaitForEvent\r | |
81 | (EFI_SIGNAL_EVENT) CoreSignalEvent, // SignalEvent\r | |
82 | (EFI_CLOSE_EVENT) CoreCloseEvent, // CloseEvent\r | |
83 | (EFI_CHECK_EVENT) CoreCheckEvent, // CheckEvent\r | |
84 | (EFI_INSTALL_PROTOCOL_INTERFACE) CoreInstallProtocolInterface, // InstallProtocolInterface\r | |
85 | (EFI_REINSTALL_PROTOCOL_INTERFACE) CoreReinstallProtocolInterface, // ReinstallProtocolInterface\r | |
86 | (EFI_UNINSTALL_PROTOCOL_INTERFACE) CoreUninstallProtocolInterface, // UninstallProtocolInterface\r | |
87 | (EFI_HANDLE_PROTOCOL) CoreHandleProtocol, // HandleProtocol\r | |
88 | (VOID *) NULL, // Reserved\r | |
89 | (EFI_REGISTER_PROTOCOL_NOTIFY) CoreRegisterProtocolNotify, // RegisterProtocolNotify\r | |
90 | (EFI_LOCATE_HANDLE) CoreLocateHandle, // LocateHandle\r | |
91 | (EFI_LOCATE_DEVICE_PATH) CoreLocateDevicePath, // LocateDevicePath\r | |
92 | (EFI_INSTALL_CONFIGURATION_TABLE) CoreInstallConfigurationTable, // InstallConfigurationTable\r | |
93 | (EFI_IMAGE_LOAD) CoreLoadImage, // LoadImage\r | |
94 | (EFI_IMAGE_START) CoreStartImage, // StartImage\r | |
95 | (EFI_EXIT) CoreExit, // Exit\r | |
96 | (EFI_IMAGE_UNLOAD) CoreUnloadImage, // UnloadImage\r | |
97 | (EFI_EXIT_BOOT_SERVICES) CoreExitBootServices, // ExitBootServices\r | |
98 | (EFI_GET_NEXT_MONOTONIC_COUNT) CoreEfiNotAvailableYetArg1, // GetNextMonotonicCount\r | |
99 | (EFI_STALL) CoreStall, // Stall\r | |
100 | (EFI_SET_WATCHDOG_TIMER) CoreSetWatchdogTimer, // SetWatchdogTimer\r | |
101 | (EFI_CONNECT_CONTROLLER) CoreConnectController, // ConnectController\r | |
102 | (EFI_DISCONNECT_CONTROLLER) CoreDisconnectController, // DisconnectController\r | |
103 | (EFI_OPEN_PROTOCOL) CoreOpenProtocol, // OpenProtocol\r | |
104 | (EFI_CLOSE_PROTOCOL) CoreCloseProtocol, // CloseProtocol\r | |
105 | (EFI_OPEN_PROTOCOL_INFORMATION) CoreOpenProtocolInformation, // OpenProtocolInformation\r | |
106 | (EFI_PROTOCOLS_PER_HANDLE) CoreProtocolsPerHandle, // ProtocolsPerHandle\r | |
107 | (EFI_LOCATE_HANDLE_BUFFER) CoreLocateHandleBuffer, // LocateHandleBuffer\r | |
108 | (EFI_LOCATE_PROTOCOL) CoreLocateProtocol, // LocateProtocol\r | |
109 | (EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) CoreInstallMultipleProtocolInterfaces, // InstallMultipleProtocolInterfaces\r | |
110 | (EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) CoreUninstallMultipleProtocolInterfaces, // UninstallMultipleProtocolInterfaces\r | |
111 | (EFI_CALCULATE_CRC32) CoreEfiNotAvailableYetArg3, // CalculateCrc32\r | |
112 | (EFI_COPY_MEM) CopyMem, // CopyMem\r | |
ce8bd86e | 113 | (EFI_SET_MEM) SetMem, // SetMem\r |
114 | (EFI_CREATE_EVENT_EX) CoreCreateEventEx // CreateEventEx\r | |
ef99a95a | 115 | };\r |
116 | \r | |
117 | EFI_DXE_SERVICES mDxeServices = {\r | |
118 | {\r | |
119 | EFI_DXE_SERVICES_SIGNATURE, // Signature\r | |
120 | EFI_DXE_SERVICES_REVISION, // Revision\r | |
121 | sizeof (EFI_DXE_SERVICES), // HeaderSize\r | |
122 | 0, // CRC32\r | |
123 | 0 // Reserved\r | |
124 | },\r | |
125 | (EFI_ADD_MEMORY_SPACE) CoreAddMemorySpace, // AddMemorySpace\r | |
126 | (EFI_ALLOCATE_MEMORY_SPACE) CoreAllocateMemorySpace, // AllocateMemorySpace\r | |
127 | (EFI_FREE_MEMORY_SPACE) CoreFreeMemorySpace, // FreeMemorySpace\r | |
128 | (EFI_REMOVE_MEMORY_SPACE) CoreRemoveMemorySpace, // RemoveMemorySpace\r | |
129 | (EFI_GET_MEMORY_SPACE_DESCRIPTOR) CoreGetMemorySpaceDescriptor, // GetMemorySpaceDescriptor\r | |
130 | (EFI_SET_MEMORY_SPACE_ATTRIBUTES) CoreSetMemorySpaceAttributes, // SetMemorySpaceAttributes\r | |
131 | (EFI_GET_MEMORY_SPACE_MAP) CoreGetMemorySpaceMap, // GetMemorySpaceMap\r | |
132 | (EFI_ADD_IO_SPACE) CoreAddIoSpace, // AddIoSpace\r | |
133 | (EFI_ALLOCATE_IO_SPACE) CoreAllocateIoSpace, // AllocateIoSpace\r | |
134 | (EFI_FREE_IO_SPACE) CoreFreeIoSpace, // FreeIoSpace\r | |
135 | (EFI_REMOVE_IO_SPACE) CoreRemoveIoSpace, // RemoveIoSpace\r | |
136 | (EFI_GET_IO_SPACE_DESCRIPTOR) CoreGetIoSpaceDescriptor, // GetIoSpaceDescriptor\r | |
137 | (EFI_GET_IO_SPACE_MAP) CoreGetIoSpaceMap, // GetIoSpaceMap\r | |
138 | (EFI_DISPATCH) CoreDispatcher, // Dispatch\r | |
139 | (EFI_SCHEDULE) CoreSchedule, // Schedule\r | |
140 | (EFI_TRUST) CoreTrust, // Trust\r | |
141 | (EFI_PROCESS_FIRMWARE_VOLUME) CoreProcessFirmwareVolume, // ProcessFirmwareVolume\r | |
142 | };\r | |
143 | \r | |
144 | EFI_SYSTEM_TABLE mEfiSystemTableTemplate = {\r | |
145 | {\r | |
146 | EFI_SYSTEM_TABLE_SIGNATURE, // Signature\r | |
147 | EFI_SYSTEM_TABLE_REVISION, // Revision\r | |
148 | sizeof (EFI_SYSTEM_TABLE), // HeaderSize\r | |
149 | 0, // CRC32\r | |
150 | 0 // Reserved\r | |
151 | },\r | |
152 | NULL, // FirmwareVendor\r | |
153 | 0, // FirmwareRevision\r | |
154 | NULL, // ConsoleInHandle\r | |
155 | NULL, // ConIn\r | |
156 | NULL, // ConsoleOutHandle\r | |
157 | NULL, // ConOut\r | |
158 | NULL, // StandardErrorHandle\r | |
159 | NULL, // StdErr\r | |
160 | NULL, // RuntimeServices\r | |
161 | &mBootServices, // BootServices\r | |
162 | 0, // NumberOfConfigurationTableEntries\r | |
163 | NULL // ConfigurationTable\r | |
164 | };\r | |
165 | \r | |
166 | EFI_RUNTIME_SERVICES mEfiRuntimeServicesTableTemplate = {\r | |
167 | {\r | |
168 | EFI_RUNTIME_SERVICES_SIGNATURE, // Signature\r | |
169 | EFI_RUNTIME_SERVICES_REVISION, // Revision\r | |
170 | sizeof (EFI_RUNTIME_SERVICES), // HeaderSize\r | |
171 | 0, // CRC32\r | |
172 | 0 // Reserved\r | |
173 | },\r | |
ce8bd86e | 174 | (EFI_GET_TIME) CoreEfiNotAvailableYetArg2, // GetTime\r |
175 | (EFI_SET_TIME) CoreEfiNotAvailableYetArg1, // SetTime\r | |
176 | (EFI_GET_WAKEUP_TIME) CoreEfiNotAvailableYetArg3, // GetWakeupTime\r | |
177 | (EFI_SET_WAKEUP_TIME) CoreEfiNotAvailableYetArg2, // SetWakeupTime\r | |
178 | (EFI_SET_VIRTUAL_ADDRESS_MAP) CoreEfiNotAvailableYetArg4, // SetVirtualAddressMap\r | |
179 | (EFI_CONVERT_POINTER) CoreEfiNotAvailableYetArg2, // ConvertPointer\r | |
180 | (EFI_GET_VARIABLE) CoreEfiNotAvailableYetArg5, // GetVariable\r | |
181 | (EFI_GET_NEXT_VARIABLE_NAME) CoreEfiNotAvailableYetArg3, // GetNextVariableName\r | |
182 | (EFI_SET_VARIABLE) CoreEfiNotAvailableYetArg5, // SetVariable\r | |
183 | (EFI_GET_NEXT_HIGH_MONO_COUNT) CoreEfiNotAvailableYetArg1, // GetNextHighMonotonicCount\r | |
184 | (EFI_RESET_SYSTEM) CoreEfiNotAvailableYetArg4, // ResetSystem\r | |
ef99a95a | 185 | (EFI_UPDATE_CAPSULE) CoreEfiNotAvailableYetArg3, // UpdateCapsule\r |
186 | (EFI_QUERY_CAPSULE_CAPABILITIES) CoreEfiNotAvailableYetArg4, // QueryCapsuleCapabilities\r | |
187 | (EFI_QUERY_VARIABLE_INFO) CoreEfiNotAvailableYetArg4 // QueryVariableInfo\r | |
ef99a95a | 188 | };\r |
189 | \r | |
3ec2611d LG |
190 | EFI_RUNTIME_ARCH_PROTOCOL gRuntimeTemplate = {\r |
191 | INITIALIZE_LIST_HEAD_VARIABLE (gRuntimeTemplate.ImageHead),\r | |
192 | INITIALIZE_LIST_HEAD_VARIABLE (gRuntimeTemplate.EventHead),\r | |
193 | \r | |
194 | //\r | |
195 | // Make sure Size != sizeof (EFI_MEMORY_DESCRIPTOR). This will\r | |
196 | // prevent people from having pointer math bugs in their code.\r | |
197 | // now you have to use *DescriptorSize to make things work.\r | |
198 | //\r | |
ce8bd86e | 199 | sizeof (EFI_MEMORY_DESCRIPTOR) + sizeof (UINT64) - (sizeof (EFI_MEMORY_DESCRIPTOR) % sizeof (UINT64)),\r |
200 | EFI_MEMORY_DESCRIPTOR_VERSION,\r | |
3ec2611d LG |
201 | 0,\r |
202 | NULL,\r | |
203 | NULL,\r | |
204 | FALSE,\r | |
205 | FALSE\r | |
206 | };\r | |
207 | \r | |
208 | EFI_RUNTIME_ARCH_PROTOCOL *gRuntime = &gRuntimeTemplate;\r | |
209 | \r | |
ef99a95a | 210 | //\r |
ce8bd86e | 211 | // DXE Core Global Variables for the EFI System Table, Boot Services Table,\r |
ef99a95a | 212 | // DXE Services Table, and Runtime Services Table\r |
213 | //\r | |
abb23475 | 214 | EFI_BOOT_SERVICES *gDxeCoreBS = &mBootServices;\r |
215 | EFI_DXE_SERVICES *gDxeCoreDS = &mDxeServices;\r | |
216 | EFI_SYSTEM_TABLE *gDxeCoreST = NULL;\r | |
ef99a95a | 217 | \r |
218 | //\r | |
abb23475 | 219 | // For debug initialize gDxeCoreRT to template. gDxeCoreRT must be allocated from RT memory\r |
220 | // but gDxeCoreRT is used for ASSERT () and DEBUG () type macros so lets give it\r | |
ef99a95a | 221 | // a value that will not cause debug infrastructure to crash early on.\r |
222 | //\r | |
abb23475 | 223 | EFI_RUNTIME_SERVICES *gDxeCoreRT = &mEfiRuntimeServicesTableTemplate;\r |
ef99a95a | 224 | EFI_HANDLE gDxeCoreImageHandle = NULL;\r |
225 | \r | |
226 | VOID *mHobStart;\r | |
227 | \r | |
228 | //\r | |
229 | // EFI Decompress Protocol\r | |
230 | //\r | |
231 | EFI_DECOMPRESS_PROTOCOL gEfiDecompress = {\r | |
232 | DxeMainUefiDecompressGetInfo,\r | |
233 | DxeMainUefiDecompress\r | |
234 | };\r | |
235 | \r | |
236 | //\r | |
237 | // Tiano Decompress Protocol\r | |
238 | //\r | |
239 | EFI_TIANO_DECOMPRESS_PROTOCOL gEfiTianoDecompress = {\r | |
240 | DxeMainTianoDecompressGetInfo,\r | |
241 | DxeMainTianoDecompress\r | |
242 | };\r | |
243 | \r | |
244 | //\r | |
245 | // Customized Decompress Protocol\r | |
246 | //\r | |
247 | EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL gEfiCustomizedDecompress = {\r | |
248 | DxeMainCustomDecompressGetInfo,\r | |
249 | DxeMainCustomDecompress\r | |
250 | };\r | |
251 | \r | |
252 | //\r | |
253 | // Main entry point to the DXE Core\r | |
254 | //\r | |
255 | VOID\r | |
256 | EFIAPI\r | |
257 | DxeMain (\r | |
258 | IN VOID *HobStart\r | |
259 | )\r | |
260 | /*++\r | |
261 | \r | |
262 | Routine Description:\r | |
263 | \r | |
264 | Main entry point to DXE Core.\r | |
265 | \r | |
266 | Arguments:\r | |
267 | \r | |
268 | HobStart - Pointer to the beginning of the HOB List from PEI\r | |
269 | \r | |
270 | Returns:\r | |
271 | \r | |
272 | This function should never return\r | |
273 | \r | |
274 | --*/\r | |
275 | {\r | |
276 | EFI_STATUS Status;\r | |
277 | EFI_PHYSICAL_ADDRESS MemoryBaseAddress;\r | |
278 | UINT64 MemoryLength;\r | |
279 | \r | |
ef99a95a | 280 | mHobStart = HobStart;\r |
281 | \r | |
282 | //\r | |
283 | // Initialize Memory Services\r | |
284 | //\r | |
285 | CoreInitializeMemoryServices (&HobStart, &MemoryBaseAddress, &MemoryLength);\r | |
286 | \r | |
287 | //\r | |
288 | // Allocate the EFI System Table and EFI Runtime Service Table from EfiRuntimeServicesData\r | |
289 | // Use the templates to initialize the contents of the EFI System Table and EFI Runtime Services Table\r | |
290 | //\r | |
abb23475 | 291 | gDxeCoreST = CoreAllocateRuntimeCopyPool (sizeof (EFI_SYSTEM_TABLE), &mEfiSystemTableTemplate);\r |
292 | ASSERT (gDxeCoreST != NULL);\r | |
ef99a95a | 293 | \r |
abb23475 | 294 | gDxeCoreRT = CoreAllocateRuntimeCopyPool (sizeof (EFI_RUNTIME_SERVICES), &mEfiRuntimeServicesTableTemplate);\r |
295 | ASSERT (gDxeCoreRT != NULL);\r | |
ef99a95a | 296 | \r |
abb23475 | 297 | gDxeCoreST->RuntimeServices = gDxeCoreRT;\r |
ce8bd86e | 298 | \r |
ef99a95a | 299 | //\r |
300 | // Start the Image Services.\r | |
301 | //\r | |
302 | Status = CoreInitializeImageServices (HobStart);\r | |
303 | ASSERT_EFI_ERROR (Status);\r | |
304 | \r | |
305 | //\r | |
306 | // Call constructor for all libraries\r | |
307 | //\r | |
abb23475 | 308 | ProcessLibraryConstructorList (gDxeCoreImageHandle, gDxeCoreST);\r |
217f1d11 | 309 | PERF_END (0,PEI_TOK, NULL, 0) ;\r |
b1288fca | 310 | PERF_START (0,DXE_TOK, NULL, 0) ;\r |
ef99a95a | 311 | \r |
312 | //\r | |
313 | // Initialize the Global Coherency Domain Services\r | |
314 | //\r | |
315 | Status = CoreInitializeGcdServices (&HobStart, MemoryBaseAddress, MemoryLength);\r | |
316 | ASSERT_EFI_ERROR (Status);\r | |
317 | \r | |
318 | //\r | |
319 | // Install the DXE Services Table into the EFI System Tables's Configuration Table\r | |
320 | //\r | |
abb23475 | 321 | Status = CoreInstallConfigurationTable (&gEfiDxeServicesTableGuid, gDxeCoreDS);\r |
ef99a95a | 322 | ASSERT_EFI_ERROR (Status);\r |
323 | \r | |
324 | //\r | |
325 | // Install the HOB List into the EFI System Tables's Configuration Table\r | |
326 | //\r | |
327 | Status = CoreInstallConfigurationTable (&gEfiHobListGuid, HobStart);\r | |
328 | ASSERT_EFI_ERROR (Status);\r | |
329 | \r | |
330 | //\r | |
331 | // Install Memory Type Information Table into the EFI System Tables's Configuration Table\r | |
332 | //\r | |
333 | Status = CoreInstallConfigurationTable (&gEfiMemoryTypeInformationGuid, &gMemoryTypeInformation);\r | |
334 | ASSERT_EFI_ERROR (Status);\r | |
335 | \r | |
336 | //\r | |
84e73ac2 | 337 | // Initialize the ReportStatusCode with PEI version, if available\r |
ef99a95a | 338 | //\r |
339 | CoreGetPeiProtocol (&gEfiStatusCodeRuntimeProtocolGuid, (VOID **)&gStatusCode->ReportStatusCode);\r | |
ef99a95a | 340 | \r |
341 | //\r | |
342 | // Report Status Code here for DXE_ENTRY_POINT once it is available\r | |
343 | //\r | |
344 | CoreReportProgressCode ((EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ENTRY_POINT));\r | |
345 | \r | |
346 | //\r | |
347 | // Create the aligned system table pointer structure that is used by external\r | |
348 | // debuggers to locate the system table... Also, install debug image info\r | |
349 | // configuration table.\r | |
350 | //\r | |
351 | CoreInitializeDebugImageInfoTable ();\r | |
352 | CoreNewDebugImageInfoEntry (\r | |
353 | EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL,\r | |
354 | gDxeCoreLoadedImage,\r | |
355 | gDxeCoreImageHandle\r | |
356 | );\r | |
357 | \r | |
358 | DEBUG ((EFI_D_INFO | EFI_D_LOAD, "HOBLIST address in DXE = 0x%08x\n", HobStart));\r | |
359 | \r | |
360 | //\r | |
361 | // Initialize the Event Services\r | |
362 | //\r | |
363 | Status = CoreInitializeEventServices ();\r | |
364 | ASSERT_EFI_ERROR (Status);\r | |
365 | \r | |
ce8bd86e | 366 | \r |
ef99a95a | 367 | //\r |
368 | // Get the Protocols that were passed in from PEI to DXE through GUIDed HOBs\r | |
369 | //\r | |
ce8bd86e | 370 | // These Protocols are not architectural. This implementation is sharing code between\r |
371 | // PEI and DXE in order to save FLASH space. These Protocols could also be implemented\r | |
372 | // as part of the DXE Core. However, that would also require the DXE Core to be ported\r | |
373 | // each time a different CPU is used, a different Decompression algorithm is used, or a\r | |
374 | // different Image type is used. By placing these Protocols in PEI, the DXE Core remains\r | |
375 | // generic, and only PEI and the Arch Protocols need to be ported from Platform to Platform,\r | |
ef99a95a | 376 | // and from CPU to CPU.\r |
377 | //\r | |
378 | \r | |
379 | //\r | |
380 | // Publish the EFI, Tiano, and Custom Decompress protocols for use by other DXE components\r | |
ce8bd86e | 381 | //\r |
ef99a95a | 382 | Status = CoreInstallMultipleProtocolInterfaces (\r |
383 | &mDecompressHandle,\r | |
384 | &gEfiDecompressProtocolGuid, &gEfiDecompress,\r | |
385 | &gEfiTianoDecompressProtocolGuid, &gEfiTianoDecompress,\r | |
386 | &gEfiCustomizedDecompressProtocolGuid, &gEfiCustomizedDecompress,\r | |
387 | NULL\r | |
388 | );\r | |
389 | ASSERT_EFI_ERROR (Status);\r | |
390 | \r | |
391 | gEfiPeiPeCoffLoader = GetPeCoffLoaderProtocol ();\r | |
392 | ASSERT (gEfiPeiPeCoffLoader != NULL);\r | |
393 | \r | |
394 | //\r | |
395 | // Register for the GUIDs of the Architectural Protocols, so the rest of the\r | |
396 | // EFI Boot Services and EFI Runtime Services tables can be filled in.\r | |
397 | //\r | |
398 | CoreNotifyOnArchProtocolInstallation ();\r | |
399 | \r | |
400 | //\r | |
401 | // Produce Firmware Volume Protocols, one for each FV in the HOB list.\r | |
402 | //\r | |
abb23475 | 403 | Status = FwVolBlockDriverInit (gDxeCoreImageHandle, gDxeCoreST);\r |
ef99a95a | 404 | ASSERT_EFI_ERROR (Status);\r |
405 | \r | |
abb23475 | 406 | Status = FwVolDriverInit (gDxeCoreImageHandle, gDxeCoreST);\r |
ef99a95a | 407 | ASSERT_EFI_ERROR (Status);\r |
408 | \r | |
409 | //\r | |
ce8bd86e | 410 | // Produce the Section Extraction Protocol\r |
ef99a95a | 411 | //\r |
abb23475 | 412 | Status = InitializeSectionExtraction (gDxeCoreImageHandle, gDxeCoreST);\r |
ef99a95a | 413 | ASSERT_EFI_ERROR (Status);\r |
414 | \r | |
415 | //\r | |
416 | // Initialize the DXE Dispatcher\r | |
417 | //\r | |
418 | PERF_START (0,"CoreInitializeDispatcher", "DxeMain", 0) ;\r | |
419 | CoreInitializeDispatcher ();\r | |
420 | PERF_END (0,"CoreInitializeDispatcher", "DxeMain", 0) ;\r | |
421 | \r | |
422 | //\r | |
423 | // Invoke the DXE Dispatcher\r | |
424 | //\r | |
425 | PERF_START (0, "CoreDispatcher", "DxeMain", 0);\r | |
426 | CoreDispatcher ();\r | |
427 | PERF_END (0, "CoreDispatcher", "DxeMain", 0);\r | |
428 | \r | |
429 | //\r | |
430 | // Display Architectural protocols that were not loaded if this is DEBUG build\r | |
431 | //\r | |
2ce31132 | 432 | DEBUG_CODE_BEGIN ();\r |
ef99a95a | 433 | CoreDisplayMissingArchProtocols ();\r |
2ce31132 | 434 | DEBUG_CODE_END ();\r |
ce8bd86e | 435 | \r |
ef99a95a | 436 | //\r |
437 | // Assert if the Architectural Protocols are not present.\r | |
438 | //\r | |
439 | ASSERT_EFI_ERROR (CoreAllEfiServicesAvailable ());\r | |
440 | \r | |
441 | //\r | |
442 | // Report Status code before transfer control to BDS\r | |
443 | //\r | |
444 | CoreReportProgressCode ((EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT));\r | |
445 | //\r | |
446 | // Display any drivers that were not dispatched because dependency expression\r | |
447 | // evaluated to false if this is a debug build\r | |
448 | //\r | |
2ce31132 | 449 | DEBUG_CODE_BEGIN ();\r |
ef99a95a | 450 | CoreDisplayDiscoveredNotDispatched ();\r |
2ce31132 | 451 | DEBUG_CODE_END ();\r |
ef99a95a | 452 | \r |
453 | //\r | |
454 | // Transfer control to the BDS Architectural Protocol\r | |
455 | //\r | |
456 | gBds->Entry (gBds);\r | |
ce8bd86e | 457 | \r |
ef99a95a | 458 | //\r |
459 | // BDS should never return\r | |
460 | //\r | |
461 | ASSERT (FALSE);\r | |
462 | CpuDeadLoop ();\r | |
463 | }\r | |
464 | \r | |
465 | \r | |
466 | EFI_STATUS\r | |
467 | EFIAPI\r | |
468 | CoreEfiNotAvailableYetArg0 (\r | |
469 | VOID\r | |
470 | )\r | |
471 | /*++\r | |
472 | \r | |
473 | Routine Description:\r | |
474 | \r | |
475 | Place holder function until all the Boot Services and Runtime Services are available\r | |
476 | \r | |
477 | Arguments:\r | |
478 | \r | |
479 | None\r | |
480 | \r | |
481 | Returns:\r | |
482 | \r | |
483 | EFI_NOT_AVAILABLE_YET\r | |
484 | \r | |
485 | --*/\r | |
486 | {\r | |
487 | //\r | |
488 | // This function should never be executed. If it does, then the architectural protocols\r | |
489 | // have not been designed correctly. The CpuBreakpoint () is commented out for now until the\r | |
490 | // DXE Core and all the Architectural Protocols are complete.\r | |
491 | //\r | |
492 | \r | |
493 | return EFI_NOT_AVAILABLE_YET;\r | |
494 | }\r | |
495 | \r | |
496 | EFI_STATUS\r | |
497 | EFIAPI\r | |
498 | CoreEfiNotAvailableYetArg1 (\r | |
499 | UINTN Arg1\r | |
500 | )\r | |
501 | /*++\r | |
502 | \r | |
503 | Routine Description:\r | |
504 | \r | |
505 | Place holder function until all the Boot Services and Runtime Services are available\r | |
506 | \r | |
507 | Arguments:\r | |
508 | \r | |
509 | Arg1 - Undefined\r | |
510 | \r | |
511 | Returns:\r | |
512 | \r | |
513 | EFI_NOT_AVAILABLE_YET\r | |
514 | \r | |
515 | --*/\r | |
516 | {\r | |
517 | //\r | |
518 | // This function should never be executed. If it does, then the architectural protocols\r | |
519 | // have not been designed correctly. The CpuBreakpoint () is commented out for now until the\r | |
520 | // DXE Core and all the Architectural Protocols are complete.\r | |
521 | //\r | |
522 | \r | |
523 | return EFI_NOT_AVAILABLE_YET;\r | |
524 | }\r | |
525 | \r | |
526 | EFI_STATUS\r | |
527 | EFIAPI\r | |
528 | CoreEfiNotAvailableYetArg2 (\r | |
529 | UINTN Arg1,\r | |
530 | UINTN Arg2\r | |
531 | )\r | |
532 | /*++\r | |
533 | \r | |
534 | Routine Description:\r | |
535 | \r | |
536 | Place holder function until all the Boot Services and Runtime Services are available\r | |
537 | \r | |
538 | Arguments:\r | |
539 | \r | |
540 | Arg1 - Undefined\r | |
ce8bd86e | 541 | \r |
ef99a95a | 542 | Arg2 - Undefined\r |
543 | \r | |
544 | Returns:\r | |
545 | \r | |
546 | EFI_NOT_AVAILABLE_YET\r | |
547 | \r | |
548 | --*/\r | |
549 | {\r | |
550 | //\r | |
551 | // This function should never be executed. If it does, then the architectural protocols\r | |
552 | // have not been designed correctly. The CpuBreakpoint () is commented out for now until the\r | |
553 | // DXE Core and all the Architectural Protocols are complete.\r | |
554 | //\r | |
555 | \r | |
556 | return EFI_NOT_AVAILABLE_YET;\r | |
557 | }\r | |
558 | \r | |
559 | EFI_STATUS\r | |
560 | EFIAPI\r | |
561 | CoreEfiNotAvailableYetArg3 (\r | |
562 | UINTN Arg1,\r | |
563 | UINTN Arg2,\r | |
564 | UINTN Arg3\r | |
565 | )\r | |
566 | /*++\r | |
567 | \r | |
568 | Routine Description:\r | |
569 | \r | |
570 | Place holder function until all the Boot Services and Runtime Services are available\r | |
571 | \r | |
572 | Arguments:\r | |
573 | \r | |
574 | Arg1 - Undefined\r | |
ce8bd86e | 575 | \r |
ef99a95a | 576 | Arg2 - Undefined\r |
ce8bd86e | 577 | \r |
ef99a95a | 578 | Arg3 - Undefined\r |
579 | \r | |
580 | Returns:\r | |
581 | \r | |
582 | EFI_NOT_AVAILABLE_YET\r | |
583 | \r | |
584 | --*/\r | |
585 | {\r | |
586 | //\r | |
587 | // This function should never be executed. If it does, then the architectural protocols\r | |
588 | // have not been designed correctly. The CpuBreakpoint () is commented out for now until the\r | |
589 | // DXE Core and all the Architectural Protocols are complete.\r | |
590 | //\r | |
591 | \r | |
592 | return EFI_NOT_AVAILABLE_YET;\r | |
593 | }\r | |
594 | \r | |
595 | EFI_STATUS\r | |
596 | EFIAPI\r | |
597 | CoreEfiNotAvailableYetArg4 (\r | |
598 | UINTN Arg1,\r | |
599 | UINTN Arg2,\r | |
600 | UINTN Arg3,\r | |
601 | UINTN Arg4\r | |
602 | )\r | |
603 | /*++\r | |
604 | \r | |
605 | Routine Description:\r | |
606 | \r | |
607 | Place holder function until all the Boot Services and Runtime Services are available\r | |
608 | \r | |
609 | Arguments:\r | |
610 | \r | |
611 | Arg1 - Undefined\r | |
ce8bd86e | 612 | \r |
ef99a95a | 613 | Arg2 - Undefined\r |
ce8bd86e | 614 | \r |
ef99a95a | 615 | Arg3 - Undefined\r |
ce8bd86e | 616 | \r |
ef99a95a | 617 | Arg4 - Undefined\r |
618 | \r | |
619 | Returns:\r | |
620 | \r | |
621 | EFI_NOT_AVAILABLE_YET\r | |
622 | \r | |
623 | --*/\r | |
624 | {\r | |
625 | //\r | |
626 | // This function should never be executed. If it does, then the architectural protocols\r | |
627 | // have not been designed correctly. The CpuBreakpoint () is commented out for now until the\r | |
628 | // DXE Core and all the Architectural Protocols are complete.\r | |
629 | //\r | |
630 | \r | |
631 | return EFI_NOT_AVAILABLE_YET;\r | |
632 | }\r | |
633 | \r | |
634 | EFI_STATUS\r | |
635 | EFIAPI\r | |
636 | CoreEfiNotAvailableYetArg5 (\r | |
637 | UINTN Arg1,\r | |
638 | UINTN Arg2,\r | |
639 | UINTN Arg3,\r | |
640 | UINTN Arg4,\r | |
641 | UINTN Arg5\r | |
642 | )\r | |
643 | /*++\r | |
644 | \r | |
645 | Routine Description:\r | |
646 | \r | |
647 | Place holder function until all the Boot Services and Runtime Services are available\r | |
648 | \r | |
649 | Arguments:\r | |
650 | \r | |
651 | Arg1 - Undefined\r | |
ce8bd86e | 652 | \r |
ef99a95a | 653 | Arg2 - Undefined\r |
ce8bd86e | 654 | \r |
ef99a95a | 655 | Arg3 - Undefined\r |
ce8bd86e | 656 | \r |
ef99a95a | 657 | Arg4 - Undefined\r |
ce8bd86e | 658 | \r |
ef99a95a | 659 | Arg5 - Undefined\r |
660 | \r | |
661 | Returns:\r | |
662 | \r | |
663 | EFI_NOT_AVAILABLE_YET\r | |
664 | \r | |
665 | --*/\r | |
666 | {\r | |
667 | //\r | |
668 | // This function should never be executed. If it does, then the architectural protocols\r | |
669 | // have not been designed correctly. The CpuBreakpoint () is commented out for now until the\r | |
670 | // DXE Core and all the Architectural Protocols are complete.\r | |
671 | //\r | |
672 | \r | |
673 | return EFI_NOT_AVAILABLE_YET;\r | |
674 | }\r | |
675 | \r | |
676 | \r | |
677 | EFI_STATUS\r | |
678 | CoreGetPeiProtocol (\r | |
679 | IN EFI_GUID *ProtocolGuid,\r | |
680 | IN VOID **Interface\r | |
681 | )\r | |
682 | /*++\r | |
683 | \r | |
684 | Routine Description:\r | |
685 | \r | |
686 | Searches for a Protocol Interface passed from PEI through a HOB\r | |
687 | \r | |
688 | Arguments:\r | |
689 | \r | |
690 | ProtocolGuid - The Protocol GUID to search for in the HOB List\r | |
691 | \r | |
692 | Interface - A pointer to the interface for the Protocol GUID\r | |
693 | \r | |
694 | Returns:\r | |
695 | \r | |
696 | EFI_SUCCESS - The Protocol GUID was found and its interface is returned in Interface\r | |
697 | \r | |
698 | EFI_NOT_FOUND - The Protocol GUID was not found in the HOB List\r | |
699 | \r | |
700 | --*/\r | |
701 | {\r | |
702 | EFI_HOB_GUID_TYPE *GuidHob;\r | |
703 | VOID *Buffer;\r | |
704 | \r | |
705 | GuidHob = GetNextGuidHob (ProtocolGuid, mHobStart);\r | |
706 | if (GuidHob == NULL) {\r | |
707 | return EFI_NOT_FOUND;\r | |
708 | }\r | |
ce8bd86e | 709 | \r |
ef99a95a | 710 | Buffer = GET_GUID_HOB_DATA (GuidHob);\r |
711 | ASSERT (Buffer != NULL);\r | |
712 | \r | |
713 | *Interface = (VOID *)(*(UINTN *)(Buffer));\r | |
714 | \r | |
715 | return EFI_SUCCESS;\r | |
716 | }\r | |
717 | \r | |
718 | \r | |
719 | VOID\r | |
720 | CalculateEfiHdrCrc (\r | |
721 | IN OUT EFI_TABLE_HEADER *Hdr\r | |
722 | )\r | |
723 | /*++\r | |
724 | \r | |
725 | Routine Description:\r | |
726 | \r | |
727 | Calcualte the 32-bit CRC in a EFI table using the service provided by the\r | |
728 | gRuntime service.\r | |
729 | \r | |
730 | Arguments:\r | |
731 | \r | |
732 | Hdr - Pointer to an EFI standard header\r | |
733 | \r | |
734 | Returns:\r | |
735 | \r | |
736 | None\r | |
737 | \r | |
738 | --*/\r | |
739 | {\r | |
740 | UINT32 Crc;\r | |
741 | \r | |
742 | Hdr->CRC32 = 0;\r | |
ce8bd86e | 743 | \r |
ef99a95a | 744 | //\r |
abb23475 | 745 | // If gDxeCoreBS->CalculateCrce32 () == CoreEfiNotAvailableYet () then\r |
ef99a95a | 746 | // Crc will come back as zero if we set it to zero here\r |
747 | //\r | |
748 | Crc = 0;\r | |
abb23475 | 749 | gDxeCoreBS->CalculateCrc32 ((UINT8 *)Hdr, Hdr->HeaderSize, &Crc);\r |
ce8bd86e | 750 | Hdr->CRC32 = Crc;\r |
ef99a95a | 751 | }\r |
752 | \r | |
753 | \r | |
754 | \r | |
755 | EFI_STATUS\r | |
756 | EFIAPI\r | |
757 | CoreExitBootServices (\r | |
758 | IN EFI_HANDLE ImageHandle,\r | |
759 | IN UINTN MapKey\r | |
760 | )\r | |
761 | /*++\r | |
762 | \r | |
763 | Routine Description:\r | |
764 | \r | |
3ec2611d | 765 | Terminates all boot services.\r |
ef99a95a | 766 | \r |
767 | Arguments:\r | |
768 | \r | |
3ec2611d | 769 | ImageHandle - Handle that identifies the exiting image.\r |
ef99a95a | 770 | \r |
771 | MapKey -Key to the latest memory map.\r | |
772 | \r | |
773 | Returns:\r | |
774 | \r | |
775 | EFI_SUCCESS - Boot Services terminated\r | |
776 | EFI_INVALID_PARAMETER - MapKey is incorrect.\r | |
777 | \r | |
778 | --*/\r | |
779 | {\r | |
780 | EFI_STATUS Status;\r | |
781 | \r | |
782 | //\r | |
783 | // Terminate memory services if the MapKey matches\r | |
784 | //\r | |
785 | Status = CoreTerminateMemoryMap (MapKey);\r | |
786 | if (EFI_ERROR (Status)) {\r | |
787 | return Status;\r | |
788 | }\r | |
789 | \r | |
790 | //\r | |
791 | // Notify other drivers that we are exiting boot services.\r | |
792 | //\r | |
793 | CoreNotifySignalList (&gEfiEventExitBootServicesGuid);\r | |
794 | \r | |
795 | //\r | |
796 | // Disable Timer\r | |
797 | //\r | |
798 | gTimer->SetTimerPeriod (gTimer, 0);\r | |
799 | \r | |
800 | //\r | |
801 | // Disable CPU Interrupts\r | |
802 | //\r | |
803 | gCpu->DisableInterrupt (gCpu);\r | |
804 | \r | |
ef99a95a | 805 | //\r |
806 | // Report that ExitBootServices() has been called\r | |
807 | //\r | |
808 | // We are using gEfiDxeServicesTableGuid as the caller ID for Dxe Core\r | |
809 | //\r | |
810 | CoreReportProgressCode ((EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES));\r | |
811 | \r | |
812 | //\r | |
813 | // Clear the non-runtime values of the EFI System Table\r | |
814 | //\r | |
abb23475 | 815 | gDxeCoreST->BootServices = NULL;\r |
816 | gDxeCoreST->ConIn = NULL;\r | |
817 | gDxeCoreST->ConsoleInHandle = NULL;\r | |
818 | gDxeCoreST->ConOut = NULL;\r | |
819 | gDxeCoreST->ConsoleOutHandle = NULL;\r | |
820 | gDxeCoreST->StdErr = NULL;\r | |
821 | gDxeCoreST->StandardErrorHandle = NULL;\r | |
ef99a95a | 822 | \r |
823 | //\r | |
824 | // Recompute the 32-bit CRC of the EFI System Table\r | |
825 | //\r | |
abb23475 | 826 | CalculateEfiHdrCrc (&gDxeCoreST->Hdr);\r |
ef99a95a | 827 | \r |
828 | //\r | |
829 | // Zero out the Boot Service Table\r | |
830 | //\r | |
abb23475 | 831 | SetMem (gDxeCoreBS, sizeof (EFI_BOOT_SERVICES), 0);\r |
832 | gDxeCoreBS = NULL;\r | |
ce8bd86e | 833 | \r |
3ec2611d LG |
834 | //\r |
835 | // Update the AtRuntime field in Runtiem AP.\r | |
836 | //\r | |
837 | gRuntime->AtRuntime = TRUE;\r | |
ce8bd86e | 838 | \r |
ef99a95a | 839 | return Status;\r |
840 | }\r | |
841 | \r | |
842 | EFI_STATUS\r | |
843 | DxeMainUefiDecompressGetInfo (\r | |
844 | IN EFI_DECOMPRESS_PROTOCOL *This,\r | |
845 | IN VOID *Source,\r | |
846 | IN UINT32 SourceSize,\r | |
847 | OUT UINT32 *DestinationSize,\r | |
848 | OUT UINT32 *ScratchSize\r | |
849 | )\r | |
850 | {\r | |
e2180ee8 | 851 | if (Source == NULL \r |
852 | || DestinationSize == NULL \r | |
853 | || ScratchSize == NULL) {\r | |
854 | return EFI_INVALID_PARAMETER;\r | |
855 | }\r | |
ef99a95a | 856 | return UefiDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);\r |
857 | }\r | |
858 | \r | |
859 | EFI_STATUS\r | |
860 | EFIAPI\r | |
861 | DxeMainUefiDecompress (\r | |
862 | IN EFI_DECOMPRESS_PROTOCOL *This,\r | |
863 | IN VOID *Source,\r | |
864 | IN UINT32 SourceSize,\r | |
865 | IN OUT VOID *Destination,\r | |
866 | IN UINT32 DestinationSize,\r | |
867 | IN OUT VOID *Scratch,\r | |
868 | IN UINT32 ScratchSize\r | |
869 | )\r | |
870 | {\r | |
871 | EFI_STATUS Status;\r | |
872 | UINT32 TestDestinationSize;\r | |
873 | UINT32 TestScratchSize;\r | |
e2180ee8 | 874 | \r |
875 | if (Source == NULL \r | |
876 | || Destination== NULL \r | |
877 | || Scratch == NULL) {\r | |
878 | return EFI_INVALID_PARAMETER;\r | |
879 | }\r | |
880 | \r | |
ef99a95a | 881 | Status = UefiDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize);\r |
882 | if (EFI_ERROR (Status)) {\r | |
883 | return Status;\r | |
884 | }\r | |
885 | \r | |
886 | if (ScratchSize < TestScratchSize || DestinationSize < TestDestinationSize) {\r | |
887 | return RETURN_INVALID_PARAMETER;\r | |
888 | }\r | |
889 | \r | |
890 | return UefiDecompress (Source, Destination, Scratch);\r | |
891 | }\r | |
892 | \r | |
893 | EFI_STATUS\r | |
894 | DxeMainTianoDecompressGetInfo (\r | |
895 | IN EFI_TIANO_DECOMPRESS_PROTOCOL *This,\r | |
896 | IN VOID *Source,\r | |
897 | IN UINT32 SourceSize,\r | |
898 | OUT UINT32 *DestinationSize,\r | |
899 | OUT UINT32 *ScratchSize\r | |
900 | )\r | |
901 | {\r | |
e2180ee8 | 902 | if (Source == NULL \r |
903 | || DestinationSize == NULL \r | |
904 | || ScratchSize == NULL) {\r | |
905 | return EFI_INVALID_PARAMETER;\r | |
906 | }\r | |
907 | \r | |
ef99a95a | 908 | return TianoDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);\r |
909 | }\r | |
910 | \r | |
911 | EFI_STATUS\r | |
912 | EFIAPI\r | |
913 | DxeMainTianoDecompress (\r | |
914 | IN EFI_TIANO_DECOMPRESS_PROTOCOL *This,\r | |
915 | IN VOID *Source,\r | |
916 | IN UINT32 SourceSize,\r | |
917 | IN OUT VOID *Destination,\r | |
918 | IN UINT32 DestinationSize,\r | |
919 | IN OUT VOID *Scratch,\r | |
920 | IN UINT32 ScratchSize\r | |
921 | )\r | |
922 | {\r | |
923 | EFI_STATUS Status;\r | |
924 | UINT32 TestDestinationSize;\r | |
925 | UINT32 TestScratchSize;\r | |
e2180ee8 | 926 | \r |
927 | if (Source == NULL \r | |
928 | || Destination== NULL \r | |
929 | || Scratch == NULL) {\r | |
930 | return EFI_INVALID_PARAMETER;\r | |
931 | }\r | |
932 | \r | |
ef99a95a | 933 | Status = TianoDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize);\r |
934 | if (EFI_ERROR (Status)) {\r | |
935 | return Status;\r | |
936 | }\r | |
937 | \r | |
938 | if (ScratchSize < TestScratchSize || DestinationSize < TestDestinationSize) {\r | |
939 | return RETURN_INVALID_PARAMETER;\r | |
940 | }\r | |
941 | \r | |
942 | return TianoDecompress (Source, Destination, Scratch);\r | |
943 | }\r | |
944 | \r | |
945 | EFI_STATUS\r | |
946 | DxeMainCustomDecompressGetInfo (\r | |
947 | IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL *This,\r | |
948 | IN VOID *Source,\r | |
949 | IN UINT32 SourceSize,\r | |
950 | OUT UINT32 *DestinationSize,\r | |
951 | OUT UINT32 *ScratchSize\r | |
952 | )\r | |
953 | {\r | |
e2180ee8 | 954 | if (Source == NULL \r |
955 | || DestinationSize == NULL \r | |
956 | || ScratchSize == NULL) {\r | |
957 | return EFI_INVALID_PARAMETER;\r | |
958 | }\r | |
959 | \r | |
ef99a95a | 960 | return CustomDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);\r |
961 | }\r | |
962 | \r | |
963 | EFI_STATUS\r | |
964 | EFIAPI\r | |
965 | DxeMainCustomDecompress (\r | |
966 | IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL *This,\r | |
967 | IN VOID *Source,\r | |
968 | IN UINT32 SourceSize,\r | |
969 | IN OUT VOID *Destination,\r | |
970 | IN UINT32 DestinationSize,\r | |
971 | IN OUT VOID *Scratch,\r | |
972 | IN UINT32 ScratchSize\r | |
973 | )\r | |
974 | {\r | |
975 | EFI_STATUS Status;\r | |
976 | UINT32 TestDestinationSize;\r | |
977 | UINT32 TestScratchSize;\r | |
978 | \r | |
e2180ee8 | 979 | if (Source == NULL \r |
980 | || Destination== NULL \r | |
981 | || Scratch == NULL) {\r | |
982 | return EFI_INVALID_PARAMETER;\r | |
983 | }\r | |
984 | \r | |
ef99a95a | 985 | Status = CustomDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize);\r |
986 | if (EFI_ERROR (Status)) {\r | |
987 | return Status;\r | |
988 | }\r | |
989 | \r | |
990 | if (ScratchSize < TestScratchSize || DestinationSize < TestDestinationSize) {\r | |
991 | return RETURN_INVALID_PARAMETER;\r | |
992 | }\r | |
993 | \r | |
994 | return CustomDecompress (Source, Destination, Scratch);\r | |
995 | }\r | |
996 | \r |