]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/PeiPiLib/PeiPiLib.c
Merge branch of PI tree to main trunk
[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
25
26 STATIC CONST EFI_PEI_FIRMWARE_VOLUME_INFO_PPI mFvInfoPpiTemplate = {
27 EFI_FIRMWARE_FILE_SYSTEM2_GUID,
28 NULL,
29 0, //FvInfoSize
30 NULL, //ParentFvName
31 NULL //ParentFileName;
32 };
33
34 VOID
35 EFIAPI
36 PeiPiLibBuildPiFvInfoPpi (
37 IN EFI_PHYSICAL_ADDRESS FvStart,
38 IN UINT64 FvLength,
39 IN EFI_GUID *ParentFvName,
40 IN EFI_GUID *ParentFileName
41 ) {
42
43 EFI_STATUS Status;
44 EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *FvInfoPpi;
45 EFI_PEI_PPI_DESCRIPTOR *FvInfoPpiDescriptor;
46
47 FvInfoPpi = AllocateCopyPool (sizeof (*FvInfoPpi), &mFvInfoPpiTemplate);
48 ASSERT( FvInfoPpi != NULL);
49
50 FvInfoPpi->FvInfo = (VOID *) (UINTN) FvStart;
51 FvInfoPpi->FvInfoSize = (UINT32) FvLength;
52 FvInfoPpi->ParentFvName = ParentFvName;
53 FvInfoPpi->ParentFileName = ParentFileName;
54
55
56 FvInfoPpiDescriptor = AllocatePool (sizeof(EFI_PEI_PPI_DESCRIPTOR));
57 ASSERT (FvInfoPpiDescriptor != NULL);
58
59 FvInfoPpiDescriptor->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
60 FvInfoPpiDescriptor->Guid = &gEfiPeiFirmwareVolumeInfoPpiGuid;
61 FvInfoPpiDescriptor->Ppi = (VOID *) FvInfoPpi;
62 Status = PeiServicesInstallPpi (FvInfoPpiDescriptor);
63 ASSERT_EFI_ERROR (Status);
64
65
66 }
67