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 change ConverToCpuArchAttributes() to only check if there is valid CPU arch attributes in the input "Attribute" parameter and just ignore other attributes. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Heyi Guo <heyi....@linaro.org> Signed-off-by: Yi Li <phoenix.l...@huawei.com> Signed-off-by: Renhao Liang <liangren...@huawei.com> Cc: Star Zeng <star.z...@intel.com> Cc: Eric Dong <eric.d...@intel.com> Cc: Michael D Kinney <michael.d.kin...@intel.com> Cc: Liming Gao <liming....@intel.com> --- MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c index 77f4adb4bc01..2ababdd14cc6 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c @@ -673,8 +673,8 @@ ConverToCpuArchAttributes ( { UINT64 CpuArchAttributes; - if ((Attributes & ~(EXCLUSIVE_MEMORY_ATTRIBUTES | - NONEXCLUSIVE_MEMORY_ATTRIBUTES)) != 0) { + if ((Attributes & (EXCLUSIVE_MEMORY_ATTRIBUTES | + NONEXCLUSIVE_MEMORY_ATTRIBUTES)) == 0) { return INVALID_CPU_ARCH_ATTRIBUTES; } -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel