1 /** @file 2 Module entry point library for UEFI Applications. 3 4 Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 are licensed and made available under the terms and conditions of the BSD License 7 which accompanies this distribution. The full text of the license may be found at 8 http://opensource.org/licenses/bsd-license.php 9 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 13 **/ 14 15 #ifndef __UEFI_APPLICATION_ENTRY_POINT_H__ 16 #define __UEFI_APPLICATION_ENTRY_POINT_H__ 17 18 /// 19 /// Declare the EFI/UEFI Specification Revision to which this driver is implemented 20 /// 21 extern CONST UINT32 _gUefiDriverRevision; 22 23 24 /** 25 Entry point to UEFI Application. 26 27 This function is the entry point for a UEFI Application. This function must call 28 ProcessLibraryConstructorList(), ProcessModuleEntryPointList(), and ProcessLibraryDestructorList(). 29 The return value from ProcessModuleEntryPointList() is returned. 30 If _gUefiDriverRevision is not zero and SystemTable->Hdr.Revision is less than _gUefiDriverRevison, 31 then return EFI_INCOMPATIBLE_VERSION. 32 33 @param ImageHandle The image handle of the UEFI Application. 34 @param SystemTable A pointer to the EFI System Table. 35 36 @retval EFI_SUCCESS The UEFI Application exited normally. 37 @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater than SystemTable->Hdr.Revision. 38 @retval Other Return value from ProcessModuleEntryPointList(). 39 40 **/ 41 EFI_STATUS 42 EFIAPI 43 _ModuleEntryPoint ( 44 IN EFI_HANDLE ImageHandle, 45 IN EFI_SYSTEM_TABLE *SystemTable 46 ); 47 48 49 /** 50 Required by the EBC compiler and identical in functionality to _ModuleEntryPoint(). 51 52 @param ImageHandle The image handle of the UEFI Application. 53 @param SystemTable A pointer to the EFI System Table. 54 55 @retval EFI_SUCCESS The UEFI Application exited normally. 56 @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater than SystemTable->Hdr.Revision. 57 @retval Other Return value from ProcessModuleEntryPointList(). 58 59 **/ 60 EFI_STATUS 61 EFIAPI 62 EfiMain ( 63 IN EFI_HANDLE ImageHandle, 64 IN EFI_SYSTEM_TABLE *SystemTable 65 ); 66 67 68 /** 69 Invokes the library destructors for all dependent libraries and terminates 70 the UEFI Application. 71 72 This function calls ProcessLibraryDestructorList() and the EFI Boot Service Exit() 73 with a status specified by Status. 74 75 @param Status Status returned by the application that is exiting. 76 77 **/ 78 VOID 79 EFIAPI 80 Exit ( 81 IN EFI_STATUS Status 82 ); 83 84 85 /** 86 Autogenerated function that calls the library constructors for all of the module's 87 dependent libraries. 88 89 This function must be called by _ModuleEntryPoint(). 90 This function calls the set of library constructors for the set of library instances 91 that a module depends on. This includes library instances that a module depends on 92 directly and library instances that a module depends on indirectly through other libraries. 93 This function is autogenerated by build tools and those build tools are responsible for 94 collecting the set of library instances, determine which ones have constructors, and 95 calling the library constructors in the proper order based upon each of the library 96 instances own dependencies. 97 98 @param ImageHandle The image handle of the UEFI Application. 99 @param SystemTable A pointer to the EFI System Table. 100 101 **/ 102 VOID 103 EFIAPI 104 ProcessLibraryConstructorList ( 105 IN EFI_HANDLE ImageHandle, 106 IN EFI_SYSTEM_TABLE *SystemTable 107 ); 108 109 110 /** 111 Autogenerated function that calls the library descructors for all of the module's 112 dependent libraries. 113 114 This function may be called by _ModuleEntryPoint()or Exit(). 115 This function calls the set of library destructors for the set of library instances 116 that a module depends on. This includes library instances that a module depends on 117 directly and library instances that a module depends on indirectly through other libraries. 118 This function is autogenerated by build tools and those build tools are responsible 119 for collecting the set of library instances, determine which ones have destructors, 120 and calling the library destructors in the proper order based upon each of the library 121 instances own dependencies. 122 123 @param ImageHandle The image handle of the UEFI Application. 124 @param SystemTable A pointer to the EFI System Table. 125 126 **/ 127 VOID 128 EFIAPI 129 ProcessLibraryDestructorList ( 130 IN EFI_HANDLE ImageHandle, 131 IN EFI_SYSTEM_TABLE *SystemTable 132 ); 133 134 /** 135 This function calls the set of module entry points. It must be called by _ModuleEntryPoint(). 136 137 This function is autogenerated by build tools and those build tools are 138 responsible for collecting the module entry points and calling them in a specified order. 139 140 @param ImageHandle The image handle of the UEFI Application. 141 @param SystemTable A pointer to the EFI System Table. 142 143 @retval EFI_SUCCESS The UEFI Application executed normally. 144 @retval !EFI_SUCCESS The UEFI Application failed to execute normally. 145 146 **/ 147 EFI_STATUS 148 EFIAPI 149 ProcessModuleEntryPointList ( 150 IN EFI_HANDLE ImageHandle, 151 IN EFI_SYSTEM_TABLE *SystemTable 152 ); 153 154 #endif 155