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