blob: 83a1bd8ccc328480242876a09b8926a6905aa635 [file] [log] [blame]
Vishal Bhoj82c80712015-12-15 21:13:33 +05301/** @file
2 Entry point to a PEIM.
3
4Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5This program and the accompanying materials
6are licensed and made available under the terms and conditions of the BSD License
7which accompanies this distribution. The full text of the license may be found at
8http://opensource.org/licenses/bsd-license.php.
9
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13**/
14
15
16#include <PiPei.h>
17
18
19#include <Library/PeimEntryPoint.h>
20#include <Library/DebugLib.h>
21
22/**
23 The entry point of PE/COFF Image for a PEIM.
24
25 This function is the entry point for a PEIM. This function must call ProcessLibraryConstructorList()
26 and ProcessModuleEntryPointList(). The return value from ProcessModuleEntryPointList() is returned.
27 If _gPeimRevision is not zero and PeiServices->Hdr.Revision is less than _gPeimRevison, then ASSERT().
28
29 @param FileHandle Handle of the file being invoked.
30 @param PeiServices Describes the list of possible PEI Services.
31
32 @retval EFI_SUCCESS The PEIM executed normally.
33 @retval !EFI_SUCCESS The PEIM failed to execute normally.
34**/
35EFI_STATUS
36EFIAPI
37_ModuleEntryPoint (
38 IN EFI_PEI_FILE_HANDLE FileHandle,
39 IN CONST EFI_PEI_SERVICES **PeiServices
40 )
41{
42 if (_gPeimRevision != 0) {
43 //
44 // Make sure that the PEI spec revision of the platform is >= PEI spec revision of the driver
45 //
46 ASSERT ((*PeiServices)->Hdr.Revision >= _gPeimRevision);
47 }
48
49 //
50 // Call constructor for all libraries
51 //
52 ProcessLibraryConstructorList (FileHandle, PeiServices);
53
54 //
55 // Call the driver entry point
56 //
57 return ProcessModuleEntryPointList (FileHandle, PeiServices);
58}
59
60
61/**
62 Required by the EBC compiler and identical in functionality to _ModuleEntryPoint().
63
64 This function is required to call _ModuleEntryPoint() passing in FileHandle and PeiServices.
65
66 @param FileHandle Handle of the file being invoked.
67 @param PeiServices Describes the list of possible PEI Services.
68
69 @retval EFI_SUCCESS The PEIM executed normally.
70 @retval !EFI_SUCCESS The PEIM failed to execute normally.
71
72**/
73EFI_STATUS
74EFIAPI
75EfiMain (
76 IN EFI_PEI_FILE_HANDLE FileHandle,
77 IN CONST EFI_PEI_SERVICES **PeiServices
78 )
79{
80 return _ModuleEntryPoint (FileHandle, PeiServices);
81}