]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/PeimEntryPoint/PeimEntryPoint.c
42aab62f5d5dfe3b2f6586c69bbd68277052c129
[mirror_edk2.git] / MdePkg / Library / PeimEntryPoint / PeimEntryPoint.c
1 /** @file
2 Entry point to a PEIM.
3
4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 **/
8
9 #include <PiPei.h>
10
11 #include <Library/PeimEntryPoint.h>
12 #include <Library/DebugLib.h>
13
14 /**
15 The entry point of PE/COFF Image for a PEIM.
16
17 This function is the entry point for a PEIM. This function must call ProcessLibraryConstructorList()
18 and ProcessModuleEntryPointList(). The return value from ProcessModuleEntryPointList() is returned.
19 If _gPeimRevision is not zero and PeiServices->Hdr.Revision is less than _gPeimRevison, then ASSERT().
20
21 @param FileHandle Handle of the file being invoked.
22 @param PeiServices Describes the list of possible PEI Services.
23
24 @retval EFI_SUCCESS The PEIM executed normally.
25 @retval !EFI_SUCCESS The PEIM failed to execute normally.
26 **/
27 EFI_STATUS
28 EFIAPI
29 _ModuleEntryPoint (
30 IN EFI_PEI_FILE_HANDLE FileHandle,
31 IN CONST EFI_PEI_SERVICES **PeiServices
32 )
33 {
34 if (_gPeimRevision != 0) {
35 //
36 // Make sure that the PEI spec revision of the platform is >= PEI spec revision of the driver
37 //
38 ASSERT ((*PeiServices)->Hdr.Revision >= _gPeimRevision);
39 }
40
41 //
42 // Call constructor for all libraries
43 //
44 ProcessLibraryConstructorList (FileHandle, PeiServices);
45
46 //
47 // Call the driver entry point
48 //
49 return ProcessModuleEntryPointList (FileHandle, PeiServices);
50 }
51
52 /**
53 Required by the EBC compiler and identical in functionality to _ModuleEntryPoint().
54
55 This function is required to call _ModuleEntryPoint() passing in FileHandle and PeiServices.
56
57 @param FileHandle Handle of the file being invoked.
58 @param PeiServices Describes the list of possible PEI Services.
59
60 @retval EFI_SUCCESS The PEIM executed normally.
61 @retval !EFI_SUCCESS The PEIM failed to execute normally.
62
63 **/
64 EFI_STATUS
65 EFIAPI
66 EfiMain (
67 IN EFI_PEI_FILE_HANDLE FileHandle,
68 IN CONST EFI_PEI_SERVICES **PeiServices
69 )
70 {
71 return _ModuleEntryPoint (FileHandle, PeiServices);
72 }