]>
Commit | Line | Data |
---|---|---|
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 | |
a537f148 | 310 | //\r |
311 | // This Tiano extension was removed when UEFI 2.0 support was added. \r | |
312 | // It's now just a protocol.\r | |
313 | //\r | |
ef99a95a | 314 | ,\r |
36122070 | 315 | (EFI_REPORT_STATUS_CODE) CoreEfiNotAvailableYetArg5 // ReportStatusCode\r |
ef99a95a | 316 | #elif (EFI_SPECIFICATION_VERSION >= 0x00020000)\r |
a537f148 | 317 | //\r |
318 | // New runtime services added by UEFI 2.0\r | |
319 | //\r | |
ef99a95a | 320 | ,\r |
321 | (EFI_UPDATE_CAPSULE) CoreEfiNotAvailableYetArg3, // UpdateCapsule\r | |
322 | (EFI_QUERY_CAPSULE_CAPABILITIES) CoreEfiNotAvailableYetArg4, // QueryCapsuleCapabilities\r | |
323 | (EFI_QUERY_VARIABLE_INFO) CoreEfiNotAvailableYetArg4 // QueryVariableInfo\r | |
324 | #endif\r | |
325 | };\r | |
326 | \r | |
327 | //\r | |
328 | // DXE Core Global Variables for the EFI System Table, Boot Services Table, \r | |
329 | // DXE Services Table, and Runtime Services Table\r | |
330 | //\r | |
331 | EFI_BOOT_SERVICES *gBS = &mBootServices;\r | |
332 | EFI_DXE_SERVICES *gDS = &mDxeServices;\r | |
333 | EFI_SYSTEM_TABLE *gST = NULL;\r | |
334 | \r | |
335 | //\r | |
336 | // For debug initialize gRT to template. gRT must be allocated from RT memory\r | |
337 | // but gRT is used for ASSERT () and DEBUG () type macros so lets give it\r | |
338 | // a value that will not cause debug infrastructure to crash early on.\r | |
339 | //\r | |
340 | EFI_RUNTIME_SERVICES *gRT = &mEfiRuntimeServicesTableTemplate;\r | |
341 | EFI_HANDLE gDxeCoreImageHandle = NULL;\r | |
342 | \r | |
343 | VOID *mHobStart;\r | |
344 | \r | |
345 | //\r | |
346 | // EFI Decompress Protocol\r | |
347 | //\r | |
348 | EFI_DECOMPRESS_PROTOCOL gEfiDecompress = {\r | |
349 | DxeMainUefiDecompressGetInfo,\r | |
350 | DxeMainUefiDecompress\r | |
351 | };\r | |
352 | \r | |
353 | //\r | |
354 | // Tiano Decompress Protocol\r | |
355 | //\r | |
356 | EFI_TIANO_DECOMPRESS_PROTOCOL gEfiTianoDecompress = {\r | |
357 | DxeMainTianoDecompressGetInfo,\r | |
358 | DxeMainTianoDecompress\r | |
359 | };\r | |
360 | \r | |
361 | //\r | |
362 | // Customized Decompress Protocol\r | |
363 | //\r | |
364 | EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL gEfiCustomizedDecompress = {\r | |
365 | DxeMainCustomDecompressGetInfo,\r | |
366 | DxeMainCustomDecompress\r | |
367 | };\r | |
368 | \r | |
369 | //\r | |
370 | // Main entry point to the DXE Core\r | |
371 | //\r | |
372 | VOID\r | |
373 | EFIAPI\r | |
374 | DxeMain (\r | |
375 | IN VOID *HobStart\r | |
376 | )\r | |
377 | /*++\r | |
378 | \r | |
379 | Routine Description:\r | |
380 | \r | |
381 | Main entry point to DXE Core.\r | |
382 | \r | |
383 | Arguments:\r | |
384 | \r | |
385 | HobStart - Pointer to the beginning of the HOB List from PEI\r | |
386 | \r | |
387 | Returns:\r | |
388 | \r | |
389 | This function should never return\r | |
390 | \r | |
391 | --*/\r | |
392 | {\r | |
393 | EFI_STATUS Status;\r | |
394 | EFI_PHYSICAL_ADDRESS MemoryBaseAddress;\r | |
395 | UINT64 MemoryLength;\r | |
396 | \r | |
ef99a95a | 397 | mHobStart = HobStart;\r |
398 | \r | |
399 | //\r | |
400 | // Initialize Memory Services\r | |
401 | //\r | |
402 | CoreInitializeMemoryServices (&HobStart, &MemoryBaseAddress, &MemoryLength);\r | |
403 | \r | |
404 | //\r | |
405 | // Allocate the EFI System Table and EFI Runtime Service Table from EfiRuntimeServicesData\r | |
406 | // Use the templates to initialize the contents of the EFI System Table and EFI Runtime Services Table\r | |
407 | //\r | |
408 | gST = CoreAllocateRuntimeCopyPool (sizeof (EFI_SYSTEM_TABLE), &mEfiSystemTableTemplate);\r | |
409 | ASSERT (gST != NULL);\r | |
410 | \r | |
411 | gRT = CoreAllocateRuntimeCopyPool (sizeof (EFI_RUNTIME_SERVICES), &mEfiRuntimeServicesTableTemplate);\r | |
412 | ASSERT (gRT != NULL);\r | |
413 | \r | |
414 | gST->RuntimeServices = gRT;\r | |
415 | \r | |
416 | //\r | |
417 | // Start the Image Services.\r | |
418 | //\r | |
419 | Status = CoreInitializeImageServices (HobStart);\r | |
420 | ASSERT_EFI_ERROR (Status);\r | |
421 | \r | |
422 | //\r | |
423 | // Call constructor for all libraries\r | |
424 | //\r | |
425 | ProcessLibraryConstructorList (gDxeCoreImageHandle, gST);\r | |
217f1d11 | 426 | PERF_END (0,PEI_TOK, NULL, 0) ;\r |
b1288fca | 427 | PERF_START (0,DXE_TOK, NULL, 0) ;\r |
ef99a95a | 428 | \r |
429 | //\r | |
430 | // Initialize the Global Coherency Domain Services\r | |
431 | //\r | |
432 | Status = CoreInitializeGcdServices (&HobStart, MemoryBaseAddress, MemoryLength);\r | |
433 | ASSERT_EFI_ERROR (Status);\r | |
434 | \r | |
435 | //\r | |
436 | // Install the DXE Services Table into the EFI System Tables's Configuration Table\r | |
437 | //\r | |
438 | Status = CoreInstallConfigurationTable (&gEfiDxeServicesTableGuid, gDS);\r | |
439 | ASSERT_EFI_ERROR (Status);\r | |
440 | \r | |
441 | //\r | |
442 | // Install the HOB List into the EFI System Tables's Configuration Table\r | |
443 | //\r | |
444 | Status = CoreInstallConfigurationTable (&gEfiHobListGuid, HobStart);\r | |
445 | ASSERT_EFI_ERROR (Status);\r | |
446 | \r | |
447 | //\r | |
448 | // Install Memory Type Information Table into the EFI System Tables's Configuration Table\r | |
449 | //\r | |
450 | Status = CoreInstallConfigurationTable (&gEfiMemoryTypeInformationGuid, &gMemoryTypeInformation);\r | |
451 | ASSERT_EFI_ERROR (Status);\r | |
452 | \r | |
453 | //\r | |
454 | // Initialize the ReportStatusCode with PEI version, if availible\r | |
455 | //\r | |
456 | CoreGetPeiProtocol (&gEfiStatusCodeRuntimeProtocolGuid, (VOID **)&gStatusCode->ReportStatusCode);\r | |
457 | #if ((EDK_RELEASE_VERSION != 0) && (EFI_SPECIFICATION_VERSION < 0x00020000))\r | |
a537f148 | 458 | //\r |
459 | // This Tiano extension was removed when UEFI 2.0 support was added. \r | |
460 | // It's now just a protocol.\r | |
461 | //\r | |
ef99a95a | 462 | gRT->ReportStatusCode = gStatusCode->ReportStatusCode;\r |
463 | #endif\r | |
464 | \r | |
465 | //\r | |
466 | // Report Status Code here for DXE_ENTRY_POINT once it is available\r | |
467 | //\r | |
468 | CoreReportProgressCode ((EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_ENTRY_POINT));\r | |
469 | \r | |
470 | //\r | |
471 | // Create the aligned system table pointer structure that is used by external\r | |
472 | // debuggers to locate the system table... Also, install debug image info\r | |
473 | // configuration table.\r | |
474 | //\r | |
475 | CoreInitializeDebugImageInfoTable ();\r | |
476 | CoreNewDebugImageInfoEntry (\r | |
477 | EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL,\r | |
478 | gDxeCoreLoadedImage,\r | |
479 | gDxeCoreImageHandle\r | |
480 | );\r | |
481 | \r | |
482 | DEBUG ((EFI_D_INFO | EFI_D_LOAD, "HOBLIST address in DXE = 0x%08x\n", HobStart));\r | |
483 | \r | |
484 | //\r | |
485 | // Initialize the Event Services\r | |
486 | //\r | |
487 | Status = CoreInitializeEventServices ();\r | |
488 | ASSERT_EFI_ERROR (Status);\r | |
489 | \r | |
490 | \r | |
491 | //\r | |
492 | // Get the Protocols that were passed in from PEI to DXE through GUIDed HOBs\r | |
493 | //\r | |
494 | // These Protocols are not architectural. This implementation is sharing code between \r | |
495 | // PEI and DXE in order to save FLASH space. These Protocols could also be implemented \r | |
496 | // as part of the DXE Core. However, that would also require the DXE Core to be ported \r | |
497 | // each time a different CPU is used, a different Decompression algorithm is used, or a \r | |
498 | // different Image type is used. By placing these Protocols in PEI, the DXE Core remains \r | |
499 | // generic, and only PEI and the Arch Protocols need to be ported from Platform to Platform, \r | |
500 | // and from CPU to CPU.\r | |
501 | //\r | |
502 | \r | |
503 | //\r | |
504 | // Publish the EFI, Tiano, and Custom Decompress protocols for use by other DXE components\r | |
505 | // \r | |
506 | Status = CoreInstallMultipleProtocolInterfaces (\r | |
507 | &mDecompressHandle,\r | |
508 | &gEfiDecompressProtocolGuid, &gEfiDecompress,\r | |
509 | &gEfiTianoDecompressProtocolGuid, &gEfiTianoDecompress,\r | |
510 | &gEfiCustomizedDecompressProtocolGuid, &gEfiCustomizedDecompress,\r | |
511 | NULL\r | |
512 | );\r | |
513 | ASSERT_EFI_ERROR (Status);\r | |
514 | \r | |
515 | gEfiPeiPeCoffLoader = GetPeCoffLoaderProtocol ();\r | |
516 | ASSERT (gEfiPeiPeCoffLoader != NULL);\r | |
517 | \r | |
518 | //\r | |
519 | // Register for the GUIDs of the Architectural Protocols, so the rest of the\r | |
520 | // EFI Boot Services and EFI Runtime Services tables can be filled in.\r | |
521 | //\r | |
522 | CoreNotifyOnArchProtocolInstallation ();\r | |
523 | \r | |
524 | //\r | |
525 | // Produce Firmware Volume Protocols, one for each FV in the HOB list.\r | |
526 | //\r | |
527 | Status = FwVolBlockDriverInit (gDxeCoreImageHandle, gST);\r | |
528 | ASSERT_EFI_ERROR (Status);\r | |
529 | \r | |
530 | Status = FwVolDriverInit (gDxeCoreImageHandle, gST);\r | |
531 | ASSERT_EFI_ERROR (Status);\r | |
532 | \r | |
533 | //\r | |
534 | // Produce the Section Extraction Protocol \r | |
535 | //\r | |
536 | Status = InitializeSectionExtraction (gDxeCoreImageHandle, gST);\r | |
537 | ASSERT_EFI_ERROR (Status);\r | |
538 | \r | |
539 | //\r | |
540 | // Initialize the DXE Dispatcher\r | |
541 | //\r | |
542 | PERF_START (0,"CoreInitializeDispatcher", "DxeMain", 0) ;\r | |
543 | CoreInitializeDispatcher ();\r | |
544 | PERF_END (0,"CoreInitializeDispatcher", "DxeMain", 0) ;\r | |
545 | \r | |
546 | //\r | |
547 | // Invoke the DXE Dispatcher\r | |
548 | //\r | |
549 | PERF_START (0, "CoreDispatcher", "DxeMain", 0);\r | |
550 | CoreDispatcher ();\r | |
551 | PERF_END (0, "CoreDispatcher", "DxeMain", 0);\r | |
552 | \r | |
553 | //\r | |
554 | // Display Architectural protocols that were not loaded if this is DEBUG build\r | |
555 | //\r | |
2ce31132 | 556 | DEBUG_CODE_BEGIN ();\r |
ef99a95a | 557 | CoreDisplayMissingArchProtocols ();\r |
2ce31132 | 558 | DEBUG_CODE_END ();\r |
ef99a95a | 559 | \r |
560 | //\r | |
561 | // Assert if the Architectural Protocols are not present.\r | |
562 | //\r | |
563 | ASSERT_EFI_ERROR (CoreAllEfiServicesAvailable ());\r | |
564 | \r | |
565 | //\r | |
566 | // Report Status code before transfer control to BDS\r | |
567 | //\r | |
568 | CoreReportProgressCode ((EFI_SOFTWARE_DXE_CORE | EFI_SW_DXE_CORE_PC_HANDOFF_TO_NEXT));\r | |
569 | //\r | |
570 | // Display any drivers that were not dispatched because dependency expression\r | |
571 | // evaluated to false if this is a debug build\r | |
572 | //\r | |
2ce31132 | 573 | DEBUG_CODE_BEGIN ();\r |
ef99a95a | 574 | CoreDisplayDiscoveredNotDispatched ();\r |
2ce31132 | 575 | DEBUG_CODE_END ();\r |
ef99a95a | 576 | \r |
577 | //\r | |
578 | // Transfer control to the BDS Architectural Protocol\r | |
579 | //\r | |
580 | gBds->Entry (gBds);\r | |
581 | \r | |
582 | //\r | |
583 | // BDS should never return\r | |
584 | //\r | |
585 | ASSERT (FALSE);\r | |
586 | CpuDeadLoop ();\r | |
587 | }\r | |
588 | \r | |
589 | \r | |
590 | EFI_STATUS\r | |
591 | EFIAPI\r | |
592 | CoreEfiNotAvailableYetArg0 (\r | |
593 | VOID\r | |
594 | )\r | |
595 | /*++\r | |
596 | \r | |
597 | Routine Description:\r | |
598 | \r | |
599 | Place holder function until all the Boot Services and Runtime Services are available\r | |
600 | \r | |
601 | Arguments:\r | |
602 | \r | |
603 | None\r | |
604 | \r | |
605 | Returns:\r | |
606 | \r | |
607 | EFI_NOT_AVAILABLE_YET\r | |
608 | \r | |
609 | --*/\r | |
610 | {\r | |
611 | //\r | |
612 | // This function should never be executed. If it does, then the architectural protocols\r | |
613 | // have not been designed correctly. The CpuBreakpoint () is commented out for now until the\r | |
614 | // DXE Core and all the Architectural Protocols are complete.\r | |
615 | //\r | |
616 | \r | |
617 | return EFI_NOT_AVAILABLE_YET;\r | |
618 | }\r | |
619 | \r | |
620 | EFI_STATUS\r | |
621 | EFIAPI\r | |
622 | CoreEfiNotAvailableYetArg1 (\r | |
623 | UINTN Arg1\r | |
624 | )\r | |
625 | /*++\r | |
626 | \r | |
627 | Routine Description:\r | |
628 | \r | |
629 | Place holder function until all the Boot Services and Runtime Services are available\r | |
630 | \r | |
631 | Arguments:\r | |
632 | \r | |
633 | Arg1 - Undefined\r | |
634 | \r | |
635 | Returns:\r | |
636 | \r | |
637 | EFI_NOT_AVAILABLE_YET\r | |
638 | \r | |
639 | --*/\r | |
640 | {\r | |
641 | //\r | |
642 | // This function should never be executed. If it does, then the architectural protocols\r | |
643 | // have not been designed correctly. The CpuBreakpoint () is commented out for now until the\r | |
644 | // DXE Core and all the Architectural Protocols are complete.\r | |
645 | //\r | |
646 | \r | |
647 | return EFI_NOT_AVAILABLE_YET;\r | |
648 | }\r | |
649 | \r | |
650 | EFI_STATUS\r | |
651 | EFIAPI\r | |
652 | CoreEfiNotAvailableYetArg2 (\r | |
653 | UINTN Arg1,\r | |
654 | UINTN Arg2\r | |
655 | )\r | |
656 | /*++\r | |
657 | \r | |
658 | Routine Description:\r | |
659 | \r | |
660 | Place holder function until all the Boot Services and Runtime Services are available\r | |
661 | \r | |
662 | Arguments:\r | |
663 | \r | |
664 | Arg1 - Undefined\r | |
665 | \r | |
666 | Arg2 - Undefined\r | |
667 | \r | |
668 | Returns:\r | |
669 | \r | |
670 | EFI_NOT_AVAILABLE_YET\r | |
671 | \r | |
672 | --*/\r | |
673 | {\r | |
674 | //\r | |
675 | // This function should never be executed. If it does, then the architectural protocols\r | |
676 | // have not been designed correctly. The CpuBreakpoint () is commented out for now until the\r | |
677 | // DXE Core and all the Architectural Protocols are complete.\r | |
678 | //\r | |
679 | \r | |
680 | return EFI_NOT_AVAILABLE_YET;\r | |
681 | }\r | |
682 | \r | |
683 | EFI_STATUS\r | |
684 | EFIAPI\r | |
685 | CoreEfiNotAvailableYetArg3 (\r | |
686 | UINTN Arg1,\r | |
687 | UINTN Arg2,\r | |
688 | UINTN Arg3\r | |
689 | )\r | |
690 | /*++\r | |
691 | \r | |
692 | Routine Description:\r | |
693 | \r | |
694 | Place holder function until all the Boot Services and Runtime Services are available\r | |
695 | \r | |
696 | Arguments:\r | |
697 | \r | |
698 | Arg1 - Undefined\r | |
699 | \r | |
700 | Arg2 - Undefined\r | |
701 | \r | |
702 | Arg3 - Undefined\r | |
703 | \r | |
704 | Returns:\r | |
705 | \r | |
706 | EFI_NOT_AVAILABLE_YET\r | |
707 | \r | |
708 | --*/\r | |
709 | {\r | |
710 | //\r | |
711 | // This function should never be executed. If it does, then the architectural protocols\r | |
712 | // have not been designed correctly. The CpuBreakpoint () is commented out for now until the\r | |
713 | // DXE Core and all the Architectural Protocols are complete.\r | |
714 | //\r | |
715 | \r | |
716 | return EFI_NOT_AVAILABLE_YET;\r | |
717 | }\r | |
718 | \r | |
719 | EFI_STATUS\r | |
720 | EFIAPI\r | |
721 | CoreEfiNotAvailableYetArg4 (\r | |
722 | UINTN Arg1,\r | |
723 | UINTN Arg2,\r | |
724 | UINTN Arg3,\r | |
725 | UINTN Arg4\r | |
726 | )\r | |
727 | /*++\r | |
728 | \r | |
729 | Routine Description:\r | |
730 | \r | |
731 | Place holder function until all the Boot Services and Runtime Services are available\r | |
732 | \r | |
733 | Arguments:\r | |
734 | \r | |
735 | Arg1 - Undefined\r | |
736 | \r | |
737 | Arg2 - Undefined\r | |
738 | \r | |
739 | Arg3 - Undefined\r | |
740 | \r | |
741 | Arg4 - Undefined\r | |
742 | \r | |
743 | Returns:\r | |
744 | \r | |
745 | EFI_NOT_AVAILABLE_YET\r | |
746 | \r | |
747 | --*/\r | |
748 | {\r | |
749 | //\r | |
750 | // This function should never be executed. If it does, then the architectural protocols\r | |
751 | // have not been designed correctly. The CpuBreakpoint () is commented out for now until the\r | |
752 | // DXE Core and all the Architectural Protocols are complete.\r | |
753 | //\r | |
754 | \r | |
755 | return EFI_NOT_AVAILABLE_YET;\r | |
756 | }\r | |
757 | \r | |
758 | EFI_STATUS\r | |
759 | EFIAPI\r | |
760 | CoreEfiNotAvailableYetArg5 (\r | |
761 | UINTN Arg1,\r | |
762 | UINTN Arg2,\r | |
763 | UINTN Arg3,\r | |
764 | UINTN Arg4,\r | |
765 | UINTN Arg5\r | |
766 | )\r | |
767 | /*++\r | |
768 | \r | |
769 | Routine Description:\r | |
770 | \r | |
771 | Place holder function until all the Boot Services and Runtime Services are available\r | |
772 | \r | |
773 | Arguments:\r | |
774 | \r | |
775 | Arg1 - Undefined\r | |
776 | \r | |
777 | Arg2 - Undefined\r | |
778 | \r | |
779 | Arg3 - Undefined\r | |
780 | \r | |
781 | Arg4 - Undefined\r | |
782 | \r | |
783 | Arg5 - Undefined\r | |
784 | \r | |
785 | Returns:\r | |
786 | \r | |
787 | EFI_NOT_AVAILABLE_YET\r | |
788 | \r | |
789 | --*/\r | |
790 | {\r | |
791 | //\r | |
792 | // This function should never be executed. If it does, then the architectural protocols\r | |
793 | // have not been designed correctly. The CpuBreakpoint () is commented out for now until the\r | |
794 | // DXE Core and all the Architectural Protocols are complete.\r | |
795 | //\r | |
796 | \r | |
797 | return EFI_NOT_AVAILABLE_YET;\r | |
798 | }\r | |
799 | \r | |
800 | \r | |
801 | EFI_STATUS\r | |
802 | CoreGetPeiProtocol (\r | |
803 | IN EFI_GUID *ProtocolGuid,\r | |
804 | IN VOID **Interface\r | |
805 | )\r | |
806 | /*++\r | |
807 | \r | |
808 | Routine Description:\r | |
809 | \r | |
810 | Searches for a Protocol Interface passed from PEI through a HOB\r | |
811 | \r | |
812 | Arguments:\r | |
813 | \r | |
814 | ProtocolGuid - The Protocol GUID to search for in the HOB List\r | |
815 | \r | |
816 | Interface - A pointer to the interface for the Protocol GUID\r | |
817 | \r | |
818 | Returns:\r | |
819 | \r | |
820 | EFI_SUCCESS - The Protocol GUID was found and its interface is returned in Interface\r | |
821 | \r | |
822 | EFI_NOT_FOUND - The Protocol GUID was not found in the HOB List\r | |
823 | \r | |
824 | --*/\r | |
825 | {\r | |
826 | EFI_HOB_GUID_TYPE *GuidHob;\r | |
827 | VOID *Buffer;\r | |
828 | \r | |
829 | GuidHob = GetNextGuidHob (ProtocolGuid, mHobStart);\r | |
830 | if (GuidHob == NULL) {\r | |
831 | return EFI_NOT_FOUND;\r | |
832 | }\r | |
833 | \r | |
834 | Buffer = GET_GUID_HOB_DATA (GuidHob);\r | |
835 | ASSERT (Buffer != NULL);\r | |
836 | \r | |
837 | *Interface = (VOID *)(*(UINTN *)(Buffer));\r | |
838 | \r | |
839 | return EFI_SUCCESS;\r | |
840 | }\r | |
841 | \r | |
842 | \r | |
843 | VOID\r | |
844 | CalculateEfiHdrCrc (\r | |
845 | IN OUT EFI_TABLE_HEADER *Hdr\r | |
846 | )\r | |
847 | /*++\r | |
848 | \r | |
849 | Routine Description:\r | |
850 | \r | |
851 | Calcualte the 32-bit CRC in a EFI table using the service provided by the\r | |
852 | gRuntime service.\r | |
853 | \r | |
854 | Arguments:\r | |
855 | \r | |
856 | Hdr - Pointer to an EFI standard header\r | |
857 | \r | |
858 | Returns:\r | |
859 | \r | |
860 | None\r | |
861 | \r | |
862 | --*/\r | |
863 | {\r | |
864 | UINT32 Crc;\r | |
865 | \r | |
866 | Hdr->CRC32 = 0;\r | |
867 | \r | |
868 | //\r | |
869 | // If gBS->CalculateCrce32 () == CoreEfiNotAvailableYet () then\r | |
870 | // Crc will come back as zero if we set it to zero here\r | |
871 | //\r | |
872 | Crc = 0;\r | |
873 | gBS->CalculateCrc32 ((UINT8 *)Hdr, Hdr->HeaderSize, &Crc);\r | |
874 | Hdr->CRC32 = Crc; \r | |
875 | }\r | |
876 | \r | |
877 | \r | |
878 | \r | |
879 | EFI_STATUS\r | |
880 | EFIAPI\r | |
881 | CoreExitBootServices (\r | |
882 | IN EFI_HANDLE ImageHandle,\r | |
883 | IN UINTN MapKey\r | |
884 | )\r | |
885 | /*++\r | |
886 | \r | |
887 | Routine Description:\r | |
888 | \r | |
889 | EFI 1.0 API to terminate Boot Services\r | |
890 | \r | |
891 | Arguments:\r | |
892 | \r | |
893 | ImageHandle - Handle that represents the identity of the calling image\r | |
894 | \r | |
895 | MapKey -Key to the latest memory map.\r | |
896 | \r | |
897 | Returns:\r | |
898 | \r | |
899 | EFI_SUCCESS - Boot Services terminated\r | |
900 | EFI_INVALID_PARAMETER - MapKey is incorrect.\r | |
901 | \r | |
902 | --*/\r | |
903 | {\r | |
904 | EFI_STATUS Status;\r | |
905 | \r | |
906 | //\r | |
907 | // Terminate memory services if the MapKey matches\r | |
908 | //\r | |
909 | Status = CoreTerminateMemoryMap (MapKey);\r | |
910 | if (EFI_ERROR (Status)) {\r | |
911 | return Status;\r | |
912 | }\r | |
913 | \r | |
914 | //\r | |
915 | // Notify other drivers that we are exiting boot services.\r | |
916 | //\r | |
917 | CoreNotifySignalList (&gEfiEventExitBootServicesGuid);\r | |
918 | \r | |
919 | //\r | |
920 | // Disable Timer\r | |
921 | //\r | |
922 | gTimer->SetTimerPeriod (gTimer, 0);\r | |
923 | \r | |
924 | //\r | |
925 | // Disable CPU Interrupts\r | |
926 | //\r | |
927 | gCpu->DisableInterrupt (gCpu);\r | |
928 | \r | |
929 | //\r | |
930 | // Register Runtime events with the Runtime Architectural Protocol\r | |
931 | //\r | |
932 | CoreShutdownEventServices ();\r | |
933 | \r | |
934 | //\r | |
935 | // Register Runtime images with the Runtime Architectural Protocol\r | |
936 | //\r | |
937 | CoreShutdownImageServices ();\r | |
938 | \r | |
939 | //\r | |
940 | // Report that ExitBootServices() has been called\r | |
941 | //\r | |
942 | // We are using gEfiDxeServicesTableGuid as the caller ID for Dxe Core\r | |
943 | //\r | |
944 | CoreReportProgressCode ((EFI_SOFTWARE_EFI_BOOT_SERVICE | EFI_SW_BS_PC_EXIT_BOOT_SERVICES));\r | |
945 | \r | |
946 | //\r | |
947 | // Clear the non-runtime values of the EFI System Table\r | |
948 | //\r | |
949 | gST->BootServices = NULL;\r | |
950 | gST->ConIn = NULL;\r | |
951 | gST->ConsoleInHandle = NULL;\r | |
952 | gST->ConOut = NULL;\r | |
953 | gST->ConsoleOutHandle = NULL;\r | |
954 | gST->StdErr = NULL;\r | |
955 | gST->StandardErrorHandle = NULL;\r | |
956 | \r | |
957 | //\r | |
958 | // Recompute the 32-bit CRC of the EFI System Table\r | |
959 | //\r | |
960 | CalculateEfiHdrCrc (&gST->Hdr);\r | |
961 | \r | |
962 | //\r | |
963 | // Zero out the Boot Service Table\r | |
964 | //\r | |
965 | SetMem (gBS, sizeof (EFI_BOOT_SERVICES), 0);\r | |
966 | gBS = NULL;\r | |
967 | \r | |
968 | return Status;\r | |
969 | }\r | |
970 | \r | |
971 | EFI_STATUS\r | |
972 | DxeMainUefiDecompressGetInfo (\r | |
973 | IN EFI_DECOMPRESS_PROTOCOL *This,\r | |
974 | IN VOID *Source,\r | |
975 | IN UINT32 SourceSize,\r | |
976 | OUT UINT32 *DestinationSize,\r | |
977 | OUT UINT32 *ScratchSize\r | |
978 | )\r | |
979 | {\r | |
980 | return UefiDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);\r | |
981 | }\r | |
982 | \r | |
983 | EFI_STATUS\r | |
984 | EFIAPI\r | |
985 | DxeMainUefiDecompress (\r | |
986 | IN EFI_DECOMPRESS_PROTOCOL *This,\r | |
987 | IN VOID *Source,\r | |
988 | IN UINT32 SourceSize,\r | |
989 | IN OUT VOID *Destination,\r | |
990 | IN UINT32 DestinationSize,\r | |
991 | IN OUT VOID *Scratch,\r | |
992 | IN UINT32 ScratchSize\r | |
993 | )\r | |
994 | {\r | |
995 | EFI_STATUS Status;\r | |
996 | UINT32 TestDestinationSize;\r | |
997 | UINT32 TestScratchSize;\r | |
998 | \r | |
999 | Status = UefiDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize);\r | |
1000 | if (EFI_ERROR (Status)) {\r | |
1001 | return Status;\r | |
1002 | }\r | |
1003 | \r | |
1004 | if (ScratchSize < TestScratchSize || DestinationSize < TestDestinationSize) {\r | |
1005 | return RETURN_INVALID_PARAMETER;\r | |
1006 | }\r | |
1007 | \r | |
1008 | return UefiDecompress (Source, Destination, Scratch);\r | |
1009 | }\r | |
1010 | \r | |
1011 | EFI_STATUS\r | |
1012 | DxeMainTianoDecompressGetInfo (\r | |
1013 | IN EFI_TIANO_DECOMPRESS_PROTOCOL *This,\r | |
1014 | IN VOID *Source,\r | |
1015 | IN UINT32 SourceSize,\r | |
1016 | OUT UINT32 *DestinationSize,\r | |
1017 | OUT UINT32 *ScratchSize\r | |
1018 | )\r | |
1019 | {\r | |
1020 | return TianoDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);\r | |
1021 | }\r | |
1022 | \r | |
1023 | EFI_STATUS\r | |
1024 | EFIAPI\r | |
1025 | DxeMainTianoDecompress (\r | |
1026 | IN EFI_TIANO_DECOMPRESS_PROTOCOL *This,\r | |
1027 | IN VOID *Source,\r | |
1028 | IN UINT32 SourceSize,\r | |
1029 | IN OUT VOID *Destination,\r | |
1030 | IN UINT32 DestinationSize,\r | |
1031 | IN OUT VOID *Scratch,\r | |
1032 | IN UINT32 ScratchSize\r | |
1033 | )\r | |
1034 | {\r | |
1035 | EFI_STATUS Status;\r | |
1036 | UINT32 TestDestinationSize;\r | |
1037 | UINT32 TestScratchSize;\r | |
1038 | \r | |
1039 | Status = TianoDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize);\r | |
1040 | if (EFI_ERROR (Status)) {\r | |
1041 | return Status;\r | |
1042 | }\r | |
1043 | \r | |
1044 | if (ScratchSize < TestScratchSize || DestinationSize < TestDestinationSize) {\r | |
1045 | return RETURN_INVALID_PARAMETER;\r | |
1046 | }\r | |
1047 | \r | |
1048 | return TianoDecompress (Source, Destination, Scratch);\r | |
1049 | }\r | |
1050 | \r | |
1051 | EFI_STATUS\r | |
1052 | DxeMainCustomDecompressGetInfo (\r | |
1053 | IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL *This,\r | |
1054 | IN VOID *Source,\r | |
1055 | IN UINT32 SourceSize,\r | |
1056 | OUT UINT32 *DestinationSize,\r | |
1057 | OUT UINT32 *ScratchSize\r | |
1058 | )\r | |
1059 | {\r | |
1060 | return CustomDecompressGetInfo (Source, SourceSize, DestinationSize, ScratchSize);\r | |
1061 | }\r | |
1062 | \r | |
1063 | EFI_STATUS\r | |
1064 | EFIAPI\r | |
1065 | DxeMainCustomDecompress (\r | |
1066 | IN EFI_CUSTOMIZED_DECOMPRESS_PROTOCOL *This,\r | |
1067 | IN VOID *Source,\r | |
1068 | IN UINT32 SourceSize,\r | |
1069 | IN OUT VOID *Destination,\r | |
1070 | IN UINT32 DestinationSize,\r | |
1071 | IN OUT VOID *Scratch,\r | |
1072 | IN UINT32 ScratchSize\r | |
1073 | )\r | |
1074 | {\r | |
1075 | EFI_STATUS Status;\r | |
1076 | UINT32 TestDestinationSize;\r | |
1077 | UINT32 TestScratchSize;\r | |
1078 | \r | |
1079 | Status = CustomDecompressGetInfo (Source, SourceSize, &TestDestinationSize, &TestScratchSize);\r | |
1080 | if (EFI_ERROR (Status)) {\r | |
1081 | return Status;\r | |
1082 | }\r | |
1083 | \r | |
1084 | if (ScratchSize < TestScratchSize || DestinationSize < TestDestinationSize) {\r | |
1085 | return RETURN_INVALID_PARAMETER;\r | |
1086 | }\r | |
1087 | \r | |
1088 | return CustomDecompress (Source, Destination, Scratch);\r | |
1089 | }\r | |
1090 | \r |