]> git.proxmox.com Git - mirror_edk2.git/commitdiff
After PeiCore is shadowed into permanent memory, the pointers to build-in Ffs2 FvPpi...
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 3 Dec 2009 02:48:05 +0000 (02:48 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 3 Dec 2009 02:48:05 +0000 (02:48 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9508 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
MdeModulePkg/Core/Pei/FwVol/FwVol.c
MdeModulePkg/Core/Pei/PeiMain.h

index 4661d779d97199219bcfb2424ae4a4ff7e4eadf1..f671c18031ddd2d359e10e63994a068c30f6b675 100644 (file)
@@ -721,6 +721,8 @@ InitializeDispatcherData (
   if (OldCoreData == NULL) {\r
     PrivateData->PeimDispatcherReenter = FALSE;\r
     PeiInitializeFv (PrivateData, SecCoreData);\r
+  } else {\r
+       PeiReinitializeFv (PrivateData);\r
   }\r
 \r
   return;\r
index 7af67481f6f1b897dfd614d2a50697d7144d2d50..c684b9466eb38dcece6386f5ad1f8f798f2d784d 100644 (file)
@@ -1374,3 +1374,51 @@ FindNextCoreFvHandle (
 \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
index c8561d52e1cfffba738fd91fe2e038ff6432acfa..c6b41b6aaa328e1167fa52796947b5f13f82c1a6 100644 (file)
@@ -1066,4 +1066,17 @@ FindNextCoreFvHandle (
   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