diff options
Diffstat (limited to 'lib/aarch64/cache_helpers.S')
-rw-r--r-- | lib/aarch64/cache_helpers.S | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/lib/aarch64/cache_helpers.S b/lib/aarch64/cache_helpers.S index 0dbab1bdf..476b906e0 100644 --- a/lib/aarch64/cache_helpers.S +++ b/lib/aarch64/cache_helpers.S @@ -32,6 +32,7 @@ #include <asm_macros.S> .globl flush_dcache_range + .globl clean_dcache_range .globl inv_dcache_range .globl dcsw_op_louis .globl dcsw_op_all @@ -39,25 +40,39 @@ .globl dcsw_op_level2 .globl dcsw_op_level3 - /* ------------------------------------------ - * Clean+Invalidate from base address till - * size. 'x0' = addr, 'x1' = size - * ------------------------------------------ - */ -func flush_dcache_range +/* + * This macro can be used for implementing various data cache operations `op` + */ +.macro do_dcache_maintenance_by_mva op dcache_line_size x2, x3 add x1, x0, x1 sub x3, x2, #1 bic x0, x0, x3 -flush_loop: - dc civac, x0 +loop_\op: + dc \op, x0 add x0, x0, x2 cmp x0, x1 - b.lo flush_loop + b.lo loop_\op dsb sy ret +.endm + /* ------------------------------------------ + * Clean+Invalidate from base address till + * size. 'x0' = addr, 'x1' = size + * ------------------------------------------ + */ +func flush_dcache_range + do_dcache_maintenance_by_mva civac endfunc flush_dcache_range + /* ------------------------------------------ + * Clean from base address till size. + * 'x0' = addr, 'x1' = size + * ------------------------------------------ + */ +func clean_dcache_range + do_dcache_maintenance_by_mva cvac +endfunc clean_dcache_range /* ------------------------------------------ * Invalidate from base address till @@ -65,17 +80,7 @@ endfunc flush_dcache_range * ------------------------------------------ */ func inv_dcache_range - dcache_line_size x2, x3 - add x1, x0, x1 - sub x3, x2, #1 - bic x0, x0, x3 -inv_loop: - dc ivac, x0 - add x0, x0, x2 - cmp x0, x1 - b.lo inv_loop - dsb sy - ret + do_dcache_maintenance_by_mva ivac endfunc inv_dcache_range |