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