Skip to content

Commit

Permalink
MdeModulePkg/Gcd: Fix bug of attribute conversion
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Heyi Guo authored and lzeng14 committed Apr 2, 2018
1 parent 9c7d0d4 commit 5b91bf8
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions MdeModulePkg/Core/Dxe/Gcd/Gcd.c
Expand Up @@ -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) {
Expand Down

0 comments on commit 5b91bf8

Please sign in to comment.