]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/PeimEntryPoint/PeimEntryPoint.c
MdePkg: Replace BSD License with BSD+Patent License
[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
10 #include <PiPei.h>
11
12
13 #include <Library/PeimEntryPoint.h>
14 #include <Library/DebugLib.h>
15
16 /**
17 The entry point of PE/COFF Image for a PEIM.
18
19 This function is the entry point for a PEIM. This function must call ProcessLibraryConstructorList()
20 and ProcessModuleEntryPointList(). The return value from ProcessModuleEntryPointList() is returned.
21 If _gPeimRevision is not zero and PeiServices->Hdr.Revision is less than _gPeimRevison, then ASSERT().
22
23 @param FileHandle Handle of the file being invoked.
24 @param PeiServices Describes the list of possible PEI Services.
25
26 @retval EFI_SUCCESS The PEIM executed normally.
27 @retval !EFI_SUCCESS The PEIM failed to execute normally.
28 **/
29 EFI_STATUS
30 EFIAPI
31 _ModuleEntryPoint (
32 IN EFI_PEI_FILE_HANDLE FileHandle,
33 IN CONST EFI_PEI_SERVICES **PeiServices
34 )
35 {
36 if (_gPeimRevision != 0) {
37 //
38 // Make sure that the PEI spec revision of the platform is >= PEI spec revision of the driver
39 //
40 ASSERT ((*PeiServices)->Hdr.Revision >= _gPeimRevision);
41 }
42
43 //
44 // Call constructor for all libraries
45 //
46 ProcessLibraryConstructorList (FileHandle, PeiServices);
47
48 //
49 // Call the driver entry point
50 //
51 return ProcessModuleEntryPointList (FileHandle, PeiServices);
52 }
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 FileHandle and PeiServices.
59
60 @param FileHandle Handle of the file being invoked.
61 @param PeiServices Describes the list of possible PEI Services.
62
63 @retval EFI_SUCCESS The PEIM executed normally.
64 @retval !EFI_SUCCESS The PEIM failed to execute normally.
65
66 **/
67 EFI_STATUS
68 EFIAPI
69 EfiMain (
70 IN EFI_PEI_FILE_HANDLE FileHandle,
71 IN CONST EFI_PEI_SERVICES **PeiServices
72 )
73 {
74 return _ModuleEntryPoint (FileHandle, PeiServices);
75 }