]> git.proxmox.com Git - mirror_edk2.git/blame - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/EntryPoints/EdkIIGlueDxeDriverEntryPoint.c
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / EntryPoints / EdkIIGlueDxeDriverEntryPoint.c
CommitLineData
3eb9473e 1/*++\r
2\r
2c7e5c2f
HT
3Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>\r
4This program and the accompanying materials \r
3eb9473e 5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12\r
13Module Name:\r
14\r
15 EdkIIGlueDxeDriverEntryPoint.c\r
16 \r
17Abstract: \r
18\r
19 DXE Driver entry point template file\r
20\r
21--*/\r
22\r
23#include "EdkIIGlueDxe.h"\r
24#include "Common/EdkIIGlueDependencies.h"\r
25\r
26STATIC EFI_EVENT _mDriverExitBootServicesNotifyEvent;\r
27\r
28//\r
29// Driver Model related definitions.\r
30// LIMITATION: only support one instance of Driver Model protocols per driver.\r
31// In case where multiple Driver Model protocols need to be installed in a single driver,\r
32// manually edit this file and compile/link the modified file with the driver.\r
33//\r
34\r
35#ifdef __EDKII_GLUE_DRIVER_BINDING_PROTOCOL_INSTANCE__\r
36extern EFI_DRIVER_BINDING_PROTOCOL __EDKII_GLUE_DRIVER_BINDING_PROTOCOL_INSTANCE__;\r
37#endif\r
38\r
39#ifdef __EDKII_GLUE_COMPONENT_NAME_PROTOCOL_INSTANCE__\r
40#if (EFI_SPECIFICATION_VERSION >= 0x00020000)\r
41extern EFI_COMPONENT_NAME2_PROTOCOL __EDKII_GLUE_COMPONENT_NAME_PROTOCOL_INSTANCE__;\r
42#else\r
43extern EFI_COMPONENT_NAME_PROTOCOL __EDKII_GLUE_COMPONENT_NAME_PROTOCOL_INSTANCE__;\r
44#endif\r
45#endif\r
46\r
47#ifdef __EDKII_GLUE_DRIVER_CONFIGURATION_PROTOCOL_INSTANCE__\r
48extern EFI_DRIVER_CONFIGURATION_PROTOCOL __EDKII_GLUE_DRIVER_CONFIGURATION_PROTOCOL_INSTANCE__;\r
49#endif\r
50\r
51#ifdef __EDKII_GLUE_DRIVER_DIAGNOSTICS_PROTOCOL_INSTANCE__\r
52extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL __EDKII_GLUE_DRIVER_DIAGNOSTICS_PROTOCOL_INSTANCE__;\r
53#endif\r
54\r
55GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DRIVER_MODEL_PROTOCOL_LIST _gDriverModelProtocolList[] = {\r
56 {\r
57#ifdef __EDKII_GLUE_DRIVER_BINDING_PROTOCOL_INSTANCE__\r
58 &__EDKII_GLUE_DRIVER_BINDING_PROTOCOL_INSTANCE__,\r
59#else\r
60 NULL,\r
61#endif\r
62\r
63#ifdef __EDKII_GLUE_COMPONENT_NAME_PROTOCOL_INSTANCE__\r
64 &__EDKII_GLUE_COMPONENT_NAME_PROTOCOL_INSTANCE__,\r
65#else\r
66 NULL,\r
67#endif\r
68\r
69#ifdef __EDKII_GLUE_DRIVER_CONFIGURATION_PROTOCOL_INSTANCE__\r
70 &__EDKII_GLUE_DRIVER_CONFIGURATION_PROTOCOL_INSTANCE__,\r
71#else\r
72 NULL,\r
73#endif\r
74\r
75#ifdef __EDKII_GLUE_DRIVER_DIAGNOSTICS_PROTOCOL_INSTANCE__\r
76 &__EDKII_GLUE_DRIVER_DIAGNOSTICS_PROTOCOL_INSTANCE__,\r
77#else\r
78 NULL,\r
79#endif\r
80 }\r
81};\r
82\r
83//\r
84// NOTE: Limitation:\r
85// Only one handler for SetVirtualAddressMap Event and ExitBootServices Event each\r
86//\r
c7f33ca4 87\r
88/*\r
89 * This is the WRONG macro and it's kept only for backward compatibility.\r
90 */\r
91#ifdef __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT__HANDLER__\r
92VOID\r
93EFIAPI\r
94__EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT__HANDLER__ (\r
95 IN EFI_EVENT Event,\r
96 IN VOID *Context\r
97 );\r
98#endif\r
99\r
100/*\r
101 * This is the CORRECT macro users should use.\r
102 */ \r
3eb9473e 103#ifdef __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__\r
104VOID\r
c7f33ca4 105EFIAPI\r
3eb9473e 106__EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__ (\r
107 IN EFI_EVENT Event,\r
108 IN VOID *Context\r
109 );\r
110#endif\r
111\r
c7f33ca4 112/*\r
113 * Both __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT__HANDLER__ and \r
114 * __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__ are kept here although\r
115 * the former is a WRONG macro. It's kept only for backward compatibility.\r
116 * For a single module, it's not likely that both macros are defined.\r
117 */\r
3eb9473e 118GLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {\r
c7f33ca4 119#ifdef __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT__HANDLER__\r
120 __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT__HANDLER__,\r
121#endif\r
122\r
3eb9473e 123#ifdef __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__\r
124 __EDKII_GLUE_SET_VIRTUAL_ADDRESS_MAP_EVENT_HANDLER__,\r
125#endif\r
c7f33ca4 126\r
3eb9473e 127 NULL\r
128};\r
129\r
c7f33ca4 130/*\r
131 * This is the WRONG macro and it's kept only for backward compatibility.\r
132 */\r
133#ifdef __EDKII_GLUE_EXTI_BOOT_SERVICES_EVENT__HANDLER__\r
134VOID\r
135__EDKII_GLUE_EXTI_BOOT_SERVICES_EVENT__HANDLER__ (\r
136 IN EFI_EVENT Event,\r
137 IN VOID *Context\r
138 );\r
139#endif\r
140\r
141/*\r
142 * This is the CORRECT macro users should use.\r
143 */\r
3eb9473e 144#ifdef __EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__\r
145VOID\r
146__EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__ (\r
147 IN EFI_EVENT Event,\r
148 IN VOID *Context\r
149 );\r
150#endif\r
151\r
152/**\r
153 Set AtRuntime flag as TRUE after ExitBootServices\r
154 \r
155 @param[in] Event The Event that is being processed\r
156 @param[in] Context Event Context\r
157**/\r
158VOID\r
159EFIAPI\r
160RuntimeDriverExitBootServices (\r
161 IN EFI_EVENT Event,\r
162 IN VOID *Context\r
163 );\r
164\r
c7f33ca4 165\r
166/*\r
167 * Both __EDKII_GLUE_EXTI_BOOT_SERVICES_EVENT__HANDLER__ and \r
168 * __EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__ are kept here although\r
169 * the former is a WRONG macro. It's kept only for backward compatibility.\r
170 * For a single module, it's not likely that both macros are defined.\r
171 */\r
3eb9473e 172GLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {\r
173#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__ \r
174 //\r
175 // only Runtime drivers need to link EdkDxeRuntimeDriverLib\r
176 //\r
177 RuntimeDriverExitBootServices,\r
178#endif\r
c7f33ca4 179 \r
180#ifdef __EDKII_GLUE_EXTI_BOOT_SERVICES_EVENT__HANDLER__\r
181 __EDKII_GLUE_EXTI_BOOT_SERVICES_EVENT__HANDLER__,\r
182#endif\r
183\r
3eb9473e 184#ifdef __EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__\r
185 __EDKII_GLUE_EXIT_BOOT_SERVICES_EVENT_HANDLER__,\r
186#endif\r
c7f33ca4 187\r
3eb9473e 188 NULL\r
189};\r
190\r
191\r
192//\r
193// Module Unload Handler\r
194//\r
195\r
196#ifdef __EDKII_GLUE_MODULE_UNLOAD_HANDLER__\r
197EFI_STATUS\r
198EFIAPI\r
199__EDKII_GLUE_MODULE_UNLOAD_HANDLER__ (\r
200 EFI_HANDLE ImageHandle\r
201 );\r
202#endif\r
203\r
204EFI_STATUS\r
205EFIAPI\r
206ProcessModuleUnloadList (\r
207 EFI_HANDLE ImageHandle\r
208 )\r
209{\r
210#ifdef __EDKII_GLUE_MODULE_UNLOAD_HANDLER__\r
211 return (__EDKII_GLUE_MODULE_UNLOAD_HANDLER__ (ImageHandle));\r
212#else\r
213 return EFI_SUCCESS;\r
214#endif\r
215}\r
216\r
217#ifdef __EDKII_GLUE_EFI_CALLER_ID_GUID__\r
218 GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiCallerIdGuid = __EDKII_GLUE_EFI_CALLER_ID_GUID__;\r
219#endif\r
220\r
221//\r
222// Library constructors\r
223//\r
224VOID\r
c7f33ca4 225EFIAPI\r
3eb9473e 226ProcessLibraryConstructorList (\r
227 IN EFI_HANDLE ImageHandle,\r
228 IN EFI_SYSTEM_TABLE *SystemTable\r
229 )\r
230{\r
231//\r
232// Declare "Status" if any of the following libraries are used\r
233//\r
234#if defined(__EDKII_GLUE_DXE_HOB_LIB__) \\r
235 || defined(__EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__) \\r
236 || defined(__EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__) \\r
237 || defined(__EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__) \\r
238 || defined(__EDKII_GLUE_DXE_SERVICES_TABLE_LIB__) \\r
239 || defined(__EDKII_GLUE_DXE_SMBUS_LIB__) \\r
240 || defined(__EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__) \\r
241 || defined(__EDKII_GLUE_EDK_DXE_SAL_LIB__) \\r
b56111f4
LG
242 || defined(__EDKII_GLUE_DXE_IO_LIB_CPU_IO__) \\r
243 || defined(__EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__)\r
3eb9473e 244 EFI_STATUS Status;\r
245#endif\r
246\r
247//\r
248// EdkII Glue Library Constructors: \r
249// NOTE: the constructors must be called according to dependency order\r
250//\r
251// UefiBootServicesTableLib UefiBootServicesTableLibConstructor()\r
252// DxeIoLibCpuIo IoLibConstructor()\r
253// DxeSalLib DxeSalLibConstructor(), IPF only\r
254// EdkDxeRuntimeDriverLib RuntimeDriverLibConstruct()\r
255// DxeHobLib HobLibConstructor()\r
256// UefiDriverModelLib UefiDriverModelLibConstructor()\r
257// DxeSmbusLib SmbusLibConstructor() \r
258// DxeServicesTableLib DxeServicesTableLibConstructor()\r
259// UefiRuntimeServicesTableLib UefiRuntimeServicesTableLibConstructor() \r
b56111f4 260// SmmRuntimeDxeReportStatusCodeLib ReportStatusCodeLibConstruct()\r
3eb9473e 261// \r
262\r
263#ifdef __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\r
264 Status = UefiBootServicesTableLibConstructor (ImageHandle, SystemTable);\r
265 ASSERT_EFI_ERROR (Status);\r
266#endif\r
267\r
268#ifdef __EDKII_GLUE_DXE_IO_LIB_CPU_IO__\r
269 Status = IoLibConstructor (ImageHandle, SystemTable);\r
270 ASSERT_EFI_ERROR (Status);\r
271#endif\r
272\r
273#ifdef __EDKII_GLUE_EDK_DXE_SAL_LIB__\r
274 Status = DxeSalLibConstructor(ImageHandle, SystemTable);\r
275 ASSERT_EFI_ERROR (Status);\r
276#endif\r
277\r
278#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__\r
279 Status = RuntimeDriverLibConstruct (ImageHandle, SystemTable);\r
280 ASSERT_EFI_ERROR (Status);\r
281#endif\r
282\r
283#ifdef __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__\r
284 Status = UefiRuntimeServicesTableLibConstructor (ImageHandle, SystemTable);\r
285 ASSERT_EFI_ERROR (Status);\r
286#endif\r
287\r
288#ifdef __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__\r
289 Status = UefiDriverModelLibConstructor (ImageHandle, SystemTable);\r
290 ASSERT_EFI_ERROR (Status);\r
291#endif\r
292\r
293#ifdef __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__\r
294 Status = DxeServicesTableLibConstructor (ImageHandle, SystemTable);\r
295 ASSERT_EFI_ERROR (Status); \r
296#endif\r
297\r
b56111f4
LG
298#ifdef __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__\r
299 Status = ReportStatusCodeLibConstruct (ImageHandle, SystemTable);\r
300 ASSERT_EFI_ERROR (Status);\r
301#endif\r
302\r
3eb9473e 303#ifdef __EDKII_GLUE_DXE_HOB_LIB__\r
304 Status = HobLibConstructor (ImageHandle, SystemTable);\r
305 ASSERT_EFI_ERROR (Status);\r
306#endif\r
307\r
308#ifdef __EDKII_GLUE_DXE_SMBUS_LIB__\r
309 Status = SmbusLibConstructor (ImageHandle, SystemTable);\r
310 ASSERT_EFI_ERROR (Status);\r
311#endif\r
312\r
313}\r
314\r
315//\r
316// Library Destructors\r
317//\r
318VOID\r
c7f33ca4 319EFIAPI\r
3eb9473e 320ProcessLibraryDestructorList (\r
321 IN EFI_HANDLE ImageHandle,\r
322 IN EFI_SYSTEM_TABLE *SystemTable\r
323 )\r
324{\r
b56111f4
LG
325#if defined (__EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__) \\r
326 || defined (__EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__) \\r
327 || defined (__EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__)\r
3eb9473e 328 EFI_STATUS Status; \r
329#endif\r
330\r
331//\r
332// NOTE: the destructors must be called according to dependency order\r
333//\r
334#ifdef __EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__\r
335 Status = UefiDriverModelLibDestructor (ImageHandle, SystemTable);\r
336 ASSERT_EFI_ERROR (Status);\r
337#endif\r
338\r
b56111f4
LG
339#ifdef __EDKII_GLUE_SMM_RUNTIME_DXE_REPORT_STATUS_CODE_LIB__\r
340 Status = ReportStatusCodeLibDestruct (ImageHandle, SystemTable);\r
341 ASSERT_EFI_ERROR (Status);\r
342#endif\r
343\r
3eb9473e 344#ifdef __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__\r
345 Status = RuntimeDriverLibDeconstruct (ImageHandle, SystemTable);\r
346 ASSERT_EFI_ERROR (Status);\r
347#endif\r
348}\r
349\r
350\r
351/**\r
352 Unload function that is registered in the LoadImage protocol. It un-installs\r
353 protocols produced and deallocates pool used by the driver. Called by the core\r
354 when unloading the driver.\r
355\r
356 @param ImageHandle\r
357\r
358 @retval EFI_SUCCESS\r
359\r
360**/\r
361EFI_STATUS\r
362EFIAPI\r
363_DriverUnloadHandler (\r
364 EFI_HANDLE ImageHandle\r
365 )\r
366{\r
367 EFI_STATUS Status;\r
368\r
369 //\r
370 // If an UnloadImage() handler is specified, then call it\r
371 //\r
372 Status = ProcessModuleUnloadList (ImageHandle);\r
373\r
374 //\r
375 // If the driver specific unload handler does not return an error, then call all of the\r
376 // library destructors. If the unload handler returned an error, then the driver can not be\r
377 // unloaded, and the library destructors should not be called\r
378 //\r
379 if (!EFI_ERROR (Status)) {\r
380 //\r
381 // Close our ExitBootServices () notify function\r
382 //\r
c7f33ca4 383\r
384#if __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__\r
3eb9473e 385 if (_gDriverExitBootServicesEvent[0] != NULL) {\r
386 ASSERT (gBS != NULL);\r
387 Status = gBS->CloseEvent (_mDriverExitBootServicesNotifyEvent);\r
388 ASSERT_EFI_ERROR (Status);\r
389 }\r
c7f33ca4 390#endif\r
3eb9473e 391\r
3eb9473e 392 ProcessLibraryDestructorList (ImageHandle, gST);\r
393 }\r
394\r
395 //\r
396 // Return the status from the driver specific unload handler\r
397 //\r
398 return Status;\r
399}\r
400\r
401VOID\r
402EFIAPI\r
403_DriverExitBootServices (\r
404 IN EFI_EVENT Event,\r
405 IN VOID *Context\r
406 )\r
407/*++\r
408\r
409Routine Description:\r
410\r
411 Set AtRuntime flag as TRUE after ExitBootServices\r
412\r
413Arguments:\r
414\r
415 Event - The Event that is being processed\r
416 \r
417 Context - Event Context\r
418\r
419Returns: \r
420\r
421 None\r
422\r
423--*/\r
424{\r
c7f33ca4 425#if __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__\r
3eb9473e 426 EFI_EVENT_NOTIFY ChildNotifyEventHandler;\r
427 UINTN Index;\r
428\r
429 for (Index = 0; _gDriverExitBootServicesEvent[Index] != NULL; Index++) {\r
430 ChildNotifyEventHandler = _gDriverExitBootServicesEvent[Index];\r
431 ChildNotifyEventHandler (Event, NULL);\r
432 }\r
c7f33ca4 433#endif \r
3eb9473e 434}\r
435\r
436EFI_DRIVER_ENTRY_POINT (_ModuleEntryPoint);\r
437\r
438//\r
439// Module Entry Point\r
440//\r
441#ifdef __EDKII_GLUE_MODULE_ENTRY_POINT__\r
442EFI_STATUS\r
443EFIAPI\r
444__EDKII_GLUE_MODULE_ENTRY_POINT__ (\r
445 EFI_HANDLE ImageHandle,\r
446 EFI_SYSTEM_TABLE *SystemTable\r
447 );\r
448#endif\r
449\r
450/**\r
451 Enrty point to DXE Driver.\r
452\r
453 @param ImageHandle ImageHandle of the loaded driver.\r
454 @param SystemTable Pointer to the EFI System Table.\r
455\r
456 @retval EFI_SUCCESS One or more of the drivers returned a success code.\r
457 @retval !EFI_SUCESS The return status from the last driver entry point in the list.\r
458\r
459**/\r
460EFI_STATUS\r
461EFIAPI\r
462_ModuleEntryPoint (\r
463 IN EFI_HANDLE ImageHandle,\r
464 IN EFI_SYSTEM_TABLE *SystemTable\r
465 )\r
466{\r
467 EFI_STATUS Status;\r
3eb9473e 468\r
469// if (_gUefiDriverRevision != 0) {\r
470// //\r
471// // Make sure that the EFI/UEFI spec revision of the platform is >= EFI/UEFI spec revision of the driver\r
472// //\r
473// if (SystemTable->Hdr.Revision < _gUefiDriverRevision) {\r
474// return EFI_INCOMPATIBLE_VERSION;\r
475// }\r
476// }\r
477\r
478// DEBUG ((EFI_D_ERROR, "EdkII Glue Driver Entry - 0\n"));\r
479\r
480 //\r
481 // Call constructor for all libraries\r
482 //\r
483 ProcessLibraryConstructorList (ImageHandle, SystemTable);\r
484\r
485 //\r
486 // Register our ExitBootServices () notify function\r
487 //\r
c7f33ca4 488#if __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__\r
3eb9473e 489 if (_gDriverExitBootServicesEvent[0] != NULL) {\r
490 Status = SystemTable->BootServices->CreateEvent (\r
491 EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES,\r
492 EFI_TPL_NOTIFY,\r
493 _DriverExitBootServices,\r
494 NULL,\r
495 &_mDriverExitBootServicesNotifyEvent\r
496 );\r
497\r
498 ASSERT_EFI_ERROR (Status);\r
499 }\r
c7f33ca4 500#endif\r
3eb9473e 501\r
502 //\r
503 // Install unload handler...\r
504 //\r
c7f33ca4 505 //\r
506 // Add conditional macro to save size. The 4 macros check against\r
507 // potential functions which may be invoked, if there is no function\r
508 // to be called, we don't register Unload callback.\r
509 //\r
510#if ( defined(__EDKII_GLUE_MODULE_UNLOAD_HANDLER__) \\r
511 || defined(__EDKII_GLUE_UEFI_DRIVER_MODEL_LIB__) \\r
512 || defined(__EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__) ) \\r
513 || __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__ \r
514\r
515 do { \r
516 EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;\r
517\r
518 Status = SystemTable->BootServices->HandleProtocol (\r
519 ImageHandle,\r
520 &gEfiLoadedImageProtocolGuid,\r
521 (VOID **)&LoadedImage\r
522 );\r
523 ASSERT_EFI_ERROR (Status);\r
524 LoadedImage->Unload = _DriverUnloadHandler;\r
525 } while(0);\r
526\r
527#endif \r
3eb9473e 528\r
529 //\r
530 // Call the driver entry point\r
531 //\r
532 #ifdef __EDKII_GLUE_MODULE_ENTRY_POINT__\r
533 Status = (__EDKII_GLUE_MODULE_ENTRY_POINT__ (ImageHandle, SystemTable));\r
534 #else\r
535 Status = EFI_SUCCESS;\r
536 #endif\r
537\r
538 //\r
539 // If all of the drivers returned errors, then invoke all of the library destructors\r
540 //\r
541 if (EFI_ERROR (Status)) {\r
542 //\r
543 // Close our ExitBootServices () notify function\r
544 //\r
c7f33ca4 545#if __EDKII_GLUE_HAVE_DRIVER_EXIT_BOOT_SERVICES_EVENT__ \r
3eb9473e 546 if (_gDriverExitBootServicesEvent[0] != NULL) {\r
547 EFI_STATUS CloseEventStatus;\r
548 CloseEventStatus = SystemTable->BootServices->CloseEvent (_mDriverExitBootServicesNotifyEvent);\r
549 ASSERT_EFI_ERROR (CloseEventStatus);\r
550 }\r
c7f33ca4 551#endif\r
3eb9473e 552\r
553 ProcessLibraryDestructorList (ImageHandle, SystemTable);\r
554 }\r
555\r
556 //\r
557 // Return the cummalative return status code from all of the driver entry points\r
558 //\r
559 return Status;\r
560}\r
561\r
562\r
563/**\r
564 Enrty point wrapper of DXE Driver.\r
565\r
566 @param ImageHandle ImageHandle of the loaded driver.\r
567 @param SystemTable Pointer to the EFI System Table.\r
568\r
569 @retval EFI_SUCCESS One or more of the drivers returned a success code.\r
570 @retval !EFI_SUCESS The return status from the last driver entry point in the list.\r
571\r
572 EBC build envrionment has /D $(IMAGE_ENTRY_POINT)=EfiMain which overrides what GlueLib \r
573 defines: /D IMAGE_ENTRY_POINT=_ModuleEntryPoint, so _ModuleEntryPoint will be replaced with\r
574 EfiMain thus the function below isn't needed in EBC envrionment.\r
575\r
576**/\r
577#ifndef MDE_CPU_EBC\r
578EFI_STATUS\r
579EFIAPI\r
580EfiMain (\r
581 IN EFI_HANDLE ImageHandle,\r
582 IN EFI_SYSTEM_TABLE *SystemTable\r
583 )\r
584{\r
585 return _ModuleEntryPoint (ImageHandle, SystemTable);\r
586}\r
587#endif\r
588\r
589//\r
590// Guids not present in R8.6 code base\r
591//\r
592\r
593//\r
594// Protocol/Arch Protocol GUID globals\r
595//\r
596GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gUefiDriverConfigurationProtocolGuid = { 0xbfd7dc1d, 0x24f1, 0x40d9, { 0x82, 0xe7, 0x2e, 0x09, 0xbb, 0x6b, 0x4e, 0xbe } };\r
597GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gUefiDriverDiagnosticsProtocolGuid = { 0x4d330321, 0x025f, 0x4aac, { 0x90, 0xd8, 0x5e, 0xd9, 0x00, 0x17, 0x3b, 0x63 } };\r
598GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiArpProtocolGuid = { 0xf4b427bb, 0xba21, 0x4f16, { 0xbc, 0x4e, 0x43, 0xe4, 0x16, 0xab, 0x61, 0x9c } };\r
599GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiArpServiceBindingProtocolGuid = { 0xf44c00ee, 0x1f2c, 0x4a00, { 0xaa, 0x09, 0x1c, 0x9f, 0x3e, 0x08, 0x00, 0xa3 } };\r
600GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDhcp4ProtocolGuid = { 0x8a219718, 0x4ef5, 0x4761, { 0x91, 0xc8, 0xc0, 0xf0, 0x4b, 0xda, 0x9e, 0x56 } };\r
601GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDhcp4ServiceBindingProtocolGuid = { 0x9d9a39d8, 0xbd42, 0x4a73, { 0xa4, 0xd5, 0x8e, 0xe9, 0x4b, 0xe1, 0x13, 0x80 } };\r
602GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiIp4ProtocolGuid = { 0x41d94cd2, 0x35b6, 0x455a, { 0x82, 0x58, 0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd } };\r
603GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiIp4ServiceBindingProtocolGuid = { 0xc51711e7, 0xb4bf, 0x404a, { 0xbf, 0xb8, 0x0a, 0x04, 0x8e, 0xf1, 0xff, 0xe4 } };\r
604GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiIp4ConfigProtocolGuid = { 0x3b95aa31, 0x3793, 0x434b, { 0x86, 0x67, 0xc8, 0x07, 0x08, 0x92, 0xe0, 0x5e } };\r
605GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiManagedNetworkProtocolGuid = { 0x3b95aa31, 0x3793, 0x434b, { 0x86, 0x67, 0xc8, 0x07, 0x08, 0x92, 0xe0, 0x5e } };\r
606GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiManagedNetworkServiceBindingProtocolGuid = { 0xf36ff770, 0xa7e1, 0x42cf, { 0x9e, 0xd2, 0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c } };\r
607GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiMtftp4ProtocolGuid = { 0x3ad9df29, 0x4501, 0x478d, { 0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3 } };\r
608GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiMtftp4ServiceBindingProtocolGuid = { 0x2FE800BE, 0x8F01, 0x4aa6, { 0x94, 0x6B, 0xD7, 0x13, 0x88, 0xE1, 0x83, 0x3F } };\r
609GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiTcp4ProtocolGuid = { 0x65530BC7, 0xA359, 0x410f, { 0xB0, 0x10, 0x5A, 0xAD, 0xC7, 0xEC, 0x2B, 0x62 } }; \r
610GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiTcp4ServiceBindingProtocolGuid = { 0x00720665, 0x67EB, 0x4a99, { 0xBA, 0xF7, 0xD3, 0xC3, 0x3A, 0x1C, 0x7C, 0xC9 } };\r
611GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiUdp4ProtocolGuid = { 0x3ad9df29, 0x4501, 0x478d, { 0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3 } };\r
612GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiUdp4ServiceBindingProtocolGuid = { 0x83f01464, 0x99bd, 0x45e5, { 0xb3, 0x83, 0xaf, 0x63, 0x05, 0xd8, 0xe9, 0xe6 } };\r
613GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiAuthenticationInfoProtocolGuid = { 0x7671d9d0, 0x53db, 0x4173, { 0xaa, 0x69, 0x23, 0x27, 0xf2, 0x1f, 0x0b, 0xc7 } };\r
614GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDevicePathFromTextProtocolGuid = { 0x5c99a21, 0xc70f, 0x4ad2, { 0x8a, 0x5f, 0x35, 0xdf, 0x33, 0x43, 0xf5, 0x1e } };\r
615GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDevicePathToTextProtocolGuid = { 0x8b843e20, 0x8132, 0x4852, { 0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c } };\r
616GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiDevicePathUtilitiesProtocolGuid = { 0x379be4e, 0xd706, 0x437d, { 0xb0, 0x37, 0xed, 0xb8, 0x2f, 0xb7, 0x72, 0xa4 } };\r
617GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashProtocolGuid = { 0xc5184932, 0xdba5, 0x46db, { 0xa5, 0xba, 0xcc, 0x0b, 0xda, 0x9c, 0x14, 0x35 } };\r
618GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashServiceBindingProtocolGuid = { 0x42881c98, 0xa4f3, 0x44b0, { 0xa3, 0x9d, 0xdf, 0xa1, 0x86, 0x67, 0xd8, 0xcd } };\r
619GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiIScsiInitiatorNameProtocolGuid = { 0xa6a72875, 0x2962, 0x4c18, { 0x9f, 0x46, 0x8d, 0xa6, 0x44, 0xcc, 0xfe, 0x00 } };\r
620GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiExtScsiPassThruProtocolGuid = { 0x1d3de7f0, 0x0807, 0x424f, { 0xaa, 0x69, 0x11, 0xa5, 0x4e, 0x19, 0xa4, 0x6f } };\r
621GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiTapeIoProtocolGuid = { 0x1e93e633, 0xd65a, 0x459e, { 0xab, 0x84, 0x93, 0xd9, 0xec, 0x26, 0x6d, 0x18 } };\r
622#if (EFI_SPECIFICATION_VERSION < 0x00020000)\r
623GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiUsb2HcProtocolGuid = { 0x3e745226, 0x9818, 0x45b6, { 0xa2, 0xac, 0xd7, 0xcd, 0x0e, 0x8b, 0xa2, 0xbc } };\r
624#endif\r
625\r
626//\r
627// PPI GUID globals\r
628//\r
629\r
630//\r
631// GUID globals\r
632//\r
633GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHobMemoryAllocBspStoreGuid = { 0x564b33cd, 0xc92a, 0x4593, { 0x90, 0xbf, 0x24, 0x73, 0xe4, 0x3c, 0x63, 0x22 } };\r
634GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHobMemoryAllocStackGuid = { 0x4ed4bf27, 0x4092, 0x42e9, { 0x80, 0x7d, 0x52, 0x7b, 0x1d, 0x00, 0xc9, 0xbd } }; \r
635GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHobMemoryAllocModuleGuid = { 0xf8e21975, 0x0899, 0x4f58, { 0xa4, 0xbe, 0x55, 0x25, 0xa9, 0xc6, 0xd7, 0x7a } }; \r
636GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiAuthenticationChapRadiusGuid = { 0xd6062b50, 0x15ca, 0x11da, { 0x92, 0x19, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } };\r
637GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiAuthenticationChapLocalGuid = { 0xc280c73e, 0x15ca, 0x11da, { 0xb0, 0xca, 0x00, 0x10, 0x83, 0xff, 0xca, 0x4d } };\r
638GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha1Guid = { 0x2ae9d80f, 0x3fb2, 0x4095, { 0xb7, 0xb1, 0xe9, 0x31, 0x57, 0xb9, 0x46, 0xb6 } };\r
639GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha224Guid = { 0x8df01a06, 0x9bd5, 0x4bf7, { 0xb0, 0x21, 0xdb, 0x4f, 0xd9, 0xcc, 0xf4, 0x5b } }; \r
640GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha256Guid = { 0x51aa59de, 0xfdf2, 0x4ea3, { 0xbc, 0x63, 0x87, 0x5f, 0xb7, 0x84, 0x2e, 0xe9 } };\r
641GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha384Guid = { 0xefa96432, 0xde33, 0x4dd2, { 0xae, 0xe6, 0x32, 0x8c, 0x33, 0xdf, 0x77, 0x7a } }; \r
642GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmSha512Guid = { 0xcaa4381e, 0x750c, 0x4770, { 0xb8, 0x70, 0x7a, 0x23, 0xb4, 0xe4, 0x21, 0x30 } }; \r
643GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiHashAlgorithmMD5Guid = { 0xaf7c79c, 0x65b5, 0x4319, { 0xb0, 0xae, 0x44, 0xec, 0x48, 0x4e, 0x4a, 0xd7 } };\r
644GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gBootObjectAuthorizationParmsetGuid = { 0xedd35e31, 0x7b9, 0x11d2, { 0x83, 0xa3, 0x00, 0xa0, 0xc9, 0x1f, 0xad, 0xcf } };\r
645GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gSmmCommunicateHeaderGuid = { 0xf328e36c, 0x23b6, 0x4a95, { 0x85, 0x4b, 0x32, 0xe1, 0x95, 0x34, 0xcd, 0x75 } };\r
646GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiCapsuleGuid = { 0x3B6686BD, 0x0D76, 0x4030, { 0xB7, 0x0E, 0xB5, 0x51, 0x9E, 0x2F, 0xC5, 0xA0 } };\r
647GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiConfigFileNameGuid = { 0x98B8D59B, 0xE8BA, 0x48EE, { 0x98, 0xDD, 0xC2, 0x95, 0x39, 0x2F, 0x1E, 0xDB } };\r