• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6/arch/powerpc/platforms/cell/
1/*
2 * Beat hypervisor call I/F
3 *
4 * (C) Copyright 2007 TOSHIBA CORPORATION
5 *
6 * This code is based on arch/powerpc/platforms/pseries/hvCall.S.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23#include <asm/ppc_asm.h>
24
25#define	STK_PARM(i)	(48 + ((i)-3)*8)
26
27/* Not implemented on Beat, now */
28#define	HCALL_INST_PRECALL
29#define	HCALL_INST_POSTCALL
30
31	.text
32
33#define	HVSC	.long	0x44000022
34
35/* Note: takes only 7 input parameters at maximum */
36_GLOBAL(beat_hcall_norets)
37	HMT_MEDIUM
38
39	mfcr	r0
40	stw	r0,8(r1)
41
42	HCALL_INST_PRECALL
43
44	mr	r11,r3
45	mr	r3,r4
46	mr	r4,r5
47	mr	r5,r6
48	mr	r6,r7
49	mr	r7,r8
50	mr	r8,r9
51
52	HVSC				/* invoke the hypervisor */
53
54	HCALL_INST_POSTCALL
55
56	lwz	r0,8(r1)
57	mtcrf	0xff,r0
58
59	blr				/* return r3 = status */
60
61/* Note: takes 8 input parameters at maximum */
62_GLOBAL(beat_hcall_norets8)
63	HMT_MEDIUM
64
65	mfcr	r0
66	stw	r0,8(r1)
67
68	HCALL_INST_PRECALL
69
70	mr	r11,r3
71	mr	r3,r4
72	mr	r4,r5
73	mr	r5,r6
74	mr	r6,r7
75	mr	r7,r8
76	mr	r8,r9
77	ld	r10,STK_PARM(r10)(r1)
78
79	HVSC				/* invoke the hypervisor */
80
81	HCALL_INST_POSTCALL
82
83	lwz	r0,8(r1)
84	mtcrf	0xff,r0
85
86	blr				/* return r3 = status */
87
88/* Note: takes only 6 input parameters, 1 output parameters at maximum */
89_GLOBAL(beat_hcall1)
90	HMT_MEDIUM
91
92	mfcr	r0
93	stw	r0,8(r1)
94
95	HCALL_INST_PRECALL
96
97	std	r4,STK_PARM(r4)(r1)	/* save ret buffer */
98
99	mr	r11,r3
100	mr	r3,r5
101	mr	r4,r6
102	mr	r5,r7
103	mr	r6,r8
104	mr	r7,r9
105	mr	r8,r10
106
107	HVSC				/* invoke the hypervisor */
108
109	HCALL_INST_POSTCALL
110
111	ld	r12,STK_PARM(r4)(r1)
112	std	r4,  0(r12)
113
114	lwz	r0,8(r1)
115	mtcrf	0xff,r0
116
117	blr				/* return r3 = status */
118
119/* Note: takes only 6 input parameters, 2 output parameters at maximum */
120_GLOBAL(beat_hcall2)
121	HMT_MEDIUM
122
123	mfcr	r0
124	stw	r0,8(r1)
125
126	HCALL_INST_PRECALL
127
128	std	r4,STK_PARM(r4)(r1)	/* save ret buffer */
129
130	mr	r11,r3
131	mr	r3,r5
132	mr	r4,r6
133	mr	r5,r7
134	mr	r6,r8
135	mr	r7,r9
136	mr	r8,r10
137
138	HVSC				/* invoke the hypervisor */
139
140	HCALL_INST_POSTCALL
141
142	ld	r12,STK_PARM(r4)(r1)
143	std	r4,  0(r12)
144	std	r5,  8(r12)
145
146	lwz	r0,8(r1)
147	mtcrf	0xff,r0
148
149	blr				/* return r3 = status */
150
151/* Note: takes only 6 input parameters, 3 output parameters at maximum */
152_GLOBAL(beat_hcall3)
153	HMT_MEDIUM
154
155	mfcr	r0
156	stw	r0,8(r1)
157
158	HCALL_INST_PRECALL
159
160	std	r4,STK_PARM(r4)(r1)	/* save ret buffer */
161
162	mr	r11,r3
163	mr	r3,r5
164	mr	r4,r6
165	mr	r5,r7
166	mr	r6,r8
167	mr	r7,r9
168	mr	r8,r10
169
170	HVSC				/* invoke the hypervisor */
171
172	HCALL_INST_POSTCALL
173
174	ld	r12,STK_PARM(r4)(r1)
175	std	r4,  0(r12)
176	std	r5,  8(r12)
177	std	r6, 16(r12)
178
179	lwz	r0,8(r1)
180	mtcrf	0xff,r0
181
182	blr				/* return r3 = status */
183
184/* Note: takes only 6 input parameters, 4 output parameters at maximum */
185_GLOBAL(beat_hcall4)
186	HMT_MEDIUM
187
188	mfcr	r0
189	stw	r0,8(r1)
190
191	HCALL_INST_PRECALL
192
193	std	r4,STK_PARM(r4)(r1)	/* save ret buffer */
194
195	mr	r11,r3
196	mr	r3,r5
197	mr	r4,r6
198	mr	r5,r7
199	mr	r6,r8
200	mr	r7,r9
201	mr	r8,r10
202
203	HVSC				/* invoke the hypervisor */
204
205	HCALL_INST_POSTCALL
206
207	ld	r12,STK_PARM(r4)(r1)
208	std	r4,  0(r12)
209	std	r5,  8(r12)
210	std	r6, 16(r12)
211	std	r7, 24(r12)
212
213	lwz	r0,8(r1)
214	mtcrf	0xff,r0
215
216	blr				/* return r3 = status */
217
218/* Note: takes only 6 input parameters, 5 output parameters at maximum */
219_GLOBAL(beat_hcall5)
220	HMT_MEDIUM
221
222	mfcr	r0
223	stw	r0,8(r1)
224
225	HCALL_INST_PRECALL
226
227	std	r4,STK_PARM(r4)(r1)	/* save ret buffer */
228
229	mr	r11,r3
230	mr	r3,r5
231	mr	r4,r6
232	mr	r5,r7
233	mr	r6,r8
234	mr	r7,r9
235	mr	r8,r10
236
237	HVSC				/* invoke the hypervisor */
238
239	HCALL_INST_POSTCALL
240
241	ld	r12,STK_PARM(r4)(r1)
242	std	r4,  0(r12)
243	std	r5,  8(r12)
244	std	r6, 16(r12)
245	std	r7, 24(r12)
246	std	r8, 32(r12)
247
248	lwz	r0,8(r1)
249	mtcrf	0xff,r0
250
251	blr				/* return r3 = status */
252
253/* Note: takes only 6 input parameters, 6 output parameters at maximum */
254_GLOBAL(beat_hcall6)
255	HMT_MEDIUM
256
257	mfcr	r0
258	stw	r0,8(r1)
259
260	HCALL_INST_PRECALL
261
262	std	r4,STK_PARM(r4)(r1)	/* save ret buffer */
263
264	mr	r11,r3
265	mr	r3,r5
266	mr	r4,r6
267	mr	r5,r7
268	mr	r6,r8
269	mr	r7,r9
270	mr	r8,r10
271
272	HVSC				/* invoke the hypervisor */
273
274	HCALL_INST_POSTCALL
275
276	ld	r12,STK_PARM(r4)(r1)
277	std	r4,  0(r12)
278	std	r5,  8(r12)
279	std	r6, 16(r12)
280	std	r7, 24(r12)
281	std	r8, 32(r12)
282	std	r9, 40(r12)
283
284	lwz	r0,8(r1)
285	mtcrf	0xff,r0
286
287	blr				/* return r3 = status */
288