From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id AA8391A1E3E for ; Thu, 29 Sep 2016 19:49:40 -0700 (PDT) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 29 Sep 2016 19:49:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,418,1473145200"; d="scan'208";a="767405833" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by FMSMGA003.fm.intel.com with ESMTP; 29 Sep 2016 19:49:40 -0700 Received: from FMSMSX109.amr.corp.intel.com (10.18.116.9) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 29 Sep 2016 19:49:40 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx109.amr.corp.intel.com (10.18.116.9) with Microsoft SMTP Server (TLS) id 14.3.248.2; Thu, 29 Sep 2016 19:49:38 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.118]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.234]) with mapi id 14.03.0248.002; Fri, 30 Sep 2016 10:49:37 +0800 From: "Tian, Feng" To: "Yao, Jiewen" , "edk2-devel@lists.01.org" CC: "Dong, Eric" , "Tian, Feng" Thread-Topic: [PATCH] MdeModulePkg/CdExpressPei: Fix capsule size mismatch issue. Thread-Index: AQHSGsRT4ENYX4NhTkOPdKj2nf1mTKCRVPyA Date: Fri, 30 Sep 2016 02:49:36 +0000 Message-ID: <7F1BAD85ADEA444D97065A60D2E97EE566E24909@SHSMSX101.ccr.corp.intel.com> References: <1475203346-16788-1-git-send-email-jiewen.yao@intel.com> In-Reply-To: <1475203346-16788-1-git-send-email-jiewen.yao@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg/CdExpressPei: Fix capsule size mismatch issue. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2016 02:49:40 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Feng Tian Thanks Feng -----Original Message----- From: Yao, Jiewen=20 Sent: Friday, September 30, 2016 10:42 AM To: edk2-devel@lists.01.org Cc: Tian, Feng ; Dong, Eric Subject: [PATCH] MdeModulePkg/CdExpressPei: Fix capsule size mismatch issue= . 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 Cc: Feng Tian Cc: Eric Dong Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao --- MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.c | 9 +++++---- Mde= ModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.h | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.c b/MdeM= odulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.c index f78118a..371ab73 100644 --- a/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.c +++ b/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.c @@ -1,7 +1,7 @@ /** @file Source file for CD recovery PEIM =20 -Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
=20 This program and the accompanying materials are licensed and made availab= le under the terms and conditions @@ -477,13 +477,14 @@ RetrieveCapsuleFile= FromRoot ( } =20 PrivateData->CapsuleData[PrivateData->CapsuleCount].CapsuleStartLBA = =3D FileRecord->LocationOfExtent[0]; - PrivateData->CapsuleData[PrivateData->CapsuleCount].CapsuleSize =3D + =20 + PrivateData->CapsuleData[PrivateData->CapsuleCount].CapsuleBlockAligne + dSize =3D ( FileRecord->DataLength[0] / PEI_CD_BLOCK_SIZE + 1 ) * PEI_CD_BLOCK_SIZE; + PrivateData->CapsuleData[PrivateData->CapsuleCount].CapsuleSize =3D=20 + FileRecord->DataLength[0]; =20 return EFI_SUCCESS; } @@ -659,7 +660,7 @@ LoadRecoveryCapsule ( BlockIo2Ppi, PrivateData->CapsuleData[CapsuleInstance - 1].In= dexBlock, PrivateData->CapsuleData[CapsuleInstance - 1].Ca= psuleStartLBA, - PrivateData->CapsuleData[CapsuleInstance - 1].Ca= psuleSize, + PrivateData->CapsuleData[CapsuleInstance -=20 + 1].CapsuleBlockAlignedSize, Buffer ); } else { @@ -668,7 +669,7 @@ LoadRecoveryCapsule ( BlockIoPpi, PrivateData->CapsuleData[CapsuleInstance - 1].In= dexBlock, PrivateData->CapsuleData[CapsuleInstance - 1].Ca= psuleStartLBA, - PrivateData->CapsuleData[CapsuleInstance - 1].Ca= psuleSize, + PrivateData->CapsuleData[CapsuleInstance -=20 + 1].CapsuleBlockAlignedSize, Buffer ); } diff --git a/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.h b/MdeM= odulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.h index 5ca2672..91f34dc 100644 --- a/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.h +++ b/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.h @@ -66,6 +66,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER= EXPRESS OR IMPLIED. typedef struct { UINTN CapsuleStartLBA; UINTN CapsuleSize; + UINTN CapsuleBlockAlignedSize; UINTN IndexBlock; EFI_PEI_RECOVERY_BLOCK_IO_PPI *BlockIo; EFI_PEI_RECOVERY_BLOCK_IO2_PPI *BlockIo2; -- 2.7.4.windows.1