summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>2010-05-19 02:31:41 +0000
committerli-elvin <li-elvin@6f19259b-4bc3-4df7-8a09-765794883524>2010-05-19 02:31:41 +0000
commit0ef42f8819ca33153b651e31f9f8c895b05cb323 (patch)
tree056a5cd9e47cf718cfadc5bf1f8685be3cd354d6 /MdeModulePkg
parent9c4a5f742373f2a83154e6e39b6527636081151d (diff)
downloadedk2-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')
-rw-r--r--MdeModulePkg/MdeModulePkg.dec6
-rw-r--r--MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.c28
2 files changed, 18 insertions, 16 deletions
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;