]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFspWrapperPkg/FspInitPei/FspInitPei.c
Update IntelFspWrapperPkg according to FSP1.1.
[mirror_edk2.git] / IntelFspWrapperPkg / FspInitPei / FspInitPei.c
1 /** @file
2 This PEIM initialize FSP.
3
4 Copyright (c) 2014 - 2015, 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 "FspInitPei.h"
17
18 /**
19 This is the entrypoint of PEIM
20
21 @param[in] FileHandle Handle of the file being invoked.
22 @param[in] PeiServices Describes the list of possible PEI Services.
23
24 @retval EFI_SUCCESS if it completed successfully.
25 **/
26 EFI_STATUS
27 EFIAPI
28 FspPeiEntryPoint (
29 IN EFI_PEI_FILE_HANDLE FileHandle,
30 IN CONST EFI_PEI_SERVICES **PeiServices
31 )
32 {
33 FSP_INFO_HEADER *FspHeader;
34 UINT8 PcdFspApiVersion;
35
36 DEBUG ((DEBUG_INFO, "FspPeiEntryPoint\n"));
37 PcdFspApiVersion = 1;
38
39 FspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvFspBase));
40 DEBUG ((DEBUG_INFO, "FspHeader - 0x%x\n", FspHeader));
41 if (FspHeader == NULL) {
42 return EFI_DEVICE_ERROR;
43 }
44
45 if ((PcdGet8 (PcdFspApiVersion) >= 2) &&
46 (FspHeader->HeaderRevision >= FSP_HEADER_REVISION_2) &&
47 (FspHeader->ApiEntryNum >= 6) &&
48 (FspHeader->FspMemoryInitEntryOffset != 0) &&
49 (FspHeader->TempRamExitEntryOffset != 0) &&
50 (FspHeader->FspSiliconInitEntryOffset != 0) ) {
51 PcdFspApiVersion = FSP_HEADER_REVISION_2;
52 }
53 DEBUG ((DEBUG_INFO, "PcdFspApiVersion - 0x%x\n", PcdFspApiVersion));
54
55 if (PcdFspApiVersion == FSP_HEADER_REVISION_1) {
56 PeiFspInitV1 (FspHeader);
57 } else {
58 PeiFspInitV2 (FspHeader);
59 }
60
61 return EFI_SUCCESS;
62 }