Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / ppc64 / kernel / pSeries_hvCall.S
blob0715d3038019987144723d7a8fca55ec4a715704
1 /*
2  * arch/ppc64/kernel/pSeries_hvCall.S
3  *
4  * This file contains the generic code to perform a call to the
5  * pSeries LPAR hypervisor.
6  * NOTE: this file will go away when we move to inline this work.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version
11  * 2 of the License, or (at your option) any later version.
12  */
13 #include <asm/hvcall.h>
14 #include <asm/processor.h>
15 #include <asm/ppc_asm.h>
16         
17 #define STK_PARM(i)     (48 + ((i)-3)*8)
19         .text
21 /* long plpar_hcall(unsigned long opcode,               R3
22                         unsigned long arg1,             R4
23                         unsigned long arg2,             R5
24                         unsigned long arg3,             R6
25                         unsigned long arg4,             R7
26                         unsigned long *out1,            R8
27                         unsigned long *out2,            R9
28                         unsigned long *out3);           R10
29  */
30 _GLOBAL(plpar_hcall)
31         mfcr    r0
33         std     r8,STK_PARM(r8)(r1)     /* Save out ptrs */
34         std     r9,STK_PARM(r9)(r1)
35         std     r10,STK_PARM(r10)(r1)
37         stw     r0,8(r1)
39         HVSC                            /* invoke the hypervisor */
41         lwz     r0,8(r1)
43         ld      r8,STK_PARM(r8)(r1)     /* Fetch r4-r6 ret args */
44         ld      r9,STK_PARM(r9)(r1)
45         ld      r10,STK_PARM(r10)(r1)
46         std     r4,0(r8)
47         std     r5,0(r9)
48         std     r6,0(r10)
50         mtcrf   0xff,r0
51         blr                             /* return r3 = status */
54 /* Simple interface with no output values (other than status) */
55 _GLOBAL(plpar_hcall_norets)
56         mfcr    r0
57         stw     r0,8(r1)
59         HVSC                            /* invoke the hypervisor */
61         lwz     r0,8(r1)
62         mtcrf   0xff,r0
63         blr                             /* return r3 = status */
66 /* long plpar_hcall_8arg_2ret(unsigned long opcode,     R3
67                         unsigned long arg1,             R4
68                         unsigned long arg2,             R5
69                         unsigned long arg3,             R6
70                         unsigned long arg4,             R7
71                         unsigned long arg5,             R8
72                         unsigned long arg6,             R9
73                         unsigned long arg7,             R10
74                         unsigned long arg8,             112(R1)
75                         unsigned long *out1);           120(R1)
76  */
77 _GLOBAL(plpar_hcall_8arg_2ret)
78         mfcr    r0
79         ld      r11,STK_PARM(r11)(r1)   /* put arg8 in R11 */
80         stw     r0,8(r1)
82         HVSC                            /* invoke the hypervisor */
84         lwz     r0,8(r1)
85         ld      r10,STK_PARM(r12)(r1)   /* Fetch r4 ret arg */
86         std     r4,0(r10)
87         mtcrf   0xff,r0
88         blr                             /* return r3 = status */
91 /* long plpar_hcall_4out(unsigned long opcode,          R3
92                         unsigned long arg1,             R4
93                         unsigned long arg2,             R5
94                         unsigned long arg3,             R6
95                         unsigned long arg4,             R7
96                         unsigned long *out1,            R8
97                         unsigned long *out2,            R9
98                         unsigned long *out3,            R10
99                         unsigned long *out4);           112(R1)
100  */
101 _GLOBAL(plpar_hcall_4out)
102         mfcr    r0
103         stw     r0,8(r1)
105         std     r8,STK_PARM(r8)(r1)     /* Save out ptrs */
106         std     r9,STK_PARM(r9)(r1)
107         std     r10,STK_PARM(r10)(r1)
109         HVSC                            /* invoke the hypervisor */
111         lwz     r0,8(r1)
113         ld      r8,STK_PARM(r8)(r1)     /* Fetch r4-r7 ret args */
114         ld      r9,STK_PARM(r9)(r1)
115         ld      r10,STK_PARM(r10)(r1)
116         ld      r11,STK_PARM(r11)(r1)
117         std     r4,0(r8)
118         std     r5,0(r9)
119         std     r6,0(r10)
120         std     r7,0(r11)
122         mtcrf   0xff,r0
123         blr                             /* return r3 = status */