Update QueryCapsuleCapabilities interface.

1. Check all capsules to decide reset type instead of only checking the first capsule.
2. One purpose of MaxiumCapsuleSize is to ensure platform memory size is enough to handle capsule with reset type in PEI. Max capsule size should be returned for with/without reset flag cases. 

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10514 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
li-elvin
2010-05-19 02:31:41 +00:00
parent 9c4a5f7423
commit 0ef42f8819
2 changed files with 18 additions and 16 deletions

View File

@ -398,12 +398,12 @@
# This PCD is a sample to explain FixedAtBuild UINT32 PCD usage. # This PCD is a sample to explain FixedAtBuild UINT32 PCD usage.
gEfiMdeModulePkgTokenSpaceGuid.PcdHelloWorldPrintTimes|1|UINT32|0x40000005 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. # The default max size is 100MB (0x6400000) for more than one large capsule images.
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule|0x6400000|UINT32|0x0001001e gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule|0x6400000|UINT32|0x0001001e
## Indicate the max size of the non-populated capsule image that the platform can support. ## 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 populated flag setting. # The default max size is 10MB (0xa00000) for the casule image without reset flag setting.
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|0xa00000|UINT32|0x0001001f gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|0xa00000|UINT32|0x0001001f
## Null-terminated Unicode string of the firmware vendor name that is default name filled into the EFI System Table ## Null-terminated Unicode string of the firmware vendor name that is default name filled into the EFI System Table

View File

@ -238,6 +238,7 @@ QueryCapsuleCapabilities (
{ {
UINTN ArrayNumber; UINTN ArrayNumber;
EFI_CAPSULE_HEADER *CapsuleHeader; EFI_CAPSULE_HEADER *CapsuleHeader;
BOOLEAN NeedReset;
// //
// Capsule Count can't be less than one. // Capsule Count can't be less than one.
@ -254,6 +255,7 @@ QueryCapsuleCapabilities (
} }
CapsuleHeader = NULL; CapsuleHeader = NULL;
NeedReset = FALSE;
for (ArrayNumber = 0; ArrayNumber < CapsuleCount; ArrayNumber++) { for (ArrayNumber = 0; ArrayNumber < CapsuleCount; ArrayNumber++) {
CapsuleHeader = CapsuleHeaderArray[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]; for (ArrayNumber = 0; ArrayNumber < CapsuleCount ; ArrayNumber++) {
if ((CapsuleHeader->Flags & CAPSULE_FLAGS_PERSIST_ACROSS_RESET) != 0) { 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 //Check if the platform supports update capsule across a system reset
// //
if (!FeaturePcdGet(PcdSupportUpdateCapsuleReset)) { if (!FeaturePcdGet(PcdSupportUpdateCapsuleReset)) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
*ResetType = EfiResetWarm; *ResetType = EfiResetWarm;
*MaxiumCapsuleSize = FixedPcdGet32(PcdMaxSizePopulateCapsule);
} else { } else {
// //
// For non-reset capsule image. // For non-reset capsule image.
// //
*ResetType = EfiResetCold; *ResetType = EfiResetCold;
} *MaxiumCapsuleSize = FixedPcdGet32(PcdMaxSizeNonPopulateCapsule);
//
// The support max capsule image size
//
if ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) != 0) {
*MaxiumCapsuleSize = PcdGet32(PcdMaxSizePopulateCapsule);
} else {
*MaxiumCapsuleSize = PcdGet32(PcdMaxSizeNonPopulateCapsule);
} }
return EFI_SUCCESS; return EFI_SUCCESS;