1 /** @file
2   Module entry point library for PEIM.
3 
4 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution.  The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9 
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #ifndef __MODULE_ENTRY_POINT_H__
16 #define __MODULE_ENTRY_POINT_H__
17 
18 ///
19 /// Declare the EFI/UEFI Specification Revision to which this driver is implemented
20 ///
21 extern CONST UINT32       _gPeimRevision;
22 
23 
24 /**
25   The entry point of PE/COFF Image for a PEIM.
26 
27   This function is the entry point for a PEIM.  This function must call ProcessLibraryConstructorList()
28   and ProcessModuleEntryPointList().  The return value from ProcessModuleEntryPointList() is returned.
29   If _gPeimRevision is not zero and PeiServices->Hdr.Revision is less than _gPeimRevison, then ASSERT().
30 
31   @param  FileHandle  Handle of the file being invoked.
32   @param  PeiServices Describes the list of possible PEI Services.
33 
34   @retval  EFI_SUCCESS   The PEIM executed normally.
35   @retval  !EFI_SUCCESS  The PEIM failed to execute normally.
36 **/
37 EFI_STATUS
38 EFIAPI
39 _ModuleEntryPoint (
40   IN EFI_PEI_FILE_HANDLE       FileHandle,
41   IN CONST EFI_PEI_SERVICES    **PeiServices
42   );
43 
44 
45 /**
46   Required by the EBC compiler and identical in functionality to _ModuleEntryPoint().
47 
48   This function is required to call _ModuleEntryPoint() passing in FileHandle and PeiServices.
49 
50   @param  FileHandle  Handle of the file being invoked.
51   @param  PeiServices Describes the list of possible PEI Services.
52 
53   @retval EFI_SUCCESS  The PEIM executed normally.
54   @retval !EFI_SUCCESS The PEIM failed to execute normally.
55 
56 **/
57 EFI_STATUS
58 EFIAPI
59 EfiMain (
60   IN EFI_PEI_FILE_HANDLE       FileHandle,
61   IN CONST EFI_PEI_SERVICES    **PeiServices
62   );
63 
64 /**
65   Autogenerated function that calls the library constructors for all of the module's
66   dependent libraries.
67 
68   This function must be called by _ModuleEntryPoint().
69   This function calls the set of library constructors for the set of library instances that a
70   module depends on. This includes library instances that a module depends on directly and library
71   instances that a module depends on indirectly through other libraries.
72   This function is autogenerated by build tools and those build tools are responsible for collecting
73   the set of library instances, determine which ones have constructors, and calling the library
74   constructors in the proper order based upon each of the library instances own dependencies.
75 
76   @param  FileHandle   Handle of the file being invoked.
77   @param  PeiServices  Describes the list of possible PEI Services.
78 
79 **/
80 VOID
81 EFIAPI
82 ProcessLibraryConstructorList (
83   IN EFI_PEI_FILE_HANDLE       FileHandle,
84   IN CONST EFI_PEI_SERVICES    **PeiServices
85   );
86 
87 /**
88   Autogenerated function that calls a set of module entry points.
89 
90   This function must be called by _ModuleEntryPoint().
91   This function calls the set of module entry points.
92   This function is autogenerated by build tools and those build tools are responsible
93   for collecting the module entry points and calling them in a specified order.
94 
95   @param  FileHandle  Handle of the file being invoked.
96   @param  PeiServices Describes the list of possible PEI Services.
97 
98   @retval EFI_SUCCESS  The PEIM executed normally.
99   @retval !EFI_SUCCESS The PEIM failed to execute normally.
100 
101 **/
102 EFI_STATUS
103 EFIAPI
104 ProcessModuleEntryPointList (
105   IN EFI_PEI_FILE_HANDLE       FileHandle,
106   IN CONST EFI_PEI_SERVICES    **PeiServices
107   );
108 
109 #endif
110