Merge branch 'merge'
[pandora-kernel.git] / arch / powerpc / platforms / pseries / hvCall.S
1 /*
2  * This file contains the generic code to perform a call to the
3  * pSeries LPAR hypervisor.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version
8  * 2 of the License, or (at your option) any later version.
9  */
10 #include <asm/hvcall.h>
11 #include <asm/processor.h>
12 #include <asm/ppc_asm.h>
13         
14 #define STK_PARM(i)     (48 + ((i)-3)*8)
15
16         .text
17
18 _GLOBAL(plpar_hcall_norets)
19         HMT_MEDIUM
20
21         mfcr    r0
22         stw     r0,8(r1)
23
24         HVSC                            /* invoke the hypervisor */
25
26         lwz     r0,8(r1)
27         mtcrf   0xff,r0
28         blr                             /* return r3 = status */
29
30 _GLOBAL(plpar_hcall)
31         HMT_MEDIUM
32
33         mfcr    r0
34         stw     r0,8(r1)
35
36         std     r4,STK_PARM(r4)(r1)     /* Save ret buffer */
37
38         mr      r4,r5
39         mr      r5,r6
40         mr      r6,r7
41         mr      r7,r8
42         mr      r8,r9
43         mr      r9,r10
44
45         HVSC                            /* invoke the hypervisor */
46
47         ld      r12,STK_PARM(r4)(r1)
48         std     r4,  0(r12)
49         std     r5,  8(r12)
50         std     r6, 16(r12)
51         std     r7, 24(r12)
52
53         lwz     r0,8(r1)
54         mtcrf   0xff,r0
55
56         blr                             /* return r3 = status */
57
58 _GLOBAL(plpar_hcall9)
59         HMT_MEDIUM
60
61         mfcr    r0
62         stw     r0,8(r1)
63
64         std     r4,STK_PARM(r4)(r1)     /* Save ret buffer */
65
66         mr      r4,r5
67         mr      r5,r6
68         mr      r6,r7
69         mr      r7,r8
70         mr      r8,r9
71         mr      r9,r10
72         ld      r10,STK_PARM(r11)(r1)    /* put arg7 in R10 */
73         ld      r11,STK_PARM(r12)(r1)    /* put arg8 in R11 */
74         ld      r12,STK_PARM(r13)(r1)    /* put arg9 in R12 */
75
76         HVSC                            /* invoke the hypervisor */
77
78         ld      r12,STK_PARM(r4)(r1)
79         std     r4,  0(r12)
80         std     r5,  8(r12)
81         std     r6, 16(r12)
82         std     r7, 24(r12)
83         std     r8, 32(r12)
84         std     r9, 40(r12)
85         std     r10,48(r12)
86         std     r11,56(r12)
87         std     r12,64(r12)
88
89         lwz     r0,8(r1)
90         mtcrf   0xff,r0
91
92         blr                             /* return r3 = status */