]> xenbits.xensource.com Git - people/julieng/boot-wrapper-aarch64.git/commitdiff
cache.S: fix misleading comments
authorMark Rutland <mark.rutland@arm.com>
Thu, 20 Mar 2014 15:40:46 +0000 (15:40 +0000)
committerMark Rutland <mark.rutland@arm.com>
Thu, 20 Mar 2014 15:52:49 +0000 (15:52 +0000)
A couple of comments in cache.S are misleading. While they do not affect
the correctness of the code they do make it somewhat difficult to reason
about it:

CSSIDR_EL1[12:3] contains the associativity field, which is enconded as
one less than the total number of ways, (matching the maximum way index)
so the comment on line 40 is wrong.

Counting the leading zeros on a 32-bit register with the extracted
associativity field results in 32 - ceil(log2(max way index)), rather
than log2(ways) rounded down. Thus the comment on line 41 is also wrong.

This patch adjusts both comments to better reflect the code.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
cache.S

diff --git a/cache.S b/cache.S
index 32e5652397bac7e5695f6bee615c5fb621565764..081b8a791de238f8998d4758d94945594bcff0bb 100644 (file)
--- a/cache.S
+++ b/cache.S
@@ -37,8 +37,8 @@ flush_caches:
        mrs     x3, ccsidr_el1
        and     x4, x3, #0x7
        add     x4, x4, #4              /* log2 line size, corrected for offset */
-       ubfx    x6, x3, #3, #10         /* ways */
-       clz     w5, w6                  /* log2 ways, rounded down */
+       ubfx    x6, x3, #3, #10         /* max way index */
+       clz     w5, w6                  /* 32 - log2 ways */
        ubfx    x7, x3, #13, #15        /* sets */
 
        /* loop over ways */