]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/PeiPiLib/PeiPiLib.c
Code Scrub the common includes in MdePkg.
[mirror_edk2.git] / MdePkg / Library / PeiPiLib / PeiPiLib.c
index 49894dfe4d3d319ef4da38f93ad5b874018444bf..a76a29bf3a16ed2eb8f3699265514ee73176e645 100644 (file)
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/PeiServicesLib.h>\r
 #include <Library/PeiPiLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
 \r
 \r
-STATIC CONST EFI_PEI_FIRMWARE_VOLUME_INFO_PPI mFvInfoPpiTemplate = {\r
+CONST EFI_PEI_FIRMWARE_VOLUME_INFO_PPI mFvInfoPpiTemplate = {\r
   EFI_FIRMWARE_FILE_SYSTEM2_GUID,\r
   NULL,\r
   0,    //FvInfoSize\r
@@ -31,14 +32,35 @@ STATIC CONST EFI_PEI_FIRMWARE_VOLUME_INFO_PPI mFvInfoPpiTemplate = {
   NULL //ParentFileName;\r
 };\r
 \r
+/**\r
+    Install a EFI_PEI_FIRMWARE_VOLUME_INFO PPI to inform PEI core about the existence of a new Firmware Volume.\r
+  \r
+    The function allocate the EFI_PEI_PPI_DESCRIPTOR structure and update the fields accordingly to parameter passed\r
+    in and install the PPI.\r
+    \r
+    @param  FvFormat             Unique identifier of the format of the memory-mapped firmware volume. If NULL is specified,\r
+                                         EFI_FIRMWARE_FILE_SYSTEM2_GUID is used as the Format GUID.\r
+    @param  FvInfo               Points to a buffer which allows the EFI_PEI_FIRMWARE_VOLUME_PPI to\r
+                                         process the volume. The format of this buffer is specific to the FvFormat. For\r
+                                         memory-mapped firmware volumes, this typically points to the first byte of the\r
+                                         firmware volume.\r
+    @param  FvInfoSize          Size of the data provided by FvInfo. For memory-mapped firmware volumes, this is\r
+                                         typically the size of the firmware volume.\r
+    @param  ParentFvName, ParentFileName      If the firmware volume originally came from a firmware file, then these point to the\r
+                                          parent firmware volume name and firmware volume file. If it did not originally come\r
+                                          from a firmware file, these should be NULL\r
+  \r
+**/\r
 VOID\r
 EFIAPI\r
-PeiPiLibBuildPiFvInfoPpi (\r
-  IN EFI_PHYSICAL_ADDRESS    FvStart,\r
-  IN UINT64                  FvLength,\r
-  IN EFI_GUID                *ParentFvName,\r
-  IN EFI_GUID                *ParentFileName\r
-  ) {\r
+PiLibInstallFvInfoPpi (\r
+  IN EFI_GUID                *FvFormat, OPTIONAL\r
+  IN VOID                    *FvInfo,\r
+  IN UINT32                  FvInfoSize,\r
+  IN EFI_GUID                *ParentFvName, OPTIONAL\r
+  IN EFI_GUID                *ParentFileName OPTIONAL\r
+  )\r
+{\r
   \r
   EFI_STATUS                       Status;   \r
   EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *FvInfoPpi;\r
@@ -47,8 +69,11 @@ PeiPiLibBuildPiFvInfoPpi (
   FvInfoPpi = AllocateCopyPool (sizeof (*FvInfoPpi), &mFvInfoPpiTemplate);\r
   ASSERT( FvInfoPpi != NULL);\r
 \r
-  FvInfoPpi->FvInfo = (VOID *) (UINTN) FvStart;\r
-  FvInfoPpi->FvInfoSize = (UINT32) FvLength;\r
+  if (FvFormat != NULL) {\r
+    CopyMem (&FvInfoPpi->FvFormat, FvFormat, sizeof (*FvFormat));\r
+  }\r
+  FvInfoPpi->FvInfo = (VOID *) (UINTN) FvInfo;\r
+  FvInfoPpi->FvInfoSize = (UINT32) FvInfoSize;\r
   FvInfoPpi->ParentFvName = ParentFvName;\r
   FvInfoPpi->ParentFileName = ParentFileName;\r
 \r
@@ -62,6 +87,5 @@ PeiPiLibBuildPiFvInfoPpi (
   Status = PeiServicesInstallPpi (FvInfoPpiDescriptor);\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-   \r
 }\r
 \r