]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update PeiCore to handle FvImage with PI FV extension header
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 5 Mar 2009 05:05:57 +0000 (05:05 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 5 Mar 2009 05:05:57 +0000 (05:05 +0000)
Update Capsule PCDs PcdMaxSizePopulateCapsule and  PcdMaxSizeNonPopulateCapsule to the flexible PCD type.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7805 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Core/Pei/Dispatcher/Dispatcher.c
MdeModulePkg/Core/Pei/FwVol/FwVol.c
MdeModulePkg/Core/Pei/PeiMain.h
MdeModulePkg/Core/Pei/PeiMain.inf
MdeModulePkg/Core/Pei/Ppi/Ppi.c
MdeModulePkg/MdeModulePkg.dec
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.c

index db1fe4bc843d9ff2e2331f041faf88223e81b8f0..9caa890082be0d8d568f913e4d08bbb8c5f279ce 100644 (file)
@@ -85,6 +85,12 @@ DiscoverPeimsAndOrderWithApriori (
 \r
     Private->CurrentFvFileHandles[PeimCount] = FileHandle;\r
   }\r
+  \r
+  //\r
+  // Check whether the count of Peims exceeds the max support PEIMs in a FV image\r
+  // If more Peims are required in a FV image, PcdPeiCoreMaxPeimPerFv can be set to a larger value in DSC file.\r
+  //\r
+  ASSERT (PeimCount < FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv));\r
 \r
   Private->AprioriCount = 0;\r
   if (AprioriFileHandle != NULL) {\r
@@ -377,7 +383,7 @@ PeiDispatcher (
               //\r
               // For Fv type file, Produce new FV PPI and FV hob\r
               //\r
-              Status = ProcessFvFile (PeiServices, PeimFileHandle, &AuthenticationState);\r
+              Status = ProcessFvFile (PeiServices, VolumeHandle, PeimFileHandle, &AuthenticationState);\r
             } else {\r
               //\r
               // For PEIM driver, Load its entry point\r
index cf1f8d55f2ebb9ea5c5ed06c4e2468d26a33487b..d4162057e74fcf95585c2b54c10d47e950f6e3fc 100644 (file)
@@ -151,7 +151,6 @@ PeiFindFileEx (
   EFI_FIRMWARE_VOLUME_HEADER           *FwVolHeader;\r
   EFI_FFS_FILE_HEADER                   **FileHeader;\r
   EFI_FFS_FILE_HEADER                   *FfsFileHeader;\r
-  EFI_FIRMWARE_VOLUME_EXT_HEADER        *FwVolExHeaderInfo;\r
   UINT32                                FileLength;\r
   UINT32                                FileOccupiedSize;\r
   UINT32                                FileOffset;\r
@@ -176,10 +175,6 @@ PeiFindFileEx (
   //\r
   if ((*FileHeader == NULL) || (FileName != NULL)) {\r
     FfsFileHeader = (EFI_FFS_FILE_HEADER *)((UINT8 *)FwVolHeader + FwVolHeader->HeaderLength);\r
-    if (FwVolHeader->ExtHeaderOffset != 0) {\r
-      FwVolExHeaderInfo = (EFI_FIRMWARE_VOLUME_EXT_HEADER *)(((UINT8 *)FwVolHeader) + FwVolHeader->ExtHeaderOffset);\r
-      FfsFileHeader = (EFI_FFS_FILE_HEADER *)(((UINT8 *)FwVolExHeaderInfo) + FwVolExHeaderInfo->ExtHeaderSize);\r
-    }\r
   } else {\r
     //\r
     // Length is 24 bits wide so mask upper 8 bits\r
@@ -332,11 +327,16 @@ FirmwareVolmeInfoPpiNotifyCallback (
   PrivateData  = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);\r
 \r
   if (PrivateData->FvCount >= FixedPcdGet32 (PcdPeiCoreMaxFvSupported)) {\r
+    DEBUG ((EFI_D_ERROR, "The number of Fv Images (%d) exceed the max supported FVs (%d) in Pei", PrivateData->FvCount + 1, FixedPcdGet32 (PcdPeiCoreMaxFvSupported)));\r
+    DEBUG ((EFI_D_ERROR, "PcdPeiCoreMaxFvSupported value need be reconfigurated in DSC"));\r
     ASSERT (FALSE);\r
   }\r
 \r
   Fv = (EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *)Ppi;\r
 \r
+  //\r
+  // Only add FileSystem2 Fv to Fv list\r
+  //\r
   if (CompareGuid (&Fv->FvFormat, &gEfiFirmwareFileSystem2Guid)) {\r
     for (FvCount = 0; FvCount < PrivateData->FvCount; FvCount ++) {\r
       if ((UINTN)PrivateData->Fv[FvCount].FvHeader == (UINTN)Fv->FvInfo) {\r
@@ -352,9 +352,6 @@ FirmwareVolmeInfoPpiNotifyCallback (
     \r
     PrivateData->Fv[PrivateData->FvCount++].FvHeader = (EFI_FIRMWARE_VOLUME_HEADER*)Fv->FvInfo;\r
 \r
-    //\r
-    // Only add FileSystem2 Fv to the All list\r
-    //\r
     PrivateData->AllFv[PrivateData->AllFvCount++] = (EFI_PEI_FV_HANDLE)Fv->FvInfo;\r
     \r
     DEBUG ((EFI_D_INFO, "The %dth FvImage start address is 0x%11p and size is 0x%08x\n", (UINT32)PrivateData->AllFvCount, (VOID *) Fv->FvInfo, Fv->FvInfoSize));\r
@@ -387,7 +384,7 @@ FirmwareVolmeInfoPpiNotifyCallback (
         //\r
         // Process FvFile to install FvInfo ppi and build FvHob\r
         // \r
-        ProcessFvFile ((CONST EFI_PEI_SERVICES **) PeiServices, FileHandle, &AuthenticationStatus);\r
+        ProcessFvFile ((CONST EFI_PEI_SERVICES **) PeiServices, (EFI_PEI_FV_HANDLE)Fv->FvInfo, FileHandle, &AuthenticationStatus);\r
       }\r
     } while (FileHandle != NULL);\r
   }\r
@@ -809,6 +806,7 @@ PeiFfsGetVolumeInfo (
   if (FwVolHeader.Signature != EFI_FVH_SIGNATURE) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
+  ZeroMem (VolumeInfo, sizeof (EFI_FV_INFO));\r
   VolumeInfo->FvAttributes = FwVolHeader.Attributes;\r
   VolumeInfo->FvStart = (VOID *) VolumeHandle;\r
   VolumeInfo->FvSize = FwVolHeader.FvLength;\r
@@ -825,7 +823,8 @@ PeiFfsGetVolumeInfo (
   Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.\r
 \r
   @param PeiServices          An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
-  @param FvFileHandle         File handle of a Fv type file.\r
+  @param ParentFvHandle       Fv handle to parent Fv image that contain this Fv image.\r
+  @param ParentFvFileHandle   File handle of a Fv type file that contain this Fv image.\r
   @param AuthenticationState  Pointer to attestation authentication state of image.\r
 \r
 \r
@@ -838,13 +837,15 @@ PeiFfsGetVolumeInfo (
 EFI_STATUS\r
 ProcessFvFile (\r
   IN  CONST EFI_PEI_SERVICES      **PeiServices,\r
-  IN  EFI_PEI_FILE_HANDLE         FvFileHandle,\r
+  IN  EFI_PEI_FV_HANDLE           ParentFvHandle,\r
+  IN  EFI_PEI_FILE_HANDLE         ParentFvFileHandle,\r
   OUT UINT32                      *AuthenticationState\r
   )\r
 {\r
   EFI_STATUS            Status;\r
   EFI_PEI_FV_HANDLE     FvImageHandle;\r
   EFI_FV_INFO           FvImageInfo;\r
+  EFI_FV_INFO           ParentFvImageInfo;\r
   UINT32                FvAlignment;\r
   VOID                  *FvBuffer;\r
   EFI_PEI_HOB_POINTERS  HobPtr;\r
@@ -858,7 +859,7 @@ ProcessFvFile (
   //\r
   HobPtr.Raw = GetHobList ();\r
   while ((HobPtr.Raw = GetNextHob (EFI_HOB_TYPE_FV2, HobPtr.Raw)) != NULL) {\r
-    if (CompareGuid (&(((EFI_FFS_FILE_HEADER *)FvFileHandle)->Name), &HobPtr.FirmwareVolume2->FileName)) {\r
+    if (CompareGuid (&(((EFI_FFS_FILE_HEADER *)ParentFvFileHandle)->Name), &HobPtr.FirmwareVolume2->FileName)) {\r
       //\r
       // this FILE has been dispatched, it will not be dispatched again.\r
       //\r
@@ -873,14 +874,20 @@ ProcessFvFile (
   Status = PeiFfsFindSectionData (\r
              PeiServices,\r
              EFI_SECTION_FIRMWARE_VOLUME_IMAGE,\r
-             FvFileHandle,\r
+             ParentFvFileHandle,\r
              (VOID **)&FvImageHandle\r
              );\r
 \r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-  \r
+\r
+  //\r
+  // Collect Parent FvImage Info.\r
+  //\r
+  Status = PeiFfsGetVolumeInfo (ParentFvHandle, &ParentFvImageInfo);\r
+  ASSERT_EFI_ERROR (Status); \r
\r
   //\r
   // Collect FvImage Info.\r
   //\r
@@ -907,7 +914,8 @@ ProcessFvFile (
     //\r
     // Update FvImageInfo after reload FvImage to new aligned memory\r
     //\r
-    PeiFfsGetVolumeInfo ((EFI_PEI_FV_HANDLE) FvBuffer, &FvImageInfo);\r
+    Status = PeiFfsGetVolumeInfo ((EFI_PEI_FV_HANDLE) FvBuffer, &FvImageInfo);\r
+    ASSERT_EFI_ERROR (Status);\r
   }\r
 \r
   //\r
@@ -917,8 +925,8 @@ ProcessFvFile (
     NULL,\r
     FvImageInfo.FvStart,\r
     (UINT32) FvImageInfo.FvSize,\r
-    &(FvImageInfo.FvName),\r
-    &(((EFI_FFS_FILE_HEADER*)FvFileHandle)->Name)\r
+    &ParentFvImageInfo.FvName,\r
+    &(((EFI_FFS_FILE_HEADER*)ParentFvFileHandle)->Name)\r
     );\r
 \r
   //\r
@@ -936,8 +944,8 @@ ProcessFvFile (
   BuildFv2Hob (\r
     (EFI_PHYSICAL_ADDRESS) (UINTN) FvImageInfo.FvStart,\r
     FvImageInfo.FvSize,\r
-    &FvImageInfo.FvName,\r
-    &(((EFI_FFS_FILE_HEADER *)FvFileHandle)->Name)\r
+    &ParentFvImageInfo.FvName,\r
+    &(((EFI_FFS_FILE_HEADER *)ParentFvFileHandle)->Name)\r
     );\r
 \r
   return EFI_SUCCESS;\r
index e629b2368a40c93d7d0fdf194db9f8d37456a393..453f23023338585e6a273867e0a9f9a566cca5fc 100644 (file)
@@ -1006,7 +1006,8 @@ InitializeImageServices (
   Get Fv image from the FV type file, then install FV INFO ppi, Build FV hob.\r
 \r
   @param PeiServices          An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
-  @param FvFileHandle         File handle of a Fv type file.\r
+  @param ParentFvHandle       Fv handle to parent Fv image that contain this Fv file.\r
+  @param ParentFvFileHandle   File handle of a Fv type file that contain this Fv image.\r
   @param AuthenticationState  Pointer to attestation authentication state of image.\r
                               If return 0, means pass security checking.\r
 \r
@@ -1017,7 +1018,8 @@ InitializeImageServices (
 EFI_STATUS\r
 ProcessFvFile (\r
   IN  CONST EFI_PEI_SERVICES **PeiServices,\r
-  IN  EFI_PEI_FILE_HANDLE    FvFileHandle,\r
+  IN  EFI_PEI_FV_HANDLE      ParentFvHandle,\r
+  IN  EFI_PEI_FILE_HANDLE    ParentFvFileHandle,\r
   OUT UINT32                 *AuthenticationState\r
   );\r
 \r
index 52b0bf21cac491e4aa430006eb315dcc7f41116c..7a95ce0ae3d560c6f68d905469776409ae9e2de8 100644 (file)
@@ -88,7 +88,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported       ## CONSUMES\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeimPerFv         ## CONSUMES\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPpiSupported      ## CONSUMES\r
-  gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValuePeimDispatch          ## CONSUMES\r
+  gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValuePeimDispatch            ## CONSUMES\r
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValuePeiCoreEntry       ## CONSUMES\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxPeiStackSize      ## CONSUMES\r
 \r
index 6feab63412f44d8d4c932145abe81e65618b0834..ffed6cf2dd77df70e39d84591fae5d0f4b5201ae 100644 (file)
@@ -151,6 +151,7 @@ PeiInstallPpi (
     //\r
     // Since PpiData is used for NotifyList and PpiList, max resource\r
     // is reached if the Install reaches the NotifyList\r
+    // PcdPeiCoreMaxPpiSupported can be set to a larger value in DSC to satisfy more PPI requirement.\r
     //\r
     if (Index == PrivateData->PpiData.NotifyListEnd + 1) {\r
       return  EFI_OUT_OF_RESOURCES;\r
@@ -392,6 +393,7 @@ PeiNotifyPpi (
     //\r
     // Since PpiData is used for NotifyList and InstallList, max resource\r
     // is reached if the Install reaches the PpiList\r
+    // PcdPeiCoreMaxPpiSupported can be set to a larger value in DSC to satisfy more Notify PPIs requirement.\r
     //\r
     if (Index == PrivateData->PpiData.PpiListEnd - 1) {\r
       return  EFI_OUT_OF_RESOURCES;\r
index 9aa71b0b6ed64ec749109cbae51a429002448a76..18dc6cf3812448956f4782a27c7772b82b3e36a6 100644 (file)
 \r
 [LibraryClasses.common]\r
   ##  @libraryclass  IpIo layer upon EFI IP4 Protocol.\r
+  #   Ihis library is only intended to be used by UEFI network stack modules.\r
   IpIoLib|Include/Library/IpIoLib.h\r
   \r
   ##  @libraryclass  Basic function for UEFI network stack.\r
+  #   Ihis library is only intended to be used by UEFI network stack modules.\r
   NetLib|Include/Library/NetLib.h\r
-\r
-  ##  @libraryclass  Defines a set of methods to reset whole system.\r
-  ResetSystemLib|Include/Library/ResetSystemLib.h\r
   \r
   ##  @libraryclass  The helper routines to access UDP service.\r
+  #   Ihis library is only intended to be used by UEFI network stack modules.\r
   UdpIoLib|Include/Library/UdpIoLib.h\r
   \r
+  ##  @libraryclass  Defines a set of methods to reset whole system.\r
+  ResetSystemLib|Include/Library/ResetSystemLib.h\r
+\r
   ##  @libraryclass  Defines a set of methods related do S3 mode.\r
   S3Lib|Include/Library/S3Lib.h\r
   \r
@@ -48,6 +51,7 @@
   RecoveryLib|Include/Library/RecoveryLib.h\r
   \r
   ##  @libraryclass  Basic platform driver override functions.\r
+  #   Ihis library is only intended to be used by Platform Driver Override Dxe Driver and Application.\r
   PlatformDriverOverrideLib|Include/Library/PlatformDriverOverrideLib.h\r
 \r
   ##  @libraryclass  Provides HII related functions.\r
   gPcdDataBaseHobGuid            = { 0xEA296D92, 0x0B69, 0x423C, { 0x8C, 0x28, 0x33, 0xB4, 0xE0, 0xA9, 0x12, 0x68 }}\r
   \r
   ## Guid for EDKII implementation GUIDed opcodes\r
+  #  Include/Guid/MdeModuleHii.h\r
   gEfiIfrTianoGuid      = { 0xf0b1735, 0x87a0, 0x4193, {0xb2, 0x66, 0x53, 0x8c, 0x38, 0xaf, 0x48, 0xce }}\r
   \r
   ## Guid for Framework vfr GUIDed opcodes.\r
+  #  Include/Guid/MdeModuleHii.h\r
   gEfiIfrFrameworkGuid  = { 0x31ca5d1a, 0xd511, 0x4931, { 0xb7, 0x82, 0xae, 0x6b, 0x2b, 0x17, 0x8c, 0xd7 }}\r
   \r
   ## Guid to specify the System Non Volatile FV\r
   #  to store PCD value. \r
   #\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress|0x0|UINT32|0x00010010\r
-  \r
-  ## Indicate the max size of the populated capsule image that the platform can support.\r
-  #  The default max size is 100MB (0x6400000) for more than one large capsule images. \r
-  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule|0x6400000|UINT32|0x0001001e\r
-  \r
-  ## Indicate the max size of the non-populated capsule image that the platform can support.\r
-  #  The default max size is 10MB (0xa00000) for the casule image without populated flag setting.\r
-  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|0xa00000|UINT32|0x0001001f\r
-  \r
+    \r
   ## Maximum number of FV is supported by PeiCore's dispatching.\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported|6|UINT32|0x00010030\r
 \r
   ##\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintTimes|1|UINT32|0x40000005\r
 \r
+  ## Indicate the max size of the populated capsule image that the platform can support.\r
+  #  The default max size is 100MB (0x6400000) for more than one large capsule images. \r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule|0x6400000|UINT32|0x0001001e\r
+  \r
+  ## Indicate the max size of the non-populated capsule image that the platform can support.\r
+  #  The default max size is 10MB (0xa00000) for the casule image without populated flag setting.\r
+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|0xa00000|UINT32|0x0001001f\r
+\r
 [PcdsFixedAtBuild,PcdsPatchableInModule]\r
   ## Maximun number of performance log entries during PEI phase.\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPerformanceLogEntries|40|UINT8|0x0001002f\r
index 8aadd1af85c9c472f4c49ea6cc25a138e46bd8c1..2ab29ba339b2cd3f759328de622f1fe7c397e0c5 100644 (file)
@@ -55,7 +55,7 @@
 [FeaturePcd]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdSupportUpdateCapsuleReset\r
 \r
-[FixedPcd]\r
+[Pcd]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule || PcdSupportUpdateCapsuleReset  ## Populate Image requires reset support.\r
 \r
index f0e82ae602872a5b43d43795621e4ae64448fa68..2bf456cd9744cd9c1767040ad9edc58f015c4615 100644 (file)
@@ -247,9 +247,9 @@ QueryCapsuleCapabilities (
   // The support max capsule image size\r
   //\r
   if ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) != 0) {\r
-    *MaxiumCapsuleSize = FixedPcdGet32(PcdMaxSizePopulateCapsule);\r
+    *MaxiumCapsuleSize = PcdGet32(PcdMaxSizePopulateCapsule);\r
   } else {\r
-    *MaxiumCapsuleSize = FixedPcdGet32(PcdMaxSizeNonPopulateCapsule);\r
+    *MaxiumCapsuleSize = PcdGet32(PcdMaxSizeNonPopulateCapsule);\r
   }\r
 \r
   return EFI_SUCCESS;\r