]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/PeiPiLib/PeiPiLib.c
Code Scrub the common includes in MdePkg.
[mirror_edk2.git] / MdePkg / Library / PeiPiLib / PeiPiLib.c
CommitLineData
b0d803fe 1/** @file\r
2 MDE PI library functions and macros for PEI phase\r
3\r
4 Copyright (c) 2007, Intel Corporation \r
5 All rights reserved. This program and the accompanying materials \r
6 are licensed and made available under the terms and conditions of the BSD License \r
7 which accompanies this distribution. The full text of the license may be found at \r
8 http://opensource.org/licenses/bsd-license.php \r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12\r
13**/\r
14\r
15#include <PiPei.h>\r
16#include <Ppi/FirmwareVolumeInfo.h>\r
17#include <Guid/FirmwareFileSystem2.h>\r
18\r
19\r
20#include <Library/DebugLib.h>\r
21#include <Library/MemoryAllocationLib.h>\r
22#include <Library/PeiServicesLib.h>\r
23#include <Library/PeiPiLib.h>\r
166152e8 24#include <Library/BaseMemoryLib.h>\r
b0d803fe 25\r
26\r
166152e8 27CONST EFI_PEI_FIRMWARE_VOLUME_INFO_PPI mFvInfoPpiTemplate = {\r
b0d803fe 28 EFI_FIRMWARE_FILE_SYSTEM2_GUID,\r
29 NULL,\r
30 0, //FvInfoSize\r
31 NULL, //ParentFvName\r
32 NULL //ParentFileName;\r
33};\r
34\r
8069d49e
LG
35/**\r
36 Install a EFI_PEI_FIRMWARE_VOLUME_INFO PPI to inform PEI core about the existence of a new Firmware Volume.\r
37 \r
38 The function allocate the EFI_PEI_PPI_DESCRIPTOR structure and update the fields accordingly to parameter passed\r
39 in and install the PPI.\r
40 \r
41 @param FvFormat Unique identifier of the format of the memory-mapped firmware volume. If NULL is specified,\r
42 EFI_FIRMWARE_FILE_SYSTEM2_GUID is used as the Format GUID.\r
43 @param FvInfo Points to a buffer which allows the EFI_PEI_FIRMWARE_VOLUME_PPI to\r
44 process the volume. The format of this buffer is specific to the FvFormat. For\r
45 memory-mapped firmware volumes, this typically points to the first byte of the\r
46 firmware volume.\r
47 @param FvInfoSize Size of the data provided by FvInfo. For memory-mapped firmware volumes, this is\r
48 typically the size of the firmware volume.\r
49 @param ParentFvName, ParentFileName If the firmware volume originally came from a firmware file, then these point to the\r
50 parent firmware volume name and firmware volume file. If it did not originally come\r
51 from a firmware file, these should be NULL\r
52 \r
8069d49e 53**/\r
b0d803fe 54VOID\r
55EFIAPI\r
166152e8 56PiLibInstallFvInfoPpi (\r
57 IN EFI_GUID *FvFormat, OPTIONAL\r
58 IN VOID *FvInfo,\r
59 IN UINT32 FvInfoSize,\r
60 IN EFI_GUID *ParentFvName, OPTIONAL\r
61 IN EFI_GUID *ParentFileName OPTIONAL\r
5f3fdf98 62 )\r
63{\r
b0d803fe 64 \r
65 EFI_STATUS Status; \r
66 EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *FvInfoPpi;\r
67 EFI_PEI_PPI_DESCRIPTOR *FvInfoPpiDescriptor;\r
68\r
69 FvInfoPpi = AllocateCopyPool (sizeof (*FvInfoPpi), &mFvInfoPpiTemplate);\r
70 ASSERT( FvInfoPpi != NULL);\r
71\r
166152e8 72 if (FvFormat != NULL) {\r
73 CopyMem (&FvInfoPpi->FvFormat, FvFormat, sizeof (*FvFormat));\r
74 }\r
75 FvInfoPpi->FvInfo = (VOID *) (UINTN) FvInfo;\r
76 FvInfoPpi->FvInfoSize = (UINT32) FvInfoSize;\r
b0d803fe 77 FvInfoPpi->ParentFvName = ParentFvName;\r
78 FvInfoPpi->ParentFileName = ParentFileName;\r
79\r
80\r
81 FvInfoPpiDescriptor = AllocatePool (sizeof(EFI_PEI_PPI_DESCRIPTOR));\r
82 ASSERT (FvInfoPpiDescriptor != NULL);\r
83\r
84 FvInfoPpiDescriptor->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;\r
85 FvInfoPpiDescriptor->Guid = &gEfiPeiFirmwareVolumeInfoPpiGuid;\r
86 FvInfoPpiDescriptor->Ppi = (VOID *) FvInfoPpi;\r
87 Status = PeiServicesInstallPpi (FvInfoPpiDescriptor);\r
88 ASSERT_EFI_ERROR (Status);\r
89\r
b0d803fe 90}\r
91\r