1 /** @file
2 Entry point to a PEIM.
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
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 **/
35 EFI_STATUS
36 EFIAPI
_ModuleEntryPoint(IN EFI_PEI_FILE_HANDLE FileHandle,IN CONST EFI_PEI_SERVICES ** PeiServices)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 **/
73 EFI_STATUS
74 EFIAPI
EfiMain(IN EFI_PEI_FILE_HANDLE FileHandle,IN CONST EFI_PEI_SERVICES ** PeiServices)75 EfiMain (
76 IN EFI_PEI_FILE_HANDLE FileHandle,
77 IN CONST EFI_PEI_SERVICES **PeiServices
78 )
79 {
80 return _ModuleEntryPoint (FileHandle, PeiServices);
81 }
82