]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/UefiDriverEntryPoint.h
MdePkg/BaseLib: add PatchInstructionX86()
[mirror_edk2.git] / MdePkg / Include / Library / UefiDriverEntryPoint.h
1 /** @file
2 Module entry point library for UEFI drivers, DXE Drivers, DXE Runtime Drivers,
3 and DXE SMM Drivers.
4
5 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #ifndef __MODULE_ENTRY_POINT_H__
17 #define __MODULE_ENTRY_POINT_H__
18
19 ///
20 ///Declare the PI Specification Revision that this driver requires to execute correctly.
21 ///
22 extern CONST UINT32 _gDxeRevision;
23
24 ///
25 /// Declare the EFI/UEFI Specification Revision to which this driver is implemented
26 ///
27 extern CONST UINT32 _gUefiDriverRevision;
28
29 ///
30 /// Declare the number of unload handler in the image.
31 ///
32 extern CONST UINT8 _gDriverUnloadImageCount;
33
34
35 /**
36 The entry point of PE/COFF Image for a DXE Driver, DXE Runtime Driver, DXE SMM Driver, or UEFI Driver.
37
38 This function is the entry point for a DXE Driver, DXE Runtime Driver, DXE SMM Driver,
39 or UEFI Driver. This function must call ProcessLibraryConstructorList() and
40 ProcessModuleEntryPointList(). If the return status from ProcessModuleEntryPointList()
41 is an error status, then ProcessLibraryDestructorList() must be called. The return value
42 from ProcessModuleEntryPointList() is returned. If _gDriverUnloadImageCount is greater
43 than zero, then an unload handler must be registered for this image and the unload handler
44 must invoke ProcessModuleUnloadList().
45 If _gUefiDriverRevision is not zero and SystemTable->Hdr.Revision is less than _gUefiDriverRevison,
46 then return EFI_INCOMPATIBLE_VERSION.
47
48
49 @param ImageHandle The image handle of the DXE Driver, DXE Runtime Driver, DXE SMM Driver, or UEFI Driver.
50 @param SystemTable A pointer to the EFI System Table.
51
52 @retval EFI_SUCCESS The DXE Driver, DXE Runtime Driver, DXE SMM Driver,
53 or UEFI Driver exited normally.
54 @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater than SystemTable->Hdr.Revision.
55 @retval Other Return value from ProcessModuleEntryPointList().
56
57 **/
58 EFI_STATUS
59 EFIAPI
60 _ModuleEntryPoint (
61 IN EFI_HANDLE ImageHandle,
62 IN EFI_SYSTEM_TABLE *SystemTable
63 );
64
65
66 /**
67 Required by the EBC compiler and identical in functionality to _ModuleEntryPoint().
68
69 This function is required to call _ModuleEntryPoint() passing in ImageHandle, and SystemTable.
70
71 @param ImageHandle The image handle of the DXE Driver, DXE Runtime Driver, DXE SMM Driver, or UEFI Driver.
72 @param SystemTable A pointer to the EFI System Table.
73
74 @retval EFI_SUCCESS The DXE Driver, DXE Runtime Driver, DXE SMM Driver,
75 or UEFI Driver exited normally.
76 @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater than SystemTable->Hdr.Revision.
77 @retval Other Return value from ProcessModuleEntryPointList().
78 **/
79 EFI_STATUS
80 EFIAPI
81 EfiMain (
82 IN EFI_HANDLE ImageHandle,
83 IN EFI_SYSTEM_TABLE *SystemTable
84 );
85
86
87 /**
88 Invokes the library destructors for all dependent libraries and terminates the
89 DXE Driver, DXE Runtime Driver, DXE SMM Driver, or UEFI Driver.
90
91 This function calls ProcessLibraryDestructorList() and the EFI Boot Service Exit()
92 with a status specified by Status.
93
94 @param Status Status returned by the driver that is exiting.
95
96 **/
97 VOID
98 EFIAPI
99 ExitDriver (
100 IN EFI_STATUS Status
101 );
102
103
104 /**
105 Autogenerated function that calls the library constructors for all of the module's
106 dependent libraries.
107
108 This function must be called by _ModuleEntryPoint().
109 This function calls the set of library constructors for the set of library instances
110 that a module depends on. This includes library instances that a module depends on
111 directly and library instances that a module depends on indirectly through other libraries.
112 This function is autogenerated by build tools and those build tools are responsible
113 for collecting the set of library instances, determine which ones have constructors,
114 and calling the library constructors in the proper order based upon each of the library
115 instances own dependencies.
116
117 @param ImageHandle The image handle of the DXE Driver, DXE Runtime Driver, DXE SMM Driver, or UEFI Driver.
118 @param SystemTable A pointer to the EFI System Table.
119
120 **/
121 VOID
122 EFIAPI
123 ProcessLibraryConstructorList (
124 IN EFI_HANDLE ImageHandle,
125 IN EFI_SYSTEM_TABLE *SystemTable
126 );
127
128
129 /**
130 Autogenerated function that calls the library descructors for all of the module's
131 dependent libraries.
132
133 This function may be called by _ModuleEntryPoint() or ExitDriver().
134 This function calls the set of library destructors for the set of library instances
135 that a module depends on. This includes library instances that a module depends on
136 directly and library instances that a module depends on indirectly through other libraries.
137 This function is autogenerated by build tools and those build tools are responsible for
138 collecting the set of library instances, determine which ones have destructors, and calling
139 the library destructors in the proper order based upon each of the library instances own dependencies.
140
141 @param ImageHandle The image handle of the DXE Driver, DXE Runtime Driver, DXE SMM Driver, or UEFI Driver.
142 @param SystemTable A pointer to the EFI System Table.
143
144 **/
145 VOID
146 EFIAPI
147 ProcessLibraryDestructorList (
148 IN EFI_HANDLE ImageHandle,
149 IN EFI_SYSTEM_TABLE *SystemTable
150 );
151
152
153 /**
154 Autogenerated function that calls a set of module entry points.
155
156 This function must be called by _ModuleEntryPoint().
157 This function calls the set of module entry points.
158 This function is autogenerated by build tools and those build tools are responsible
159 for collecting the module entry points and calling them in a specified order.
160
161 @param ImageHandle The image handle of the DXE Driver, DXE Runtime Driver, DXE SMM Driver, or UEFI Driver.
162 @param SystemTable A pointer to the EFI System Table.
163
164 @retval EFI_SUCCESS The DXE Driver, DXE Runtime Driver, DXE SMM Driver, or UEFI Driver executed normally.
165 @retval !EFI_SUCCESS The DXE Driver, DXE Runtime Driver, DXE SMM Driver, or UEFI Driver failed to execute normally.
166 **/
167 EFI_STATUS
168 EFIAPI
169 ProcessModuleEntryPointList (
170 IN EFI_HANDLE ImageHandle,
171 IN EFI_SYSTEM_TABLE *SystemTable
172 );
173
174
175 /**
176 Autogenerated function that calls a set of module unload handlers.
177
178 This function must be called from the unload handler registered by _ModuleEntryPoint().
179 This function calls the set of module unload handlers.
180 This function is autogenerated by build tools and those build tools are responsible
181 for collecting the module unload handlers and calling them in a specified order.
182
183 @param ImageHandle The image handle of the DXE Driver, DXE Runtime Driver, DXE SMM Driver, or UEFI Driver.
184
185 @retval EFI_SUCCESS The unload handlers executed normally.
186 @retval !EFI_SUCCESS The unload handlers failed to execute normally.
187
188 **/
189 EFI_STATUS
190 EFIAPI
191 ProcessModuleUnloadList (
192 IN EFI_HANDLE ImageHandle
193 );
194
195 #endif