1 /** @file
2   Module entry point library for PEI core.
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   The entry point of PE/COFF Image for the PEI Core.
20 
21   This function is the entry point for the PEI Foundation, which allows the SEC phase
22   to pass information about the stack, temporary RAM and the Boot Firmware Volume.
23   In addition, it also allows the SEC phase to pass services and data forward for use
24   during the PEI phase in the form of one or more PPIs.
25   There is no limit to the number of additional PPIs that can be passed from SEC into
26   the PEI Foundation. As part of its initialization phase, the PEI Foundation will add
27   these SEC-hosted PPIs to its PPI database such that both the PEI Foundation and any
28   modules can leverage the associated service calls and/or code in these early PPIs.
29   This function is required to call ProcessModuleEntryPointList() with the Context
30   parameter set to NULL.  ProcessModuleEntryPoint() is never expected to return.
31   The PEI Core is responsible for calling ProcessLibraryConstructorList() as soon as
32   the PEI Services Table and the file handle for the PEI Core itself have been established.
33   If ProcessModuleEntryPointList() returns, then ASSERT() and halt the system.
34 
35   @param SecCoreData  Points to a data structure containing information about the PEI
36                       core's operating environment, such as the size and location of
37                       temporary RAM, the stack location and the BFV location.
38 
39   @param PpiList      Points to a list of one or more PPI descriptors to be installed
40                       initially by the PEI core. An empty PPI list consists of a single
41                       descriptor with the end-tag EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST.
42                       As part of its initialization phase, the PEI Foundation will add
43                       these SEC-hosted PPIs to its PPI database such that both the PEI
44                       Foundation and any modules can leverage the associated service calls
45                       and/or code in these early PPIs.
46 
47 **/
48 VOID
49 EFIAPI
50 _ModuleEntryPoint(
51   IN CONST  EFI_SEC_PEI_HAND_OFF    *SecCoreData,
52   IN CONST  EFI_PEI_PPI_DESCRIPTOR  *PpiList
53   );
54 
55 /**
56   Required by the EBC compiler and identical in functionality to _ModuleEntryPoint().
57 
58   This function is required to call _ModuleEntryPoint() passing in SecCoreData and PpiList.
59 
60   @param SecCoreData  Points to a data structure containing information about the PEI core's
61                       operating environment, such as the size and location of temporary RAM,
62                       the stack location and the BFV location.
63 
64   @param PpiList      Points to a list of one or more PPI descriptors to be installed
65                       initially by the PEI core.  An empty PPI list consists of a single
66                       descriptor with the end-tag EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST.
67                       As part of its initialization phase, the PEI Foundation will add these
68                       SEC-hosted PPIs to its PPI database such that both the PEI Foundation
69                       and any modules can leverage the associated service calls and/or code
70                       in these early PPIs.
71 
72 **/
73 VOID
74 EFIAPI
75 EfiMain (
76   IN CONST  EFI_SEC_PEI_HAND_OFF    *SecCoreData,
77   IN CONST  EFI_PEI_PPI_DESCRIPTOR  *PpiList
78   );
79 
80 /**
81   Autogenerated function that calls the library constructors for all of the module's
82   dependent libraries.
83 
84   This function must be called by the PEI Core once an initial PEI Services Table has been established.
85   This function calls the set of library constructors for the set of library instances that a
86   module depends on.  This include library instances that a module depends on directly and library
87   instances that a module depends on indirectly through other libraries.
88   This function is autogenerated by build tools and those build tools are responsible for collecting
89   the set of library instances, determining which ones have constructors, and calling the library
90   constructors in the proper order based upon the dependencies of each of the library instances.
91   The PEI Core must call this function with a NULL FileHandle value as soon as the initial PEI
92   Services Table has been established.
93 
94   @param  FileHandle   Handle of the file being invoked.
95   @param  PeiServices  Describes the list of possible PEI Services.
96 
97 **/
98 VOID
99 EFIAPI
100 ProcessLibraryConstructorList (
101   IN EFI_PEI_FILE_HANDLE        FileHandle,
102   IN CONST EFI_PEI_SERVICES     **PeiServices
103   );
104 
105 
106 /**
107   Autogenerated function that calls a set of module entry points.
108 
109   This function must be called by _ModuleEntryPoint().
110   This function calls the set of module entry points.
111   This function is autogenerated by build tools and those build tools are responsible
112   for collecting the module entry points and calling them in a specified order.
113 
114   @param SecCoreData    Points to a data structure containing information about the PEI
115                         core's operating environment, such as the size and location of
116                         temporary RAM, the stack location and the BFV location.
117 
118   @param PpiList        Points to a list of one or more PPI descriptors to be installed
119                         initially by the PEI core. An empty PPI list consists of a single
120                         descriptor with the end-tag EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST.
121                         As part of its initialization phase, the PEI Foundation will add
122                         these SEC-hosted PPIs to its PPI database such that both the PEI
123                         Foundation and any modules can leverage the associated service calls
124                         and/or code in these early PPIs.
125   @param  Context       A pointer to a private context structure defined by the PEI Core
126                         implementation. The implementation of _ModuleEntryPoint() must set
127                         this parameter is NULL to indicate that this is the first PEI phase.
128 
129 **/
130 VOID
131 EFIAPI
132 ProcessModuleEntryPointList (
133   IN CONST  EFI_SEC_PEI_HAND_OFF    *SecCoreData,
134   IN CONST  EFI_PEI_PPI_DESCRIPTOR  *PpiList,
135   IN VOID                           *Context
136   );
137 
138 #endif
139