diff options
author | li-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-05-19 02:31:41 +0000 |
---|---|---|
committer | li-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-05-19 02:31:41 +0000 |
commit | 0ef42f8819ca33153b651e31f9f8c895b05cb323 (patch) | |
tree | 056a5cd9e47cf718cfadc5bf1f8685be3cd354d6 /MdeModulePkg/Universal | |
parent | 9c4a5f742373f2a83154e6e39b6527636081151d (diff) | |
download | edk2-platforms-0ef42f8819ca33153b651e31f9f8c895b05cb323.tar.xz |
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
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r-- | MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.c | 28 |
1 files changed, 15 insertions, 13 deletions
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;
|