From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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) 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==; 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 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,167,1486454400"; d="scan'208";a="236284815" 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 From: Jiewen Yao To: edk2-devel@lists.01.org Cc: Chao Zhang 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: [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:04:09 -0000 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/MdeModulePkg/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; EsrtGuidFound = FALSE; - - // - // Check ESRT protocol - // - Status = gBS->LocateProtocol(&gEsrtManagementProtocolGuid, NULL, (VOID **)&EsrtProtocol); - if (!EFI_ERROR(Status)) { - Status = EsrtProtocol->GetEsrtEntry(&CapsuleHeader->CapsuleGuid, &Entry); - if (!EFI_ERROR(Status)) { - EsrtGuidFound = TRUE; - } - } - - // - // Check ESRT configuration table - // - if (!EsrtGuidFound) { - Status = EfiGetSystemConfigurationTable(&gEfiSystemResourceTableGuid, (VOID **)&Esrt); - if (!EFI_ERROR(Status)) { - ASSERT (Esrt != NULL); - EsrtEntry = (VOID *)(Esrt + 1); - for (Index = 0; Index < Esrt->FwResourceCount; Index++, EsrtEntry++) { + if (mIsVirtualAddrConverted) { + if(mEsrtTable != NULL) { + EsrtEntry = (EFI_SYSTEM_RESOURCE_ENTRY *)(mEsrtTable + 1); + for (Index = 0; Index < mEsrtTable->FwResourceCount ; Index++, EsrtEntry++) { if (CompareGuid(&EsrtEntry->FwClass, &CapsuleHeader->CapsuleGuid)) { EsrtGuidFound = TRUE; break; } } } + } else { + // + // Check ESRT protocol + // + Status = gBS->LocateProtocol(&gEsrtManagementProtocolGuid, NULL, (VOID **)&EsrtProtocol); + if (!EFI_ERROR(Status)) { + Status = EsrtProtocol->GetEsrtEntry(&CapsuleHeader->CapsuleGuid, &Entry); + if (!EFI_ERROR(Status)) { + EsrtGuidFound = TRUE; + } + } + + // + // Check ESRT configuration table + // + if (!EsrtGuidFound) { + Status = EfiGetSystemConfigurationTable(&gEfiSystemResourceTableGuid, (VOID **)&Esrt); + if (!EFI_ERROR(Status)) { + ASSERT (Esrt != NULL); + EsrtEntry = (VOID *)(Esrt + 1); + for (Index = 0; Index < Esrt->FwResourceCount; Index++, EsrtEntry++) { + if (CompareGuid(&EsrtEntry->FwClass, &CapsuleHeader->CapsuleGuid)) { + EsrtGuidFound = TRUE; + break; + } + } + } + } } if (!EsrtGuidFound) { return FALSE; -- 2.7.4.windows.1