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