1
2
3
4
5
6
7
8#ifndef _AP_ASM_H_
9#define _AP_ASM_H_
10
11#include <asm/isc.h>
12
13
14
15
16
17
18static inline int ap_instructions_available(void)
19{
20 register unsigned long reg0 asm ("0") = AP_MKQID(0, 0);
21 register unsigned long reg1 asm ("1") = -ENODEV;
22 register unsigned long reg2 asm ("2") = 0UL;
23
24 asm volatile(
25 " .long 0xb2af0000\n"
26 "0: la %1,0\n"
27 "1:\n"
28 EX_TABLE(0b, 1b)
29 : "+d" (reg0), "+d" (reg1), "+d" (reg2) : : "cc");
30 return reg1;
31}
32
33
34
35
36
37
38
39
40static inline struct ap_queue_status ap_tapq(ap_qid_t qid, unsigned long *info)
41{
42 register unsigned long reg0 asm ("0") = qid;
43 register struct ap_queue_status reg1 asm ("1");
44 register unsigned long reg2 asm ("2") = 0UL;
45
46 asm volatile(".long 0xb2af0000"
47 : "+d" (reg0), "=d" (reg1), "+d" (reg2) : : "cc");
48 if (info)
49 *info = reg2;
50 return reg1;
51}
52
53
54
55
56
57
58
59static inline struct ap_queue_status ap_rapq(ap_qid_t qid)
60{
61 register unsigned long reg0 asm ("0") = qid | 0x01000000UL;
62 register struct ap_queue_status reg1 asm ("1");
63 register unsigned long reg2 asm ("2") = 0UL;
64
65 asm volatile(
66 ".long 0xb2af0000"
67 : "+d" (reg0), "=d" (reg1), "+d" (reg2) : : "cc");
68 return reg1;
69}
70
71
72
73
74
75
76
77
78
79static inline struct ap_queue_status ap_aqic(ap_qid_t qid,
80 struct ap_qirq_ctrl qirqctrl,
81 void *ind)
82{
83 register unsigned long reg0 asm ("0") = qid | (3UL << 24);
84 register struct ap_qirq_ctrl reg1_in asm ("1") = qirqctrl;
85 register struct ap_queue_status reg1_out asm ("1");
86 register void *reg2 asm ("2") = ind;
87
88 asm volatile(
89 ".long 0xb2af0000"
90 : "+d" (reg0), "+d" (reg1_in), "=d" (reg1_out), "+d" (reg2)
91 :
92 : "cc");
93 return reg1_out;
94}
95
96
97
98
99
100
101static inline int ap_qci(void *config)
102{
103 register unsigned long reg0 asm ("0") = 0x04000000UL;
104 register unsigned long reg1 asm ("1") = -EINVAL;
105 register void *reg2 asm ("2") = (void *) config;
106
107 asm volatile(
108 ".long 0xb2af0000\n"
109 "0: la %1,0\n"
110 "1:\n"
111 EX_TABLE(0b, 1b)
112 : "+d" (reg0), "+d" (reg1), "+d" (reg2)
113 :
114 : "cc", "memory");
115
116 return reg1;
117}
118
119
120
121
122
123
124struct ap_qact_ap_info {
125 unsigned int _res1 : 3;
126 unsigned int mode : 3;
127 unsigned int _res2 : 26;
128 unsigned int cat : 8;
129 unsigned int _res3 : 8;
130 unsigned char ver[2];
131};
132
133
134
135
136
137
138
139
140
141
142static inline struct ap_queue_status ap_qact(ap_qid_t qid, int ifbit,
143 struct ap_qact_ap_info *apinfo)
144{
145 register unsigned long reg0 asm ("0") = qid | (5UL << 24)
146 | ((ifbit & 0x01) << 22);
147 register struct ap_qact_ap_info reg1_in asm ("1") = *apinfo;
148 register struct ap_queue_status reg1_out asm ("1");
149 register unsigned long reg2_in asm ("2") = 0;
150 register struct ap_qact_ap_info reg2_out asm ("2");
151
152 asm volatile(
153 ".long 0xb2af0000"
154 : "+d" (reg0), "+d" (reg1_in), "=d" (reg1_out),
155 "+d" (reg2_in), "=d" (reg2_out)
156 :
157 : "cc");
158 *apinfo = reg2_out;
159 return reg1_out;
160}
161
162
163
164
165
166
167
168
169
170
171
172
173
174static inline struct ap_queue_status ap_nqap(ap_qid_t qid,
175 unsigned long long psmid,
176 void *msg, size_t length)
177{
178 register unsigned long reg0 asm ("0") = qid | 0x40000000UL;
179 register struct ap_queue_status reg1 asm ("1");
180 register unsigned long reg2 asm ("2") = (unsigned long) msg;
181 register unsigned long reg3 asm ("3") = (unsigned long) length;
182 register unsigned long reg4 asm ("4") = (unsigned int) (psmid >> 32);
183 register unsigned long reg5 asm ("5") = psmid & 0xffffffff;
184
185 asm volatile (
186 "0: .long 0xb2ad0042\n"
187 " brc 2,0b"
188 : "+d" (reg0), "=d" (reg1), "+d" (reg2), "+d" (reg3)
189 : "d" (reg4), "d" (reg5)
190 : "cc", "memory");
191 return reg1;
192}
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212static inline struct ap_queue_status ap_dqap(ap_qid_t qid,
213 unsigned long long *psmid,
214 void *msg, size_t length)
215{
216 register unsigned long reg0 asm("0") = qid | 0x80000000UL;
217 register struct ap_queue_status reg1 asm ("1");
218 register unsigned long reg2 asm("2") = 0UL;
219 register unsigned long reg4 asm("4") = (unsigned long) msg;
220 register unsigned long reg5 asm("5") = (unsigned long) length;
221 register unsigned long reg6 asm("6") = 0UL;
222 register unsigned long reg7 asm("7") = 0UL;
223
224
225 asm volatile(
226 "0: .long 0xb2ae0064\n"
227 " brc 6,0b\n"
228 : "+d" (reg0), "=d" (reg1), "+d" (reg2),
229 "+d" (reg4), "+d" (reg5), "+d" (reg6), "+d" (reg7)
230 : : "cc", "memory");
231 *psmid = (((unsigned long long) reg6) << 32) + reg7;
232 return reg1;
233}
234
235#endif
236