2 MDE PI library functions and macros for PEI phase
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
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.
16 #include <Ppi/FirmwareVolumeInfo.h>
17 #include <Guid/FirmwareFileSystem2.h>
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>
27 CONST EFI_PEI_FIRMWARE_VOLUME_INFO_PPI mFvInfoPpiTemplate
= {
28 EFI_FIRMWARE_FILE_SYSTEM2_GUID
,
32 NULL
//ParentFileName;
37 PiLibInstallFvInfoPpi (
38 IN EFI_GUID
*FvFormat
, OPTIONAL
41 IN EFI_GUID
*ParentFvName
, OPTIONAL
42 IN EFI_GUID
*ParentFileName OPTIONAL
46 EFI_PEI_FIRMWARE_VOLUME_INFO_PPI
*FvInfoPpi
;
47 EFI_PEI_PPI_DESCRIPTOR
*FvInfoPpiDescriptor
;
49 FvInfoPpi
= AllocateCopyPool (sizeof (*FvInfoPpi
), &mFvInfoPpiTemplate
);
50 ASSERT( FvInfoPpi
!= NULL
);
52 if (FvFormat
!= NULL
) {
53 CopyMem (&FvInfoPpi
->FvFormat
, FvFormat
, sizeof (*FvFormat
));
55 FvInfoPpi
->FvInfo
= (VOID
*) (UINTN
) FvInfo
;
56 FvInfoPpi
->FvInfoSize
= (UINT32
) FvInfoSize
;
57 FvInfoPpi
->ParentFvName
= ParentFvName
;
58 FvInfoPpi
->ParentFileName
= ParentFileName
;
61 FvInfoPpiDescriptor
= AllocatePool (sizeof(EFI_PEI_PPI_DESCRIPTOR
));
62 ASSERT (FvInfoPpiDescriptor
!= NULL
);
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
);