Merge head 'upstream' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev
[linux-2.6] / arch / ppc64 / kernel / hvCall.S
1 /*
2  * arch/ppc64/kernel/hvCall.S
3  *
4  *
5  * This file contains the code to perform calls to the
6  * iSeries LPAR hypervisor
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
14 #include <asm/ppc_asm.h>
15 #include <asm/processor.h>
16
17         .text
18
19 /* 
20  * Hypervisor call
21  * 
22  * Invoke the iSeries hypervisor via the System Call instruction
23  * Parameters are passed to this routine in registers r3 - r10
24  * 
25  * r3 contains the HV function to be called
26  * r4-r10 contain the operands to the hypervisor function
27  *
28  */
29
30 _GLOBAL(HvCall)
31 _GLOBAL(HvCall0)
32 _GLOBAL(HvCall1)
33 _GLOBAL(HvCall2)
34 _GLOBAL(HvCall3)
35 _GLOBAL(HvCall4)
36 _GLOBAL(HvCall5)
37 _GLOBAL(HvCall6)
38 _GLOBAL(HvCall7)
39
40
41         mfcr    r0
42         std     r0,-8(r1)
43         stdu    r1,-(STACK_FRAME_OVERHEAD+16)(r1)
44         
45         /* r0 = 0xffffffffffffffff indicates a hypervisor call */
46         
47         li      r0,-1
48         
49         /* Invoke the hypervisor */
50
51         sc
52
53         ld      r1,0(r1)
54         ld      r0,-8(r1)
55         mtcrf   0xff,r0
56
57         /*  return to caller, return value in r3 */
58         
59         blr
60
61 _GLOBAL(HvCall0Ret16)
62 _GLOBAL(HvCall1Ret16)
63 _GLOBAL(HvCall2Ret16)
64 _GLOBAL(HvCall3Ret16)
65 _GLOBAL(HvCall4Ret16)
66 _GLOBAL(HvCall5Ret16)
67 _GLOBAL(HvCall6Ret16)
68 _GLOBAL(HvCall7Ret16)
69
70         mfcr    r0
71         std     r0,-8(r1)
72         std     r31,-16(r1)
73         stdu    r1,-(STACK_FRAME_OVERHEAD+32)(r1)
74
75         mr      r31,r4
76         li      r0,-1
77         mr      r4,r5
78         mr      r5,r6
79         mr      r6,r7
80         mr      r7,r8
81         mr      r8,r9
82         mr      r9,r10
83
84         sc
85
86         std     r3,0(r31)
87         std     r4,8(r31)
88
89         mr      r3,r5
90
91         ld      r1,0(r1)
92         ld      r0,-8(r1)
93         mtcrf   0xff,r0
94         ld      r31,-16(r1)
95         
96         blr
97
98