From: Heyi Guo Date: Thu, 29 Mar 2018 08:19:50 +0000 (+0800) Subject: MdeModulePkg/Gcd: Fix bug of attribute conversion X-Git-Tag: edk2-stable201903~2002 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=5b91bf82c67b586b9588cbe4bbffa1588f6b5926;hp=9c7d0d499296e444e39e9b6b34d8c121a325b295 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 Signed-off-by: Yi Li Signed-off-by: Renhao Liang Reviewed-by: Star Zeng Cc: Star Zeng Cc: Eric Dong Cc: Michael D Kinney Cc: Liming Gao Cc: Jian J Wang Cc: Ruiyu Ni --- 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) {