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>
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 */