Linux-libre 4.15.7-gnu
[librecmc/linux-libre.git] / arch / cris / include / arch-v32 / arch / hwregs / supp_reg.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __SUPP_REG_H__
3 #define __SUPP_REG_H__
4
5 /* Macros for reading and writing support/special registers. */
6
7 #ifndef STRINGIFYFY
8 #define STRINGIFYFY(i) #i
9 #endif
10
11 #ifndef STRINGIFY
12 #define STRINGIFY(i) STRINGIFYFY(i)
13 #endif
14
15 #define SPEC_REG_BZ     "BZ"
16 #define SPEC_REG_VR     "VR"
17 #define SPEC_REG_PID    "PID"
18 #define SPEC_REG_SRS    "SRS"
19 #define SPEC_REG_WZ     "WZ"
20 #define SPEC_REG_EXS    "EXS"
21 #define SPEC_REG_EDA    "EDA"
22 #define SPEC_REG_MOF    "MOF"
23 #define SPEC_REG_DZ     "DZ"
24 #define SPEC_REG_EBP    "EBP"
25 #define SPEC_REG_ERP    "ERP"
26 #define SPEC_REG_SRP    "SRP"
27 #define SPEC_REG_NRP    "NRP"
28 #define SPEC_REG_CCS    "CCS"
29 #define SPEC_REG_USP    "USP"
30 #define SPEC_REG_SPC    "SPC"
31
32 #define RW_MM_CFG       0
33 #define RW_MM_KBASE_LO  1
34 #define RW_MM_KBASE_HI  2
35 #define RW_MM_CAUSE     3
36 #define RW_MM_TLB_SEL   4
37 #define RW_MM_TLB_LO    5
38 #define RW_MM_TLB_HI    6
39 #define RW_MM_TLB_PGD   7
40
41 #define BANK_GC         0
42 #define BANK_IM         1
43 #define BANK_DM         2
44 #define BANK_BP         3
45
46 #define RW_GC_CFG       0
47 #define RW_GC_CCS       1
48 #define RW_GC_SRS       2
49 #define RW_GC_NRP       3
50 #define RW_GC_EXS       4
51 #define RW_GC_R0        8
52 #define RW_GC_R1        9
53
54 #define SPEC_REG_WR(r,v) \
55 __asm__ __volatile__ ("move %0, $" r : : "r" (v));
56
57 #define SPEC_REG_RD(r,v) \
58 __asm__ __volatile__ ("move $" r ",%0" : "=r" (v));
59
60 #define NOP() \
61         __asm__ __volatile__ ("nop");
62
63 #define SUPP_BANK_SEL(b)                \
64         SPEC_REG_WR(SPEC_REG_SRS,b);    \
65         NOP();                          \
66         NOP();                          \
67         NOP();
68
69 #define SUPP_REG_WR(r,v) \
70 __asm__ __volatile__ ("move %0, $S" STRINGIFYFY(r) "\n\t"       \
71                       "nop\n\t"                                 \
72                       "nop\n\t"                                 \
73                       "nop\n\t"                                 \
74                       : : "r" (v));
75
76 #define SUPP_REG_RD(r,v) \
77 __asm__ __volatile__ ("move $S" STRINGIFYFY(r) ",%0" : "=r" (v));
78
79 #endif /* __SUPP_REG_H__ */