Revision: 18754
http://sourceforge.net/p/edk2/code/18754
Author: abiesheuvel
Date: 2015-11-09 13:26:52 +0000 (Mon, 09 Nov 2015)
Log Message:
-----------
ArmPkg/ArmLib: retrieve cache line length from CTR not CCSIDR
The stride used by the cache maintenance by MVA instructions should
be retrieved from CTR_EL0.DminLine and CTR_EL0.IminLine, whose values
reflect the actual geometry of the caches. Using CCSIDR for this purpose
violates the architecture.
Also, move the line length accessors to common code, since there is no
need to keep them separate between ARMv7 and AArch64.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <[email protected]>
Reviewed-by: Mark Rutland <[email protected]>
Reviewed-by: Leif Lindholm <[email protected]>
Modified Paths:
--------------
trunk/edk2/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c
trunk/edk2/ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.c
trunk/edk2/ArmPkg/Library/ArmLib/Common/ArmLib.c
Modified: trunk/edk2/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c
===================================================================
--- trunk/edk2/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c 2015-11-09
13:26:32 UTC (rev 18753)
+++ trunk/edk2/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c 2015-11-09
13:26:52 UTC (rev 18754)
@@ -21,31 +21,6 @@
#include "AArch64Lib.h"
#include "ArmLibPrivate.h"
-UINTN
-EFIAPI
-ArmDataCacheLineLength (
- VOID
- )
-{
- UINT32 CCSIDR = ReadCCSIDR (0) & 7;
-
- // * 4 converts to bytes
- return (1 << (CCSIDR + 2)) * 4;
-}
-
-UINTN
-EFIAPI
-ArmInstructionCacheLineLength (
- VOID
- )
-{
- UINT32 CCSIDR = ReadCCSIDR (1) & 7;
-
- // * 4 converts to bytes
- return (1 << (CCSIDR + 2)) * 4;
-}
-
-
VOID
AArch64DataCacheOperation (
IN AARCH64_CACHE_OPERATION DataCacheOperation
Modified: trunk/edk2/ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.c
===================================================================
--- trunk/edk2/ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.c 2015-11-09 13:26:32 UTC
(rev 18753)
+++ trunk/edk2/ArmPkg/Library/ArmLib/ArmV7/ArmV7Lib.c 2015-11-09 13:26:52 UTC
(rev 18754)
@@ -20,33 +20,6 @@
#include "ArmV7Lib.h"
#include "ArmLibPrivate.h"
-UINTN
-EFIAPI
-ArmDataCacheLineLength (
- VOID
- )
-{
- UINT32 CCSIDR = ReadCCSIDR (0) & 7;
-
- // * 4 converts to bytes
- return (1 << (CCSIDR + 2)) * 4;
-}
-
-UINTN
-EFIAPI
-ArmInstructionCacheLineLength (
- VOID
- )
-{
- UINT32 CCSIDR = ReadCCSIDR (1) & 7;
-
- // * 4 converts to bytes
- return (1 << (CCSIDR + 2)) * 4;
-
-// return 64;
-}
-
-
VOID
ArmV7DataCacheOperation (
IN ARM_V7_CACHE_OPERATION DataCacheOperation
Modified: trunk/edk2/ArmPkg/Library/ArmLib/Common/ArmLib.c
===================================================================
--- trunk/edk2/ArmPkg/Library/ArmLib/Common/ArmLib.c 2015-11-09 13:26:32 UTC
(rev 18753)
+++ trunk/edk2/ArmPkg/Library/ArmLib/Common/ArmLib.c 2015-11-09 13:26:52 UTC
(rev 18754)
@@ -70,3 +70,21 @@
Value &= ~Bits;
ArmWriteCpuActlr (Value);
}
+
+UINTN
+EFIAPI
+ArmDataCacheLineLength (
+ VOID
+ )
+{
+ return 4 << ((ArmCacheInfo () >> 16) & 0xf); // CTR_EL0.DminLine
+}
+
+UINTN
+EFIAPI
+ArmInstructionCacheLineLength (
+ VOID
+ )
+{
+ return 4 << (ArmCacheInfo () & 0xf); // CTR_EL0.IminLine
+}
------------------------------------------------------------------------------
Presto, an open source distributed SQL query engine for big data, initially
developed by Facebook, enables you to easily query your data on Hadoop in a
more interactive manner. Teradata is also now providing full enterprise
support for Presto. Download a free open source copy now.
http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits