blob: 9a99b056bd2727036e289623ef5dd595d45a7c95 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * This file contains the generic code to perform a call to the
3 * pSeries LPAR hypervisor.
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
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
Linus Torvalds1da177e2005-04-16 15:20:36 -070018_GLOBAL(plpar_hcall_norets)
Anton Blanchardeeb24de2005-05-01 08:58:46 -070019 HMT_MEDIUM
20
Linus Torvalds1da177e2005-04-16 15:20:36 -070021 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
Anton Blanchardb9377ff2006-07-19 08:01:28 +100030_GLOBAL(plpar_hcall)
Anton Blanchardeeb24de2005-05-01 08:58:46 -070031 HMT_MEDIUM
32
Linus Torvalds1da177e2005-04-16 15:20:36 -070033 mfcr r0
34 stw r0,8(r1)
35
Anton Blanchardb9377ff2006-07-19 08:01:28 +100036 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
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
45 HVSC /* invoke the hypervisor */
46
Anton Blanchardb9377ff2006-07-19 08:01:28 +100047 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)
Heiko J Schickb13a96cf2006-03-30 22:47:14 +020052
53 lwz r0,8(r1)
Heiko J Schickb13a96cf2006-03-30 22:47:14 +020054 mtcrf 0xff,r0
55
56 blr /* return r3 = status */
57
Anton Blanchardb9377ff2006-07-19 08:01:28 +100058_GLOBAL(plpar_hcall9)
Heiko J Schickb13a96cf2006-03-30 22:47:14 +020059 HMT_MEDIUM
60
61 mfcr r0
62 stw r0,8(r1)
63
Anton Blanchardb9377ff2006-07-19 08:01:28 +100064 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 */
Heiko J Schickb13a96cf2006-03-30 22:47:14 +020075
76 HVSC /* invoke the hypervisor */
77
Anton Blanchardb9377ff2006-07-19 08:01:28 +100078 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)
Heiko J Schickb13a96cf2006-03-30 22:47:14 +020088
89 lwz r0,8(r1)
90 mtcrf 0xff,r0
91
92 blr /* return r3 = status */