\r
return &Private->Fv[Instance];\r
} \r
+\r
+/**\r
+ After PeiCore image is shadowed into permanent memory, all build-in FvPpi should\r
+ be re-installed with the instance in permanent memory and all cached FvPpi pointers in \r
+ PrivateData->Fv[] array should be fixed up to be pointed to the one in permenant\r
+ memory.\r
+ \r
+ @param PrivateData Pointer to PEI_CORE_INSTANCE.\r
+**/ \r
+VOID\r
+PeiReinitializeFv (\r
+ IN PEI_CORE_INSTANCE *PrivateData\r
+ )\r
+{\r
+ VOID *OldFfs2FvPpi;\r
+ EFI_PEI_PPI_DESCRIPTOR *OldDescriptor;\r
+ UINTN Index;\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // Locate old build-in Ffs2 EFI_PEI_FIRMWARE_VOLUME_PPI which\r
+ // in flash.\r
+ // \r
+ Status = PeiServicesLocatePpi (\r
+ &gEfiFirmwareFileSystem2Guid,\r
+ 0,\r
+ &OldDescriptor,\r
+ &OldFfs2FvPpi\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+ //\r
+ // Re-install the EFI_PEI_FIRMWARE_VOLUME_PPI for build-in Ffs2\r
+ // which is shadowed from flash to permanent memory within PeiCore image.\r
+ //\r
+ Status = PeiServicesReInstallPpi (OldDescriptor, &mPeiFfs2FvPpiList);\r
+ ASSERT_EFI_ERROR (Status);\r
+ \r
+ //\r
+ // Fixup all FvPpi pointers for the implementation in flash to permanent memory.\r
+ //\r
+ for (Index = 0; Index < FixedPcdGet32 (PcdPeiCoreMaxFvSupported); Index ++) {\r
+ if (PrivateData->Fv[Index].FvPpi == OldFfs2FvPpi) {\r
+ PrivateData->Fv[Index].FvPpi = &mPeiFfs2FvPpi;\r
+ }\r
+ }\r
+} \r
+\r
IN UINTN Instance\r
);\r
\r
+/**\r
+ After PeiCore image is shadowed into permanent memory, all build-in FvPpi should\r
+ be re-installed with the instance in permanent memory and all cached FvPpi pointers in \r
+ PrivateData->Fv[] array should be fixed up to be pointed to the one in permenant\r
+ memory.\r
+ \r
+ @param PrivateData Pointer to PEI_CORE_INSTANCE.\r
+**/ \r
+VOID\r
+PeiReinitializeFv (\r
+ IN PEI_CORE_INSTANCE *PrivateData\r
+ );\r
+ \r
#endif\r