Update IntelFspWrapperPkg according to FSP1.1.
[mirror_edk2.git] / IntelFspWrapperPkg / FspInitPei / FspInitPei.c
CommitLineData
a33a2f62 1/** @file\r
d8043ce9 2 This PEIM initialize FSP.\r
a33a2f62 3\r
d8043ce9 4 Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>\r
a33a2f62
JY
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php.\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15\r
16#include "FspInitPei.h"\r
17\r
a33a2f62
JY
18/**\r
19 This is the entrypoint of PEIM\r
20\r
21 @param[in] FileHandle Handle of the file being invoked.\r
22 @param[in] PeiServices Describes the list of possible PEI Services.\r
23\r
24 @retval EFI_SUCCESS if it completed successfully.\r
25**/\r
26EFI_STATUS\r
27EFIAPI\r
28FspPeiEntryPoint (\r
29 IN EFI_PEI_FILE_HANDLE FileHandle,\r
30 IN CONST EFI_PEI_SERVICES **PeiServices\r
31 )\r
32{\r
33 FSP_INFO_HEADER *FspHeader;\r
d8043ce9 34 UINT8 PcdFspApiVersion;\r
a33a2f62
JY
35\r
36 DEBUG ((DEBUG_INFO, "FspPeiEntryPoint\n"));\r
d8043ce9 37 PcdFspApiVersion = 1;\r
a33a2f62 38\r
d8043ce9
JY
39 FspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvFspBase));\r
40 DEBUG ((DEBUG_INFO, "FspHeader - 0x%x\n", FspHeader));\r
41 if (FspHeader == NULL) {\r
42 return EFI_DEVICE_ERROR;\r
43 }\r
a33a2f62 44\r
d8043ce9
JY
45 if ((PcdGet8 (PcdFspApiVersion) >= 2) &&\r
46 (FspHeader->HeaderRevision >= FSP_HEADER_REVISION_2) &&\r
47 (FspHeader->ApiEntryNum >= 6) &&\r
48 (FspHeader->FspMemoryInitEntryOffset != 0) &&\r
49 (FspHeader->TempRamExitEntryOffset != 0) &&\r
50 (FspHeader->FspSiliconInitEntryOffset != 0) ) {\r
51 PcdFspApiVersion = FSP_HEADER_REVISION_2;\r
52 }\r
53 DEBUG ((DEBUG_INFO, "PcdFspApiVersion - 0x%x\n", PcdFspApiVersion));\r
a33a2f62 54\r
d8043ce9
JY
55 if (PcdFspApiVersion == FSP_HEADER_REVISION_1) {\r
56 PeiFspInitV1 (FspHeader);\r
a33a2f62 57 } else {\r
d8043ce9 58 PeiFspInitV2 (FspHeader);\r
a33a2f62
JY
59 }\r
60\r
61 return EFI_SUCCESS;\r
62}\r