UefiCpuPkg/MtrrLib: Handle one setting request covering all memory
*SetMemoryAttribute*() API cannot handle the setting request that looks like <0, MAX_ADDRESS, Type>. The buggy parameter checking logic returns Unsupported for this case. The patch fixes the checking logic to handle such case. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com>
This commit is contained in:
parent
ffb4c72d7b
commit
cee85c48e9
@ -2270,8 +2270,13 @@ MtrrSetMemoryAttributesInMtrrSettings (
|
|||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
if (((Ranges[Index].BaseAddress & ~MtrrValidAddressMask) != 0) ||
|
if (((Ranges[Index].BaseAddress & ~MtrrValidAddressMask) != 0) ||
|
||||||
((Ranges[Index].Length & ~MtrrValidAddressMask) != 0)
|
((((Ranges[Index].BaseAddress + Ranges[Index].Length) & ~MtrrValidAddressMask) != 0) &&
|
||||||
|
(Ranges[Index].BaseAddress + Ranges[Index].Length) != MtrrValidBitsMask + 1)
|
||||||
) {
|
) {
|
||||||
|
//
|
||||||
|
// Either the BaseAddress or the Limit doesn't follow the alignment requirement.
|
||||||
|
// Note: It's still valid if Limit doesn't follow the alignment requirement but equals to MAX Address.
|
||||||
|
//
|
||||||
Status = RETURN_UNSUPPORTED;
|
Status = RETURN_UNSUPPORTED;
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user