]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/PeiPiLib/PeiPiLib.c
0) Change the PEI core behavior to not install FV HOB for each FV INFO PPI installed...
[mirror_edk2.git] / MdePkg / Library / PeiPiLib / PeiPiLib.c
1 /** @file
2 MDE PI library functions and macros for PEI phase
3
4 Copyright (c) 2007, Intel Corporation
5 All rights reserved. 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 <Ppi/FirmwareVolumeInfo.h>
17 #include <Guid/FirmwareFileSystem2.h>
18
19
20 #include <Library/DebugLib.h>
21 #include <Library/MemoryAllocationLib.h>
22 #include <Library/PeiServicesLib.h>
23 #include <Library/PeiPiLib.h>
24 #include <Library/BaseMemoryLib.h>
25
26
27 CONST EFI_PEI_FIRMWARE_VOLUME_INFO_PPI mFvInfoPpiTemplate = {
28 EFI_FIRMWARE_FILE_SYSTEM2_GUID,
29 NULL,
30 0, //FvInfoSize
31 NULL, //ParentFvName
32 NULL //ParentFileName;
33 };
34
35 VOID
36 EFIAPI
37 PiLibInstallFvInfoPpi (
38 IN EFI_GUID *FvFormat, OPTIONAL
39 IN VOID *FvInfo,
40 IN UINT32 FvInfoSize,
41 IN EFI_GUID *ParentFvName, OPTIONAL
42 IN EFI_GUID *ParentFileName OPTIONAL
43 ) {
44
45 EFI_STATUS Status;
46 EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *FvInfoPpi;
47 EFI_PEI_PPI_DESCRIPTOR *FvInfoPpiDescriptor;
48
49 FvInfoPpi = AllocateCopyPool (sizeof (*FvInfoPpi), &mFvInfoPpiTemplate);
50 ASSERT( FvInfoPpi != NULL);
51
52 if (FvFormat != NULL) {
53 CopyMem (&FvInfoPpi->FvFormat, FvFormat, sizeof (*FvFormat));
54 }
55 FvInfoPpi->FvInfo = (VOID *) (UINTN) FvInfo;
56 FvInfoPpi->FvInfoSize = (UINT32) FvInfoSize;
57 FvInfoPpi->ParentFvName = ParentFvName;
58 FvInfoPpi->ParentFileName = ParentFileName;
59
60
61 FvInfoPpiDescriptor = AllocatePool (sizeof(EFI_PEI_PPI_DESCRIPTOR));
62 ASSERT (FvInfoPpiDescriptor != NULL);
63
64 FvInfoPpiDescriptor->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
65 FvInfoPpiDescriptor->Guid = &gEfiPeiFirmwareVolumeInfoPpiGuid;
66 FvInfoPpiDescriptor->Ppi = (VOID *) FvInfoPpi;
67 Status = PeiServicesInstallPpi (FvInfoPpiDescriptor);
68 ASSERT_EFI_ERROR (Status);
69
70 }
71