1#ifndef __ASM_ARM_CP15_H
2#define __ASM_ARM_CP15_H
3
4#include <asm/barrier.h>
5
6
7
8
9#define CR_M (1 << 0)
10#define CR_A (1 << 1)
11#define CR_C (1 << 2)
12#define CR_W (1 << 3)
13#define CR_P (1 << 4)
14#define CR_D (1 << 5)
15#define CR_L (1 << 6)
16#define CR_B (1 << 7)
17#define CR_S (1 << 8)
18#define CR_R (1 << 9)
19#define CR_F (1 << 10)
20#define CR_Z (1 << 11)
21#define CR_I (1 << 12)
22#define CR_V (1 << 13)
23#define CR_RR (1 << 14)
24#define CR_L4 (1 << 15)
25#define CR_DT (1 << 16)
26#ifdef CONFIG_MMU
27#define CR_HA (1 << 17)
28#else
29#define CR_BR (1 << 17)
30#endif
31#define CR_IT (1 << 18)
32#define CR_ST (1 << 19)
33#define CR_FI (1 << 21)
34#define CR_U (1 << 22)
35#define CR_XP (1 << 23)
36#define CR_VE (1 << 24)
37#define CR_EE (1 << 25)
38#define CR_TRE (1 << 28)
39#define CR_AFE (1 << 29)
40#define CR_TE (1 << 30)
41
42#ifndef __ASSEMBLY__
43
44#if __LINUX_ARM_ARCH__ >= 4
45#define vectors_high() (get_cr() & CR_V)
46#else
47#define vectors_high() (0)
48#endif
49
50#ifdef CONFIG_CPU_CP15
51
52extern unsigned long cr_alignment;
53
54static inline unsigned long get_cr(void)
55{
56 unsigned long val;
57 asm("mrc p15, 0, %0, c1, c0, 0 @ get CR" : "=r" (val) : : "cc");
58 return val;
59}
60
61static inline void set_cr(unsigned long val)
62{
63 asm volatile("mcr p15, 0, %0, c1, c0, 0 @ set CR"
64 : : "r" (val) : "cc");
65 isb();
66}
67
68static inline unsigned int get_auxcr(void)
69{
70 unsigned int val;
71 asm("mrc p15, 0, %0, c1, c0, 1 @ get AUXCR" : "=r" (val));
72 return val;
73}
74
75static inline void set_auxcr(unsigned int val)
76{
77 asm volatile("mcr p15, 0, %0, c1, c0, 1 @ set AUXCR"
78 : : "r" (val));
79 isb();
80}
81
82#define CPACC_FULL(n) (3 << (n * 2))
83#define CPACC_SVC(n) (1 << (n * 2))
84#define CPACC_DISABLE(n) (0 << (n * 2))
85
86static inline unsigned int get_copro_access(void)
87{
88 unsigned int val;
89 asm("mrc p15, 0, %0, c1, c0, 2 @ get copro access"
90 : "=r" (val) : : "cc");
91 return val;
92}
93
94static inline void set_copro_access(unsigned int val)
95{
96 asm volatile("mcr p15, 0, %0, c1, c0, 2 @ set copro access"
97 : : "r" (val) : "cc");
98 isb();
99}
100
101#else
102
103
104
105
106
107
108#define cr_alignment UL(0)
109
110static inline unsigned long get_cr(void)
111{
112 return 0;
113}
114
115#endif
116
117#endif
118
119#endif
120