summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorHeyi Guo <heyi.guo@linaro.org>2018-03-29 16:19:50 +0800
committerStar Zeng <star.zeng@intel.com>2018-07-27 19:23:53 +0800
commitbc349401c3fa09e4b988e832d6ff93e4865d868f (patch)
tree7630692f097005ac2e9356c72d2d9df8c50a4bbf /MdeModulePkg
parent6a7424db7a66bd440fdc7710d6aa3364d793996f (diff)
downloadedk2-bc349401c3fa09e4b988e832d6ff93e4865d868f.tar.gz
edk2-bc349401c3fa09e4b988e832d6ff93e4865d868f.tar.bz2
edk2-bc349401c3fa09e4b988e832d6ff93e4865d868f.zip
MdeModulePkg/Gcd: Fix bug of attribute conversion
For gDS->SetMemorySpaceAttributes(), when user passes a combined memory attribute including CPU arch attribute and other attributes, like EFI_MEMORY_RUNTIME, ConverToCpuArchAttributes() will return INVALID_CPU_ARCH_ATTRIBUTES and skip setting page/cache attribute for the specified memory space. We don't see any reason to forbid combining CPU arch attributes and non-CPU-arch attributes when calling gDS->SetMemorySpaceAttributes(), so we remove the check code in ConverToCpuArchAttributes(); the remaining code is enough to grab the interested bits for Cpu->SetMemoryAttributes(). Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Heyi Guo <heyi.guo@linaro.org> Signed-off-by: Yi Li <phoenix.liyi@huawei.com> Signed-off-by: Renhao Liang <liangrenhao@huawei.com> Reviewed-by: Star Zeng <star.zeng@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> (cherry picked from commit 5b91bf82c67b586b9588cbe4bbffa1588f6b5926)
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Core/Dxe/Gcd/Gcd.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
index 77f4adb4bc..907245a3f5 100644
--- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
+++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c
@@ -673,11 +673,6 @@ ConverToCpuArchAttributes (
{
UINT64 CpuArchAttributes;
- if ((Attributes & ~(EXCLUSIVE_MEMORY_ATTRIBUTES |
- NONEXCLUSIVE_MEMORY_ATTRIBUTES)) != 0) {
- return INVALID_CPU_ARCH_ATTRIBUTES;
- }
-
CpuArchAttributes = Attributes & NONEXCLUSIVE_MEMORY_ATTRIBUTES;
if ( (Attributes & EFI_MEMORY_UC) == EFI_MEMORY_UC) {