]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/ArmLib: add accessor function for Cache Writeback Granule
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 9 Nov 2015 13:28:17 +0000 (13:28 +0000)
committerabiesheuvel <abiesheuvel@Edk2>
Mon, 9 Nov 2015 13:28:17 +0000 (13:28 +0000)
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

ArmPkg/Include/Library/ArmLib.h
ArmPkg/Library/ArmLib/Common/ArmLib.c

index 2059a67bbf3c20287ee3f9abf9651359dcef4321..a328146b6947dd1e465d146b6e171953ade08e03 100644 (file)
@@ -114,6 +114,12 @@ ArmInstructionCacheLineLength (
   VOID\r
   );\r
 \r
+UINTN\r
+EFIAPI\r
+ArmCacheWritebackGranule (\r
+  VOID\r
+  );\r
+\r
 UINTN\r
 EFIAPI\r
 ArmIsArchTimerImplemented (\r
index ad0a265e9f597d2623ac4b9c4a8de8666a0c9705..7e227936fa6fe53dc3f34c79eb77a66e51baedd9 100644 (file)
@@ -88,3 +88,20 @@ ArmInstructionCacheLineLength (
 {\r
   return 4 << (ArmCacheInfo () & 0xf); // CTR_EL0.IminLine\r
 }\r
+\r
+UINTN\r
+EFIAPI\r
+ArmCacheWritebackGranule (\r
+  VOID\r
+  )\r
+{\r
+  UINTN   CWG;\r
+\r
+  CWG = (ArmCacheInfo () >> 24) & 0xf; // CTR_EL0.CWG\r
+\r
+  if (CWG == 0) {\r
+    return SIZE_2KB;\r
+  }\r
+\r
+  return 4 << CWG;\r
+}\r