Update IntelFspWrapperPkg according to FSP1.1.
[mirror_edk2.git] / IntelFspWrapperPkg / FspInitPei / FspNotifyS3.c
1 /** @file
2 In EndOfPei notify, it will call FspNotifyPhase API.
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 function handles S3 resume task at the end of PEI
20
21 @param[in] PeiServices Pointer to PEI Services Table.
22 @param[in] NotifyDesc Pointer to the descriptor for the Notification event that
23 caused this function to execute.
24 @param[in] Ppi Pointer to the PPI data associated with this function.
25
26 @retval EFI_STATUS Always return EFI_SUCCESS
27 **/
28 EFI_STATUS
29 EFIAPI
30 S3EndOfPeiNotify (
31 IN EFI_PEI_SERVICES **PeiServices,
32 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
33 IN VOID *Ppi
34 );
35
36 EFI_PEI_NOTIFY_DESCRIPTOR mS3EndOfPeiNotifyDesc = {
37 (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
38 &gEfiEndOfPeiSignalPpiGuid,
39 S3EndOfPeiNotify
40 };
41
42 /**
43 This function handles S3 resume task at the end of PEI
44
45 @param[in] PeiServices Pointer to PEI Services Table.
46 @param[in] NotifyDesc Pointer to the descriptor for the Notification event that
47 caused this function to execute.
48 @param[in] Ppi Pointer to the PPI data associated with this function.
49
50 @retval EFI_STATUS Always return EFI_SUCCESS
51 **/
52 EFI_STATUS
53 EFIAPI
54 S3EndOfPeiNotify (
55 IN EFI_PEI_SERVICES **PeiServices,
56 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDesc,
57 IN VOID *Ppi
58 )
59 {
60 NOTIFY_PHASE_PARAMS NotifyPhaseParams;
61 EFI_STATUS Status;
62 FSP_INFO_HEADER *FspHeader;
63
64 FspHeader = FspFindFspHeader (PcdGet32 (PcdFlashFvFspBase));
65 if (FspHeader == NULL) {
66 return EFI_DEVICE_ERROR;
67 }
68
69 DEBUG ((DEBUG_INFO, "S3EndOfPeiNotify enter\n"));
70
71 NotifyPhaseParams.Phase = EnumInitPhaseAfterPciEnumeration;
72 Status = CallFspNotifyPhase (FspHeader, &NotifyPhaseParams);
73 DEBUG((DEBUG_INFO, "FSP S3NotifyPhase AfterPciEnumeration status: 0x%x\n", Status));
74
75 NotifyPhaseParams.Phase = EnumInitPhaseReadyToBoot;
76 Status = CallFspNotifyPhase (FspHeader, &NotifyPhaseParams);
77 DEBUG((DEBUG_INFO, "FSP S3NotifyPhase ReadyToBoot status: 0x%x\n", Status));
78
79 return EFI_SUCCESS;
80 }