mirror of https://github.com/acidanthera/audk.git
ArmPkg/ArmDmaLib: consistently use 'gCacheAlignment - 1' as alignment mask
We manage to use both an AND operation with 'gCacheAlignment - 1' and a modulo operation with 'gCacheAlignment' in the same compound if statement. Since gCacheAlignment is a global of which the compiler cannot guarantee that it is a power of two, simply use the AND version in both cases. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
This commit is contained in:
parent
e55f8c73b6
commit
80e5a33da1
|
@ -93,7 +93,7 @@ DmaMap (
|
||||||
*Mapping = Map;
|
*Mapping = Map;
|
||||||
|
|
||||||
if ((((UINTN)HostAddress & (gCacheAlignment - 1)) != 0) ||
|
if ((((UINTN)HostAddress & (gCacheAlignment - 1)) != 0) ||
|
||||||
((*NumberOfBytes % gCacheAlignment) != 0)) {
|
((*NumberOfBytes & (gCacheAlignment - 1)) != 0)) {
|
||||||
|
|
||||||
// Get the cacheability of the region
|
// Get the cacheability of the region
|
||||||
Status = gDS->GetMemorySpaceDescriptor (*DeviceAddress, &GcdDescriptor);
|
Status = gDS->GetMemorySpaceDescriptor (*DeviceAddress, &GcdDescriptor);
|
||||||
|
|
Loading…
Reference in New Issue