Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pal.h
Go to the documentation of this file.
1 #ifndef __ALPHA_PAL_H
2 #define __ALPHA_PAL_H
3 
4 /*
5  * Common PAL-code
6  */
7 #define PAL_halt 0
8 #define PAL_cflush 1
9 #define PAL_draina 2
10 #define PAL_bpt 128
11 #define PAL_bugchk 129
12 #define PAL_chmk 131
13 #define PAL_callsys 131
14 #define PAL_imb 134
15 #define PAL_rduniq 158
16 #define PAL_wruniq 159
17 #define PAL_gentrap 170
18 #define PAL_nphalt 190
19 
20 /*
21  * VMS specific PAL-code
22  */
23 #define PAL_swppal 10
24 #define PAL_mfpr_vptb 41
25 
26 /*
27  * OSF specific PAL-code
28  */
29 #define PAL_cserve 9
30 #define PAL_wripir 13
31 #define PAL_rdmces 16
32 #define PAL_wrmces 17
33 #define PAL_wrfen 43
34 #define PAL_wrvptptr 45
35 #define PAL_jtopal 46
36 #define PAL_swpctx 48
37 #define PAL_wrval 49
38 #define PAL_rdval 50
39 #define PAL_tbi 51
40 #define PAL_wrent 52
41 #define PAL_swpipl 53
42 #define PAL_rdps 54
43 #define PAL_wrkgp 55
44 #define PAL_wrusp 56
45 #define PAL_wrperfmon 57
46 #define PAL_rdusp 58
47 #define PAL_whami 60
48 #define PAL_retsys 61
49 #define PAL_rti 63
50 
51 #ifdef __KERNEL__
52 #ifndef __ASSEMBLY__
53 
54 extern void halt(void) __attribute__((noreturn));
55 #define __halt() __asm__ __volatile__ ("call_pal %0 #halt" : : "i" (PAL_halt))
56 
57 #define imb() \
58 __asm__ __volatile__ ("call_pal %0 #imb" : : "i" (PAL_imb) : "memory")
59 
60 #define draina() \
61 __asm__ __volatile__ ("call_pal %0 #draina" : : "i" (PAL_draina) : "memory")
62 
63 #define __CALL_PAL_R0(NAME, TYPE) \
64 extern inline TYPE NAME(void) \
65 { \
66  register TYPE __r0 __asm__("$0"); \
67  __asm__ __volatile__( \
68  "call_pal %1 # " #NAME \
69  :"=r" (__r0) \
70  :"i" (PAL_ ## NAME) \
71  :"$1", "$16", "$22", "$23", "$24", "$25"); \
72  return __r0; \
73 }
74 
75 #define __CALL_PAL_W1(NAME, TYPE0) \
76 extern inline void NAME(TYPE0 arg0) \
77 { \
78  register TYPE0 __r16 __asm__("$16") = arg0; \
79  __asm__ __volatile__( \
80  "call_pal %1 # "#NAME \
81  : "=r"(__r16) \
82  : "i"(PAL_ ## NAME), "0"(__r16) \
83  : "$1", "$22", "$23", "$24", "$25"); \
84 }
85 
86 #define __CALL_PAL_W2(NAME, TYPE0, TYPE1) \
87 extern inline void NAME(TYPE0 arg0, TYPE1 arg1) \
88 { \
89  register TYPE0 __r16 __asm__("$16") = arg0; \
90  register TYPE1 __r17 __asm__("$17") = arg1; \
91  __asm__ __volatile__( \
92  "call_pal %2 # "#NAME \
93  : "=r"(__r16), "=r"(__r17) \
94  : "i"(PAL_ ## NAME), "0"(__r16), "1"(__r17) \
95  : "$1", "$22", "$23", "$24", "$25"); \
96 }
97 
98 #define __CALL_PAL_RW1(NAME, RTYPE, TYPE0) \
99 extern inline RTYPE NAME(TYPE0 arg0) \
100 { \
101  register RTYPE __r0 __asm__("$0"); \
102  register TYPE0 __r16 __asm__("$16") = arg0; \
103  __asm__ __volatile__( \
104  "call_pal %2 # "#NAME \
105  : "=r"(__r16), "=r"(__r0) \
106  : "i"(PAL_ ## NAME), "0"(__r16) \
107  : "$1", "$22", "$23", "$24", "$25"); \
108  return __r0; \
109 }
110 
111 #define __CALL_PAL_RW2(NAME, RTYPE, TYPE0, TYPE1) \
112 extern inline RTYPE NAME(TYPE0 arg0, TYPE1 arg1) \
113 { \
114  register RTYPE __r0 __asm__("$0"); \
115  register TYPE0 __r16 __asm__("$16") = arg0; \
116  register TYPE1 __r17 __asm__("$17") = arg1; \
117  __asm__ __volatile__( \
118  "call_pal %3 # "#NAME \
119  : "=r"(__r16), "=r"(__r17), "=r"(__r0) \
120  : "i"(PAL_ ## NAME), "0"(__r16), "1"(__r17) \
121  : "$1", "$22", "$23", "$24", "$25"); \
122  return __r0; \
123 }
124 
125 __CALL_PAL_W1(cflush, unsigned long);
126 __CALL_PAL_R0(rdmces, unsigned long);
127 __CALL_PAL_R0(rdps, unsigned long);
128 __CALL_PAL_R0(rdusp, unsigned long);
129 __CALL_PAL_RW1(swpipl, unsigned long, unsigned long);
130 __CALL_PAL_R0(whami, unsigned long);
131 __CALL_PAL_W2(wrent, void*, unsigned long);
132 __CALL_PAL_W1(wripir, unsigned long);
133 __CALL_PAL_W1(wrkgp, unsigned long);
134 __CALL_PAL_W1(wrmces, unsigned long);
135 __CALL_PAL_RW2(wrperfmon, unsigned long, unsigned long, unsigned long);
136 __CALL_PAL_W1(wrusp, unsigned long);
137 __CALL_PAL_W1(wrvptptr, unsigned long);
138 
139 /*
140  * TB routines..
141  */
142 #define __tbi(nr,arg,arg1...) \
143 ({ \
144  register unsigned long __r16 __asm__("$16") = (nr); \
145  register unsigned long __r17 __asm__("$17"); arg; \
146  __asm__ __volatile__( \
147  "call_pal %3 #__tbi" \
148  :"=r" (__r16),"=r" (__r17) \
149  :"0" (__r16),"i" (PAL_tbi) ,##arg1 \
150  :"$0", "$1", "$22", "$23", "$24", "$25"); \
151 })
152 
153 #define tbi(x,y) __tbi(x,__r17=(y),"1" (__r17))
154 #define tbisi(x) __tbi(1,__r17=(x),"1" (__r17))
155 #define tbisd(x) __tbi(2,__r17=(x),"1" (__r17))
156 #define tbis(x) __tbi(3,__r17=(x),"1" (__r17))
157 #define tbiap() __tbi(-1, /* no second argument */)
158 #define tbia() __tbi(-2, /* no second argument */)
159 
160 #endif /* !__ASSEMBLY__ */
161 #endif /* __KERNEL__ */
162 
163 #endif /* __ALPHA_PAL_H */