From nobody Sat Nov 2 12:20:18 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1489557853007498.5666325061686; Tue, 14 Mar 2017 23:04:13 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8954A8037D; Tue, 14 Mar 2017 23:04:10 -0700 (PDT) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 801F780373 for ; Tue, 14 Mar 2017 23:04:09 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Mar 2017 23:04:09 -0700 Received: from jyao1-mobl.ccr.corp.intel.com ([10.239.192.128]) by fmsmga004.fm.intel.com with ESMTP; 14 Mar 2017 23:04:07 -0700 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1489557849; x=1521093849; h=from:to:cc:subject:date:message-id; bh=eeccF4yBIk0J7Y5FOuwQrOXk1CoZYK7f0CVIn5qIyjg=; b=tXZTSg5foBRh3SY4NwJdQHeNNho7Rgk0bfm0cmmJRoulutkAXhnVnWr4 PHatxoE3fUO2gy2hWUL0R3KrE8ueMg==; X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,167,1486454400"; d="scan'208";a="236284815" From: Jiewen Yao To: edk2-devel@lists.01.org Date: Wed, 15 Mar 2017 14:04:02 +0800 Message-Id: <1489557842-11312-1-git-send-email-jiewen.yao@intel.com> X-Mailer: git-send-email 2.7.4.windows.1 Subject: [edk2] [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: , Cc: Chao Zhang MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by : Chao Zhang --- 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++, Esr= tEntry++) { 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; --=20 2.7.4.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel