2 * Program Status Registers
4 #define PsrMusr 0x00000010 /* mode */
5 #define PsrMfiq 0x00000011
6 #define PsrMirq 0x00000012
7 #define PsrMsvc 0x00000013
8 #define PsrMabt 0x00000017
9 #define PsrMund 0x0000001B
10 #define PsrMsys 0x0000001F
11 #define PsrMask 0x0000001F
13 #define PsrDfiq 0x00000040 /* disable FIQ interrupts */
14 #define PsrDirq 0x00000080 /* disable IRQ interrupts */
16 #define PsrV 0x10000000 /* overflow */
17 #define PsrC 0x20000000 /* carry/borrow/extend */
18 #define PsrZ 0x40000000 /* zero */
19 #define PsrN 0x80000000 /* negative/less than */
21 /* instruction decoding */
22 #define ISCPOP(op) ((op) == 0xE || ((op) & ~1) == 0xC)
23 #define ISFPAOP(cp, op) ((cp) == CpOFPA && ISCPOP(op))
24 #define ISVFPOP(cp, op) (((cp) == CpDFP || (cp) == CpFP) && ISCPOP(op))
29 #define CpOFPA 1 /* ancient 7500 FPA */
30 #define CpFP 10 /* float FP, VFP cfg. */
31 #define CpDFP 11 /* double FP */
32 #define CpSC 15 /* System Control */
37 #define CpDef 0 /* default */
38 #define CpL2 1 /* L2 cache operations */
41 * Primary (CRn) CpSC registers.
43 #define CpID 0 /* ID and cache type */
44 #define CpCONTROL 1 /* miscellaneous control */
45 #define CpTTB 2 /* Translation Table Base */
46 #define CpDAC 3 /* Domain Access Control */
47 #define CpFSR 5 /* Fault Status */
48 #define CpFAR 6 /* Fault Address */
49 #define CpCACHE 7 /* cache/write buffer control */
50 #define CpTLB 8 /* TLB control */
51 #define CpCLD 9 /* Cache Lockdown */
52 #define CpTLD 10 /* TLB Lockdown */
53 #define CpPID 13 /* Process ID */
54 #define CpTESTCFG 15 /* test config. (arm926) */
57 * CpID Secondary (CRm) registers.
61 * CpID op1==0 opcode2 fields.
63 #define CpIDid 0 /* main ID */
64 #define CpIDct 1 /* cache type */
69 #define CpCmmu 0x00000001 /* M: MMU enable */
70 #define CpCalign 0x00000002 /* A: alignment fault enable */
71 #define CpCdcache 0x00000004 /* C: data cache on */
72 #define CpCwb 0x00000008 /* W: write buffer turned on */
73 #define CpCi32 0x00000010 /* P: 32-bit program space */
74 #define CpCd32 0x00000020 /* D: 32-bit data space */
75 #define CpCbe 0x00000080 /* B: big-endian operation */
76 #define CpCsystem 0x00000100 /* S: system permission */
77 #define CpCrom 0x00000200 /* R: ROM permission */
78 #define CpCicache 0x00001000 /* I: instruction cache on */
79 #define CpChv 0x00002000 /* V: high vectors */
82 * CpCACHE Secondary (CRm) registers and opcode2 fields.
83 * In ARM-speak, 'flush' means invalidate and 'clean' means writeback.
84 * In arm arch v6, these must be available in user mode:
85 * CpCACHEinvi, CpCACHEwait (prefetch flush)
86 * CpCACHEwb, CpCACHEwait (DSB: data sync barrier)
87 * CpCACHEwb, CpCACHEdmbarr (DMB: data memory barrier)
89 #define CpCACHEintr 0 /* interrupt */
90 #define CpCACHEinvi 5 /* instruction */
91 #define CpCACHEinvd 6 /* data */
92 #define CpCACHEinvu 7 /* unified (I+D) */
93 #define CpCACHEwb 10 /* writeback D */
94 #define CpCACHEwbu 11 /* writeback U (not 926ejs) */
95 #define CpCACHEwbi 14 /* writeback D + invalidate */
96 #define CpCACHEwbui 15 /* writeback U + inval (not 926ejs) */
99 * the 926ejs manual says that we can't use CpCACHEall nor CpCACHEwait
100 * for writeback operations on the 926ejs, except for CpCACHEwb + CpCACHEwait,
101 * which means `drain write buffer'.
103 #define CpCACHEall 0 /* entire */
104 #define CpCACHEse 1 /* single entry */
105 #define CpCACHEsi 2 /* set/index */
106 #define CpCACHEtest 3 /* test loop */
107 #define CpCACHEwait 4 /* wait */
108 #define CpCACHEdmbarr 5 /* wb: data memory barrier */
111 * CpTLB Secondary (CRm) registers and opcode2 fields.
113 #define CpTLBinvi 5 /* instruction */
114 #define CpTLBinvd 6 /* data */
115 #define CpTLBinvu 7 /* unified */
117 #define CpTLBinv 0 /* invalidate all */
118 #define CpTLBinvse 1 /* invalidate single entry */
121 * CpTESTCFG Secondary (CRm) registers and opcode2 fields; sheeva only.
122 * opcode1 == CpL2 (1). L2 cache operations block the CPU until finished.
123 * Specifically, write-back (clean) blocks until all dirty lines have been
124 * drained from the L2 buffers.
127 #define CpTCl2flush 9 /* cpu blocks until flush done */
128 #define CpTCl2waylck 10
130 #define CpTCl2perfctl 12
131 #define CpTCl2perfcnt 13
136 /* CpTCl2conf bits */
137 #define CpTCldcstream (1<<29) /* D cache streaming switch */
138 #define CpTCl2wralloc (1<<28) /* cache write allocate */
139 #define CpTCl2prefdis (1<<24) /* l2 cache prefetch disable */
140 #define CpTCl2ena (1<<22) /* l2 cache enable */
142 /* CpTCl2flush & CpTCl2inv */
147 #define CpTCl2valow 4
148 #define CpTCl2vahigh 5 /* also triggers flush or inv */
151 #define CpTCecccnt 6 /* ecc error count */
152 #define CpTCeccthr 7 /* ecc error threshold */
155 #define CpTCl2waylock 7
158 #define CpTCl2erraddr 7 /* ecc error address */
161 #define CpTCl2perf0ctl 0
162 #define CpTCl2perf1ctl 1
165 #define CpTCl2perf0low 0
166 #define CpTCl2perf0high 1
167 #define CpTCl2perf1low 2
168 #define CpTCl2perf1high 3
171 * MMU page table entries.
172 * Mbo (0x10) bit is implementation-defined and mandatory on some pre-v7 arms.
174 #define Mbo 0x10 /* must be 1 on earlier arms */
175 #define Fault 0x00000000 /* L[12] pte: unmapped */
177 #define Coarse (Mbo|1) /* L1 */
178 #define Section (Mbo|2) /* L1 1MB */
179 #define Fine (Mbo|3) /* L1 */
181 #define Large 0x00000001u /* L2 64KB */
182 #define Small 0x00000002u /* L2 4KB */
183 #define Tiny 0x00000003u /* L2 1KB, deprecated */
184 #define Buffered 0x00000004u /* L[12]: write-back not -thru */
185 #define Cached 0x00000008u /* L[12] */
188 #define Noaccess 0 /* AP, DAC */
189 #define Krw 1 /* AP */
190 #define Uro 2 /* AP */
191 #define Urw 3 /* AP */
192 #define Client 1 /* DAC */
193 #define Manager 3 /* DAC */
195 #define AP(n, v) F((v), ((n)*2)+4, 2)
196 #define L1AP(ap) (AP(3, (ap))) /* in L1, only Sections have AP */
197 #define L2AP(ap) (AP(3, (ap))|AP(2, (ap))|AP(1, (ap))|AP(0, (ap))) /* pre-armv7 */
198 #define DAC(n, v) F((v), (n)*2, 2)
200 #define HVECTORS 0xffff0000 /* addr of vectors */