From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 4328D80380 for ; Tue, 14 Mar 2017 23:16:38 -0700 (PDT) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP; 14 Mar 2017 23:16:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,167,1486454400"; d="scan'208";a="60531035" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga002.jf.intel.com with ESMTP; 14 Mar 2017 23:16:37 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 14 Mar 2017 23:16:37 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.88]) by SHSMSX104.ccr.corp.intel.com ([10.239.4.70]) with mapi id 14.03.0248.002; Wed, 15 Mar 2017 14:16:35 +0800 From: "Zhang, Chao B" To: "Yao, Jiewen" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH] MdeModulePkg/CapsuleLib: Fix runtime issue Thread-Index: AQHSnVH9VHUPP6qcFkuiirzumCrz16GVbKNg Date: Wed, 15 Mar 2017 06:16:34 +0000 Message-ID: References: <1489557842-11312-1-git-send-email-jiewen.yao@intel.com> In-Reply-To: <1489557842-11312-1-git-send-email-jiewen.yao@intel.com> Accept-Language: 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/CapsuleLib: Fix runtime 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: Wed, 15 Mar 2017 06:16:38 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by : Chao Zhang -----Original Message----- From: Yao, Jiewen=20 Sent: Wednesday, March 15, 2017 2:04 PM To: edk2-devel@lists.01.org Cc: Zhang, Chao B Subject: [PATCH] MdeModulePkg/CapsuleLib: Fix runtime issue The previous patch has problem on handling capsule request at runtime. This patch fixed the issue. Cc: Chao Zhang Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao --- MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c | 53 ++++++++++++---= ----- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c b/MdeMod= ulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c index 6344214..9ed0be3 100644 --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c @@ -1453,33 +1453,44 @@ IsNestedFmpCapsule ( EFI_SYSTEM_RESOURCE_ENTRY Entry; =20 EsrtGuidFound =3D FALSE; - - // - // Check ESRT protocol - // - Status =3D gBS->LocateProtocol(&gEsrtManagementProtocolGuid, NULL, (VOID= **)&EsrtProtocol); - if (!EFI_ERROR(Status)) { - Status =3D EsrtProtocol->GetEsrtEntry(&CapsuleHeader->CapsuleGuid, &En= try); - if (!EFI_ERROR(Status)) { - EsrtGuidFound =3D TRUE; - } - } - - // - // Check ESRT configuration table - // - if (!EsrtGuidFound) { - Status =3D EfiGetSystemConfigurationTable(&gEfiSystemResourceTableGuid= , (VOID **)&Esrt); - if (!EFI_ERROR(Status)) { - ASSERT (Esrt !=3D NULL); - EsrtEntry =3D (VOID *)(Esrt + 1); - for (Index =3D 0; Index < Esrt->FwResourceCount; Index++, EsrtEntry+= +) { + if (mIsVirtualAddrConverted) { + if(mEsrtTable !=3D NULL) { + EsrtEntry =3D (EFI_SYSTEM_RESOURCE_ENTRY *)(mEsrtTable + 1); + for (Index =3D 0; Index < mEsrtTable->FwResourceCount ; Index++,=20 + EsrtEntry++) { if (CompareGuid(&EsrtEntry->FwClass, &CapsuleHeader->CapsuleGuid))= { EsrtGuidFound =3D TRUE; break; } } } + } else { + // + // Check ESRT protocol + // + Status =3D gBS->LocateProtocol(&gEsrtManagementProtocolGuid, NULL, (VO= ID **)&EsrtProtocol); + if (!EFI_ERROR(Status)) { + Status =3D EsrtProtocol->GetEsrtEntry(&CapsuleHeader->CapsuleGuid, &= Entry); + if (!EFI_ERROR(Status)) { + EsrtGuidFound =3D TRUE; + } + } + + // + // Check ESRT configuration table + // + if (!EsrtGuidFound) { + Status =3D EfiGetSystemConfigurationTable(&gEfiSystemResourceTableGu= id, (VOID **)&Esrt); + if (!EFI_ERROR(Status)) { + ASSERT (Esrt !=3D NULL); + EsrtEntry =3D (VOID *)(Esrt + 1); + for (Index =3D 0; Index < Esrt->FwResourceCount; Index++, EsrtEntr= y++) { + if (CompareGuid(&EsrtEntry->FwClass, &CapsuleHeader->CapsuleGuid= )) { + EsrtGuidFound =3D TRUE; + break; + } + } + } + } } if (!EsrtGuidFound) { return FALSE; -- 2.7.4.windows.1