Reviewed-by: Star Zeng <[email protected]> Thanks, Star -----Original Message----- From: Heyi Guo [mailto:[email protected]] Sent: Thursday, March 29, 2018 4:20 PM To: [email protected] Cc: Heyi Guo <[email protected]>; Yi Li <[email protected]>; Renhao Liang <[email protected]>; Zeng, Star <[email protected]>; Dong, Eric <[email protected]>; Kinney, Michael D <[email protected]>; Gao, Liming <[email protected]>; Wang, Jian J <[email protected]>; Ni, Ruiyu <[email protected]> Subject: [PATCH 1/1] 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 <[email protected]> Signed-off-by: Yi Li <[email protected]> Signed-off-by: Renhao Liang <[email protected]> Cc: Star Zeng <[email protected]> Cc: Eric Dong <[email protected]> Cc: Michael D Kinney <[email protected]> Cc: Liming Gao <[email protected]> Cc: Jian J Wang <[email protected]> Cc: Ruiyu Ni <[email protected]> --- MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index 77f4adb4bc01..907245a3f512 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) { -- 2.7.4 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

