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