2
* GRUB -- GRand Unified Bootloader
3
* Copyright (C) 2013 Free Software Foundation, Inc.
5
* GRUB is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
10
* GRUB is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19
#include <grub/symbol.h>
24
#if !defined (__thumb2__)
48
clean_invalidate_dcache:
50
mrc p15, 1, r0, c0, c0, 1 @ Read CLIDR
51
lsr r1, r0, #24 @ Extract LoC
54
mov r2, #0 @ First level, L1
55
2: and r8, r0, #7 @ cache type at current level
57
blt 5f @ instruction only, or none, skip level
59
@ set current cache level/type (for CCSIDR read)
61
mcr p15, 2, r8, c0, c0, 0 @ Write CSSELR (level, type: data/uni)
63
@ read current cache information
64
mrc p15, 1, r8, c0, c0, 0 @ Read CCSIDR
65
lsr r3, r8, #13 @ Number of sets -1
67
@ Keep only 14 bits of r3
71
lsr r4, r8, #3 @ Number of ways -1
73
@ Keep only 9 bits of r4
77
and r7, r8, #7 @ log2(line size in words) - 2
78
add r7, r7, #2 @ adjust
80
lsl r7, r8, r7 @ -> line size in words
81
lsl r7, r7, #2 @ -> bytes
84
mov r5, #0 @ current set = 0
85
3: lsl r8, r2, #1 @ insert level
86
clz r9, r7 @ calculate set field offset
90
orr r8, r8, r10 @ insert set field
93
@ calculate way field offset
94
mov r6, #0 @ current way = 0
96
clz r9, r10 @ r9 = way field offset
99
orr r11, r8, r10 @ insert way field
101
@ clean and invalidate line by set/way
102
mcr p15, 0, r11, c7, c14, 2 @ DCCISW
115
5: lsr r0, r0, #3 @ align next level CLIDR 'type' field
116
add r2, r2, #1 @ increment cache level counter
b'\\ No newline at end of file'