diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index 9d0262e20c..acc773e928 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -398,12 +398,12 @@ # This PCD is a sample to explain FixedAtBuild UINT32 PCD usage. gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintTimes|1|UINT32|0x40000005 - ## Indicate the max size of the populated capsule image that the platform can support. + ## Indicate the max size of the capsule image with reset flag that the platform can support. # The default max size is 100MB (0x6400000) for more than one large capsule images. gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule|0x6400000|UINT32|0x0001001e - ## Indicate the max size of the non-populated capsule image that the platform can support. - # The default max size is 10MB (0xa00000) for the casule image without populated flag setting. + ## Indicate the max size of the capsule image without reset flag that the platform can support. + # The default max size is 10MB (0xa00000) for the casule image without reset flag setting. gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|0xa00000|UINT32|0x0001001f ## Null-terminated Unicode string of the firmware vendor name that is default name filled into the EFI System Table diff --git a/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.c b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.c index a3b53262ef..76b2a2a8fc 100644 --- a/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.c +++ b/MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.c @@ -238,6 +238,7 @@ QueryCapsuleCapabilities ( { UINTN ArrayNumber; EFI_CAPSULE_HEADER *CapsuleHeader; + BOOLEAN NeedReset; // // Capsule Count can't be less than one. @@ -254,6 +255,7 @@ QueryCapsuleCapabilities ( } CapsuleHeader = NULL; + NeedReset = FALSE; for (ArrayNumber = 0; ArrayNumber < CapsuleCount; ArrayNumber++) { CapsuleHeader = CapsuleHeaderArray[ArrayNumber]; @@ -281,31 +283,31 @@ QueryCapsuleCapabilities ( } // - // Assume that capsules have the same flags on reseting or not. + // Find out whether there is any capsule defined to persist across system reset. // - CapsuleHeader = CapsuleHeaderArray[0]; - if ((CapsuleHeader->Flags & CAPSULE_FLAGS_PERSIST_ACROSS_RESET) != 0) { + for (ArrayNumber = 0; ArrayNumber < CapsuleCount ; ArrayNumber++) { + CapsuleHeader = CapsuleHeaderArray[ArrayNumber]; + if ((CapsuleHeader->Flags & CAPSULE_FLAGS_PERSIST_ACROSS_RESET) != 0) { + NeedReset = TRUE; + break; + } + } + + if (NeedReset) { // //Check if the platform supports update capsule across a system reset // if (!FeaturePcdGet(PcdSupportUpdateCapsuleReset)) { return EFI_UNSUPPORTED; } - *ResetType = EfiResetWarm; + *ResetType = EfiResetWarm; + *MaxiumCapsuleSize = FixedPcdGet32(PcdMaxSizePopulateCapsule); } else { // // For non-reset capsule image. // *ResetType = EfiResetCold; - } - - // - // The support max capsule image size - // - if ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) != 0) { - *MaxiumCapsuleSize = PcdGet32(PcdMaxSizePopulateCapsule); - } else { - *MaxiumCapsuleSize = PcdGet32(PcdMaxSizeNonPopulateCapsule); + *MaxiumCapsuleSize = FixedPcdGet32(PcdMaxSizeNonPopulateCapsule); } return EFI_SUCCESS;