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