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