ArmPkg/ArmLib: add accessor function for Cache Writeback Granule

Add a function to ArmLib that provides access to the Cache Writeback
Granule (CWG) field in CTR_EL0. This information is required when
performing non-coherent DMA.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18758 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Ard Biesheuvel 2015-11-09 13:28:17 +00:00 committed by abiesheuvel
parent 8c5ac451d5
commit c653fc2a91
2 changed files with 23 additions and 0 deletions

View File

@ -114,6 +114,12 @@ ArmInstructionCacheLineLength (
VOID
);
UINTN
EFIAPI
ArmCacheWritebackGranule (
VOID
);
UINTN
EFIAPI
ArmIsArchTimerImplemented (

View File

@ -88,3 +88,20 @@ ArmInstructionCacheLineLength (
{
return 4 << (ArmCacheInfo () & 0xf); // CTR_EL0.IminLine
}
UINTN
EFIAPI
ArmCacheWritebackGranule (
VOID
)
{
UINTN CWG;
CWG = (ArmCacheInfo () >> 24) & 0xf; // CTR_EL0.CWG
if (CWG == 0) {
return SIZE_2KB;
}
return 4 << CWG;
}