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