Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck...
[pandora-kernel.git] / arch / powerpc / platforms / cell / beat_hvCall.S
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 /* Not implemented on Beat, now */
26 #define HCALL_INST_PRECALL
27 #define HCALL_INST_POSTCALL
28
29         .text
30
31 #define HVSC    .long   0x44000022
32
33 /* Note: takes only 7 input parameters at maximum */
34 _GLOBAL(beat_hcall_norets)
35         HMT_MEDIUM
36
37         mfcr    r0
38         stw     r0,8(r1)
39
40         HCALL_INST_PRECALL
41
42         mr      r11,r3
43         mr      r3,r4
44         mr      r4,r5
45         mr      r5,r6
46         mr      r6,r7
47         mr      r7,r8
48         mr      r8,r9
49
50         HVSC                            /* invoke the hypervisor */
51
52         HCALL_INST_POSTCALL
53
54         lwz     r0,8(r1)
55         mtcrf   0xff,r0
56
57         blr                             /* return r3 = status */
58
59 /* Note: takes 8 input parameters at maximum */
60 _GLOBAL(beat_hcall_norets8)
61         HMT_MEDIUM
62
63         mfcr    r0
64         stw     r0,8(r1)
65
66         HCALL_INST_PRECALL
67
68         mr      r11,r3
69         mr      r3,r4
70         mr      r4,r5
71         mr      r5,r6
72         mr      r6,r7
73         mr      r7,r8
74         mr      r8,r9
75         ld      r10,STK_PARAM(R10)(r1)
76
77         HVSC                            /* invoke the hypervisor */
78
79         HCALL_INST_POSTCALL
80
81         lwz     r0,8(r1)
82         mtcrf   0xff,r0
83
84         blr                             /* return r3 = status */
85
86 /* Note: takes only 6 input parameters, 1 output parameters at maximum */
87 _GLOBAL(beat_hcall1)
88         HMT_MEDIUM
89
90         mfcr    r0
91         stw     r0,8(r1)
92
93         HCALL_INST_PRECALL
94
95         std     r4,STK_PARAM(R4)(r1)    /* save ret buffer */
96
97         mr      r11,r3
98         mr      r3,r5
99         mr      r4,r6
100         mr      r5,r7
101         mr      r6,r8
102         mr      r7,r9
103         mr      r8,r10
104
105         HVSC                            /* invoke the hypervisor */
106
107         HCALL_INST_POSTCALL
108
109         ld      r12,STK_PARAM(R4)(r1)
110         std     r4,  0(r12)
111
112         lwz     r0,8(r1)
113         mtcrf   0xff,r0
114
115         blr                             /* return r3 = status */
116
117 /* Note: takes only 6 input parameters, 2 output parameters at maximum */
118 _GLOBAL(beat_hcall2)
119         HMT_MEDIUM
120
121         mfcr    r0
122         stw     r0,8(r1)
123
124         HCALL_INST_PRECALL
125
126         std     r4,STK_PARAM(R4)(r1)    /* save ret buffer */
127
128         mr      r11,r3
129         mr      r3,r5
130         mr      r4,r6
131         mr      r5,r7
132         mr      r6,r8
133         mr      r7,r9
134         mr      r8,r10
135
136         HVSC                            /* invoke the hypervisor */
137
138         HCALL_INST_POSTCALL
139
140         ld      r12,STK_PARAM(R4)(r1)
141         std     r4,  0(r12)
142         std     r5,  8(r12)
143
144         lwz     r0,8(r1)
145         mtcrf   0xff,r0
146
147         blr                             /* return r3 = status */
148
149 /* Note: takes only 6 input parameters, 3 output parameters at maximum */
150 _GLOBAL(beat_hcall3)
151         HMT_MEDIUM
152
153         mfcr    r0
154         stw     r0,8(r1)
155
156         HCALL_INST_PRECALL
157
158         std     r4,STK_PARAM(R4)(r1)    /* save ret buffer */
159
160         mr      r11,r3
161         mr      r3,r5
162         mr      r4,r6
163         mr      r5,r7
164         mr      r6,r8
165         mr      r7,r9
166         mr      r8,r10
167
168         HVSC                            /* invoke the hypervisor */
169
170         HCALL_INST_POSTCALL
171
172         ld      r12,STK_PARAM(R4)(r1)
173         std     r4,  0(r12)
174         std     r5,  8(r12)
175         std     r6, 16(r12)
176
177         lwz     r0,8(r1)
178         mtcrf   0xff,r0
179
180         blr                             /* return r3 = status */
181
182 /* Note: takes only 6 input parameters, 4 output parameters at maximum */
183 _GLOBAL(beat_hcall4)
184         HMT_MEDIUM
185
186         mfcr    r0
187         stw     r0,8(r1)
188
189         HCALL_INST_PRECALL
190
191         std     r4,STK_PARAM(R4)(r1)    /* save ret buffer */
192
193         mr      r11,r3
194         mr      r3,r5
195         mr      r4,r6
196         mr      r5,r7
197         mr      r6,r8
198         mr      r7,r9
199         mr      r8,r10
200
201         HVSC                            /* invoke the hypervisor */
202
203         HCALL_INST_POSTCALL
204
205         ld      r12,STK_PARAM(R4)(r1)
206         std     r4,  0(r12)
207         std     r5,  8(r12)
208         std     r6, 16(r12)
209         std     r7, 24(r12)
210
211         lwz     r0,8(r1)
212         mtcrf   0xff,r0
213
214         blr                             /* return r3 = status */
215
216 /* Note: takes only 6 input parameters, 5 output parameters at maximum */
217 _GLOBAL(beat_hcall5)
218         HMT_MEDIUM
219
220         mfcr    r0
221         stw     r0,8(r1)
222
223         HCALL_INST_PRECALL
224
225         std     r4,STK_PARAM(R4)(r1)    /* save ret buffer */
226
227         mr      r11,r3
228         mr      r3,r5
229         mr      r4,r6
230         mr      r5,r7
231         mr      r6,r8
232         mr      r7,r9
233         mr      r8,r10
234
235         HVSC                            /* invoke the hypervisor */
236
237         HCALL_INST_POSTCALL
238
239         ld      r12,STK_PARAM(R4)(r1)
240         std     r4,  0(r12)
241         std     r5,  8(r12)
242         std     r6, 16(r12)
243         std     r7, 24(r12)
244         std     r8, 32(r12)
245
246         lwz     r0,8(r1)
247         mtcrf   0xff,r0
248
249         blr                             /* return r3 = status */
250
251 /* Note: takes only 6 input parameters, 6 output parameters at maximum */
252 _GLOBAL(beat_hcall6)
253         HMT_MEDIUM
254
255         mfcr    r0
256         stw     r0,8(r1)
257
258         HCALL_INST_PRECALL
259
260         std     r4,STK_PARAM(R4)(r1)    /* save ret buffer */
261
262         mr      r11,r3
263         mr      r3,r5
264         mr      r4,r6
265         mr      r5,r7
266         mr      r6,r8
267         mr      r7,r9
268         mr      r8,r10
269
270         HVSC                            /* invoke the hypervisor */
271
272         HCALL_INST_POSTCALL
273
274         ld      r12,STK_PARAM(R4)(r1)
275         std     r4,  0(r12)
276         std     r5,  8(r12)
277         std     r6, 16(r12)
278         std     r7, 24(r12)
279         std     r8, 32(r12)
280         std     r9, 40(r12)
281
282         lwz     r0,8(r1)
283         mtcrf   0xff,r0
284
285         blr                             /* return r3 = status */