From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (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 62BD781915 for ; Sun, 8 Jan 2017 22:34:59 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga105.fm.intel.com with ESMTP; 08 Jan 2017 22:34:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,339,1477983600"; d="scan'208";a="27870854" Received: from jyao1-mobl.ccr.corp.intel.com ([10.239.192.238]) by orsmga002.jf.intel.com with ESMTP; 08 Jan 2017 22:34:57 -0800 From: Jiewen Yao To: edk2-devel@lists.01.org Cc: Star Zeng , Feng Tian Date: Mon, 9 Jan 2017 14:34:53 +0800 Message-Id: <1483943693-14680-1-git-send-email-jiewen.yao@intel.com> X-Mailer: git-send-email 2.7.4.windows.1 Subject: [PATCH] MdeModulePkg/DxeCore:Clear RT attribute on SetCapabilities. 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: Mon, 09 Jan 2017 06:34:59 -0000 When gDS->SetMemorySpaceCapabilities() is called, current DXE core will sync all GCD attributes to memory map attributes, including RUNTIME attributes. It is wrong, because RUNTIME attributes should be set for runtime memory only. This fix clears the RUNTIME attributes before convert to UEFI memory map. So that the UEFI memory map is good after gDS->SetMemorySpaceCapabilities() is called. Cc: Star Zeng Cc: Feng Tian Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao --- MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index bd7c6c6..056fc6a 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c @@ -1624,7 +1624,7 @@ CoreSetMemorySpaceCapabilities ( Status = CoreConvertSpace (GCD_SET_CAPABILITIES_MEMORY_OPERATION, (EFI_GCD_MEMORY_TYPE) 0, (EFI_GCD_IO_TYPE) 0, BaseAddress, Length, Capabilities, 0); if (!EFI_ERROR(Status)) { - CoreUpdateMemoryAttributes(BaseAddress, RShiftU64(Length, EFI_PAGE_SHIFT), Capabilities); + CoreUpdateMemoryAttributes(BaseAddress, RShiftU64(Length, EFI_PAGE_SHIFT), Capabilities & (~EFI_MEMORY_RUNTIME)); } return Status; -- 2.7.4.windows.1