]>
Commit | Line | Data |
---|---|---|
b0d803fe | 1 | /** @file\r |
2 | MDE PI library functions and macros for PEI phase\r | |
3 | \r | |
23a2150b | 4 | Copyright (c) 2007 - 2008, Intel Corporation \r |
b0d803fe | 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 |
23a2150b | 26 | CONST EFI_PEI_PPI_DESCRIPTOR mPpiListTemplate [] = {\r |
27 | {\r | |
28 | (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r | |
29 | &gEfiPeiFirmwareVolumeInfoPpiGuid,\r | |
30 | NULL\r | |
31 | }\r | |
b0d803fe | 32 | };\r |
33 | \r | |
8069d49e | 34 | /**\r |
f944ec32 | 35 | Install a EFI_PEI_FIRMWARE_VOLUME_INFO PPI to inform PEI core about the existence of a new Firmware Volume.\r |
8069d49e | 36 | \r |
f944ec32 | 37 | The function allocate the EFI_PEI_PPI_DESCRIPTOR structure and update the fields accordingly to parameter passed\r |
38 | in and install the PPI.\r | |
8069d49e | 39 | \r |
f944ec32 | 40 | @param FvFormat Unique identifier of the format of the memory-mapped firmware volume. \r |
41 | If NULL is specified, EFI_FIRMWARE_FILE_SYSTEM2_GUID is used as the Format GUID.\r | |
42 | @param FvInfo Points to a buffer which allows the EFI_PEI_FIRMWARE_VOLUME_PPI to\r | |
43 | process the volume. The format of this buffer is specific to the FvFormat. For\r | |
44 | memory-mapped firmware volumes, this typically points to the first byte of the\r | |
45 | firmware volume.\r | |
46 | @param FvInfoSize Size of the data provided by FvInfo. For memory-mapped firmware volumes, this is\r | |
47 | typically the size of the firmware volume.\r | |
48 | @param ParentFvName If the firmware volume originally came from a firmware file, then these point to the\r | |
49 | parent firmware volume name. If it did not originally come from a firmware file, \r | |
50 | these should be NULL.\r | |
51 | @param ParentFileName If the firmware volume originally came from a firmware file, then these point to the\r | |
52 | firmware volume file. If it did not originally come from a firmware file, \r | |
53 | these should be NULL.\r | |
54 | \r | |
8069d49e | 55 | **/\r |
b0d803fe | 56 | VOID\r |
57 | EFIAPI\r | |
166152e8 | 58 | PiLibInstallFvInfoPpi (\r |
23a2150b | 59 | IN CONST EFI_GUID *FvFormat, OPTIONAL\r |
60 | IN CONST VOID *FvInfo,\r | |
61 | IN UINT32 FvInfoSize,\r | |
62 | IN CONST EFI_GUID *ParentFvName, OPTIONAL\r | |
63 | IN CONST EFI_GUID *ParentFileName OPTIONAL\r | |
5f3fdf98 | 64 | )\r |
65 | {\r | |
b0d803fe | 66 | EFI_STATUS Status; \r |
67 | EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *FvInfoPpi;\r | |
68 | EFI_PEI_PPI_DESCRIPTOR *FvInfoPpiDescriptor;\r | |
69 | \r | |
23a2150b | 70 | FvInfoPpi = AllocateZeroPool (sizeof (EFI_PEI_FIRMWARE_VOLUME_INFO_PPI));\r |
b0d803fe | 71 | ASSERT( FvInfoPpi != NULL);\r |
72 | \r | |
166152e8 | 73 | if (FvFormat != NULL) {\r |
23a2150b | 74 | CopyGuid (&FvInfoPpi->FvFormat, FvFormat);\r |
75 | } else {\r | |
76 | CopyGuid (&FvInfoPpi->FvFormat, &gEfiFirmwareFileSystem2Guid);\r | |
166152e8 | 77 | }\r |
23a2150b | 78 | FvInfoPpi->FvInfo = (VOID *) FvInfo;\r |
79 | FvInfoPpi->FvInfoSize = FvInfoSize;\r | |
80 | FvInfoPpi->ParentFvName = (EFI_GUID *) ParentFvName;\r | |
81 | FvInfoPpi->ParentFileName = (EFI_GUID *) ParentFileName;\r | |
b0d803fe | 82 | \r |
83 | \r | |
23a2150b | 84 | FvInfoPpiDescriptor = AllocateCopyPool (sizeof(EFI_PEI_PPI_DESCRIPTOR), mPpiListTemplate);\r |
b0d803fe | 85 | ASSERT (FvInfoPpiDescriptor != NULL);\r |
86 | \r | |
b0d803fe | 87 | FvInfoPpiDescriptor->Ppi = (VOID *) FvInfoPpi;\r |
88 | Status = PeiServicesInstallPpi (FvInfoPpiDescriptor);\r | |
89 | ASSERT_EFI_ERROR (Status);\r | |
90 | \r | |
b0d803fe | 91 | }\r |
92 | \r |