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