]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Library/UefiDriverEntryPoint.h
54ae03ddefcdcd55c5b67994c2bc8d38305edb2f
[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
6 All rights reserved. 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 EFI/UEFI Specification Revision to which this driver is implemented
21 ///
22 extern CONST UINT32 _gUefiDriverRevision;
23
24 ///
25 /// Declare the number of unload handler in the image.
26 ///
27 extern CONST UINT8 _gDriverUnloadImageCount;
28
29
30 /**
31 The entry point of PE/COFF Image for a DXE Driver, DXE Runtime Driver, DXE SMM Driver, or UEFI Driver.
32
33 This function is the entry point for a DXE Driver, DXE Runtime Driver, DXE SMM Driver,
34 or UEFI Driver. This function must call ProcessLibraryConstructorList() and
35 ProcessModuleEntryPointList(). If the return status from ProcessModuleEntryPointList()
36 is an error status, then ProcessLibraryDestructorList() must be called. The return value
37 from ProcessModuleEntryPointList() is returned. If _gDriverUnloadImageCount is greater
38 than zero, then an unload handler must be registered for this image and the unload handler
39 must invoke ProcessModuleUnloadList().
40 If _gUefiDriverRevision is not zero and SystemTable->Hdr.Revision is less than _gUefiDriverRevison,
41 then return EFI_INCOMPATIBLE_VERSION.
42
43
44 @param ImageHandle ImageHandle of the loaded driver.
45 @param SystemTable Pointer to the EFI System Table.
46
47 @retval EFI_SUCCESS One or more of the drivers returned a success code.
48 @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater than SystemTable->Hdr.Revision.
49 @retval Other Return value from ProcessModuleEntryPointList().
50
51 **/
52 EFI_STATUS
53 EFIAPI
54 _ModuleEntryPoint (
55 IN EFI_HANDLE ImageHandle,
56 IN EFI_SYSTEM_TABLE *SystemTable
57 );
58
59
60 /**
61 Required by the EBC compiler and identical in functionality to _ModuleEntryPoint().
62
63 This function is required to call _ModuleEntryPoint() passing in ImageHandle, and SystemTable.
64
65 @param ImageHandle ImageHandle of the loaded driver.
66 @param SystemTable Pointer to the EFI System Table.
67
68 @retval EFI_SUCCESS The DXE Driver, DXE Runtime Driver, DXE SMM Driver,
69 or UEFI Driver exited normally.
70 @retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater than SystemTable->Hdr.Revision.
71 @retval Other Return value from ProcessModuleEntryPointList().
72 **/
73 EFI_STATUS
74 EFIAPI
75 EfiMain (
76 IN EFI_HANDLE ImageHandle,
77 IN EFI_SYSTEM_TABLE *SystemTable
78 );
79
80
81 /**
82 Invokes the library destructors fror all dependent libraries and terminates the
83 DXE Driver, DXE Runtime Driver, DXE SMM Driver, or UEFI Driver.
84
85 This function calls ProcessLibraryDestructorList() and the EFI Boot Service Exit()
86 with a status specified by Status.
87
88 @param Status Status returned by the driver that is exiting.
89
90 **/
91 VOID
92 EFIAPI
93 ExitDriver (
94 IN EFI_STATUS Status
95 );
96
97
98 /**
99 Autogenerated function that calls the library constructors for all of the module's
100 dependent libraries.
101
102 This function must be called by _ModuleEntryPoint().
103 This function calls the set of library constructors for the set of library instances
104 that a module depends on. This includes library instances that a module depends on
105 directly and library instances that a module depends on indirectly through other libraries.
106 This function is autogenerated by build tools and those build tools are responsible
107 for collecting the set of library instances, determine which ones have constructors,
108 and calling the library constructors in the proper order based upon each of the library
109 instances own dependencies.
110
111 @param ImageHandle ImageHandle of the loaded driver.
112 @param SystemTable Pointer to the EFI System Table.
113
114 **/
115 VOID
116 EFIAPI
117 ProcessLibraryConstructorList (
118 IN EFI_HANDLE ImageHandle,
119 IN EFI_SYSTEM_TABLE *SystemTable
120 );
121
122
123 /**
124 Autogenerated function that calls the library descructors for all of the module's
125 dependent libraries.
126
127 This function may be called by _ModuleEntryPoint() or ExitDriver().
128 This function calls the set of library destructors for the set of library instances
129 that a module depends on. This includes library instances that a module depends on
130 directly and library instances that a module depends on indirectly through other libraries.
131 This function is autogenerated by build tools and those build tools are responsible for
132 collecting the set of library instances, determine which ones have destructors, and calling
133 the library destructors in the proper order based upon each of the library instances own dependencies.
134
135 @param ImageHandle ImageHandle of the loaded driver.
136 @param SystemTable Pointer to the EFI System Table.
137
138 **/
139 VOID
140 EFIAPI
141 ProcessLibraryDestructorList (
142 IN EFI_HANDLE ImageHandle,
143 IN EFI_SYSTEM_TABLE *SystemTable
144 );
145
146
147 /**
148 Autogenerated function that calls a set of module entry points.
149
150 This function must be called by _ModuleEntryPoint().
151 This function calls the set of module entry points.
152 This function is autogenerated by build tools and those build tools are responsible
153 for collecting the module entry points and calling them in a specified order.
154
155 @param ImageHandle ImageHandle of the loaded driver.
156 @param SystemTable Pointer to the EFI System Table.
157
158 @retval EFI_SUCCESS The UEFI Application executed normally.
159 @retval !EFI_SUCCESS The UEFI Application failed to execute normally.
160 **/
161 EFI_STATUS
162 EFIAPI
163 ProcessModuleEntryPointList (
164 IN EFI_HANDLE ImageHandle,
165 IN EFI_SYSTEM_TABLE *SystemTable
166 );
167
168
169 /**
170 Autogenerated function that calls a set of module unload handlers.
171
172 This function must be called from the unload handler registered by _ModuleEntryPoint().
173 This function calls the set of module unload handlers.
174 This function is autogenerated by build tools and those build tools are responsible
175 for collecting the module unload handlers and calling them in a specified order.
176
177 @param ImageHandle ImageHandle of the loaded driver.
178
179 @retval EFI_SUCCESS The unoad handlers executed normally.
180 @retval !EFI_SUCCESS The unload handlers failed to execute normally.
181
182 **/
183 EFI_STATUS
184 EFIAPI
185 ProcessModuleUnloadList (
186 IN EFI_HANDLE ImageHandle
187 );
188
189 #endif