]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/CdExpressPei: Fix capsule size mismatch issue.
authorJiewen Yao <jiewen.yao@intel.com>
Fri, 30 Sep 2016 02:42:26 +0000 (10:42 +0800)
committerJiewen Yao <jiewen.yao@intel.com>
Sat, 8 Oct 2016 01:31:05 +0000 (09:31 +0800)
Current PeiCdExpress driver will return capsule size to
be block aligned.
It will fail if we check the capsuleImageSize field.

The patch correct the returned capsule size.

Tested-by: Eric Dong <eric.dong@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.c
MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.h

index f78118a6a8b11e72dddc2c9fdc75c62354691bc5..371ab733bc2b2cbeee87e4ff63bc55ec3cc3195a 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Source file for CD recovery PEIM\r
 \r
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions\r
@@ -477,13 +477,14 @@ RetrieveCapsuleFileFromRoot (
     }\r
 \r
     PrivateData->CapsuleData[PrivateData->CapsuleCount].CapsuleStartLBA = FileRecord->LocationOfExtent[0];\r
-    PrivateData->CapsuleData[PrivateData->CapsuleCount].CapsuleSize =\r
+    PrivateData->CapsuleData[PrivateData->CapsuleCount].CapsuleBlockAlignedSize =\r
       (\r
         FileRecord->DataLength[0] /\r
         PEI_CD_BLOCK_SIZE +\r
         1\r
       ) *\r
       PEI_CD_BLOCK_SIZE;\r
+    PrivateData->CapsuleData[PrivateData->CapsuleCount].CapsuleSize = FileRecord->DataLength[0];\r
 \r
     return EFI_SUCCESS;\r
   }\r
@@ -659,7 +660,7 @@ LoadRecoveryCapsule (
                           BlockIo2Ppi,\r
                           PrivateData->CapsuleData[CapsuleInstance - 1].IndexBlock,\r
                           PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleStartLBA,\r
-                          PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleSize,\r
+                          PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleBlockAlignedSize,\r
                           Buffer\r
                           );\r
   } else {\r
@@ -668,7 +669,7 @@ LoadRecoveryCapsule (
                           BlockIoPpi,\r
                           PrivateData->CapsuleData[CapsuleInstance - 1].IndexBlock,\r
                           PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleStartLBA,\r
-                          PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleSize,\r
+                          PrivateData->CapsuleData[CapsuleInstance - 1].CapsuleBlockAlignedSize,\r
                           Buffer\r
                           );\r
   }\r
index 5ca26722a742c8aa7bcc9e877af02e69a1b4039e..91f34dc3c249a33b46367b8e04dfdd6138f98072 100644 (file)
@@ -66,6 +66,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 typedef struct {\r
   UINTN                           CapsuleStartLBA;\r
   UINTN                           CapsuleSize;\r
+  UINTN                           CapsuleBlockAlignedSize;\r
   UINTN                           IndexBlock;\r
   EFI_PEI_RECOVERY_BLOCK_IO_PPI   *BlockIo;\r
   EFI_PEI_RECOVERY_BLOCK_IO2_PPI  *BlockIo2;\r