]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/PlatformPei/Fv.c
OvmfPkg/PlatformPei: Allocate PEI FV as ACPI NVS if S3 is supported
[mirror_edk2.git] / OvmfPkg / PlatformPei / Fv.c
1 /** @file
2 Build FV related hobs for platform.
3
4 Copyright (c) 2006 - 2013, 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 #include "PiPei.h"
16 #include "Platform.h"
17 #include <Library/DebugLib.h>
18 #include <Library/HobLib.h>
19 #include <Library/PeiServicesLib.h>
20 #include <Library/PcdLib.h>
21
22
23 /**
24 Publish PEI & DXE (Decompressed) Memory based FVs to let PEI
25 and DXE know about them.
26
27 @retval EFI_SUCCESS Platform PEI FVs were initialized successfully.
28
29 **/
30 EFI_STATUS
31 PeiFvInitialization (
32 VOID
33 )
34 {
35 DEBUG ((EFI_D_INFO, "Platform PEI Firmware Volume Initialization\n"));
36
37 //
38 // Create a memory allocation HOB for the PEI FV.
39 //
40 // Allocate as ACPI NVS is S3 is supported
41 //
42 BuildMemoryAllocationHob (
43 PcdGet32 (PcdOvmfPeiMemFvBase),
44 PcdGet32 (PcdOvmfPeiMemFvSize),
45 mS3Supported ? EfiACPIMemoryNVS : EfiBootServicesData
46 );
47
48 //
49 // Let DXE know about the DXE FV
50 //
51 BuildFvHob (PcdGet32 (PcdOvmfDxeMemFvBase), PcdGet32 (PcdOvmfDxeMemFvSize));
52
53 //
54 // Create a memory allocation HOB for the DXE FV.
55 //
56 BuildMemoryAllocationHob (
57 PcdGet32 (PcdOvmfDxeMemFvBase),
58 PcdGet32 (PcdOvmfDxeMemFvSize),
59 EfiBootServicesData
60 );
61
62 //
63 // Let PEI know about the DXE FV so it can find the DXE Core
64 //
65 PeiServicesInstallFvInfoPpi (
66 NULL,
67 (VOID *)(UINTN) PcdGet32 (PcdOvmfDxeMemFvBase),
68 PcdGet32 (PcdOvmfDxeMemFvSize),
69 NULL,
70 NULL
71 );
72
73 return EFI_SUCCESS;
74 }
75