aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/ps3-hvcall.S
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/boot/ps3-hvcall.S')
-rw-r--r--arch/powerpc/boot/ps3-hvcall.S184
1 files changed, 184 insertions, 0 deletions
diff --git a/arch/powerpc/boot/ps3-hvcall.S b/arch/powerpc/boot/ps3-hvcall.S
new file mode 100644
index 000000000000..c8b7df3210d1
--- /dev/null
+++ b/arch/powerpc/boot/ps3-hvcall.S
@@ -0,0 +1,184 @@
1/*
2 * PS3 bootwrapper hvcalls.
3 *
4 * Copyright (C) 2007 Sony Computer Entertainment Inc.
5 * Copyright 2007 Sony Corp.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include "ppc_asm.h"
22
23/*
24 * The PS3 hypervisor uses a 64 bit "C" language calling convention.
25 * The routines here marshal arguments between the 32 bit wrapper
26 * program and the 64 bit hvcalls.
27 *
28 * wrapper lv1
29 * 32-bit (h,l) 64-bit
30 *
31 * 1: r3,r4 <-> r3
32 * 2: r5,r6 <-> r4
33 * 3: r7,r8 <-> r5
34 * 4: r9,r10 <-> r6
35 * 5: 8(r1),12(r1) <-> r7
36 * 6: 16(r1),20(r1) <-> r8
37 * 7: 24(r1),28(r1) <-> r9
38 * 8: 32(r1),36(r1) <-> r10
39 *
40 */
41
42.macro GLOBAL name
43 .section ".text"
44 .balign 4
45 .globl \name
46\name:
47.endm
48
49.macro NO_SUPPORT name
50 GLOBAL \name
51 b ps3_no_support
52.endm
53
54.macro HVCALL num
55 li r11, \num
56 .long 0x44000022
57 extsw r3, r3
58.endm
59
60.macro SAVE_LR offset=4
61 mflr r0
62 stw r0, \offset(r1)
63.endm
64
65.macro LOAD_LR offset=4
66 lwz r0, \offset(r1)
67 mtlr r0
68.endm
69
70.macro LOAD_64_REG target,high,low
71 sldi r11, \high, 32
72 or \target, r11, \low
73.endm
74
75.macro LOAD_64_STACK target,offset
76 ld \target, \offset(r1)
77.endm
78
79.macro LOAD_R3
80 LOAD_64_REG r3,r3,r4
81.endm
82
83.macro LOAD_R4
84 LOAD_64_REG r4,r5,r6
85.endm
86
87.macro LOAD_R5
88 LOAD_64_REG r5,r7,r8
89.endm
90
91.macro LOAD_R6
92 LOAD_64_REG r6,r9,r10
93.endm
94
95.macro LOAD_R7
96 LOAD_64_STACK r7,8
97.endm
98
99.macro LOAD_R8
100 LOAD_64_STACK r8,16
101.endm
102
103.macro LOAD_R9
104 LOAD_64_STACK r9,24
105.endm
106
107.macro LOAD_R10
108 LOAD_64_STACK r10,32
109.endm
110
111.macro LOAD_REGS_0
112 stwu 1,-16(1)
113 stw 3, 8(1)
114.endm
115
116.macro LOAD_REGS_5
117 LOAD_R3
118 LOAD_R4
119 LOAD_R5
120 LOAD_R6
121 LOAD_R7
122.endm
123
124.macro LOAD_REGS_6
125 LOAD_REGS_5
126 LOAD_R8
127.endm
128
129.macro LOAD_REGS_8
130 LOAD_REGS_6
131 LOAD_R9
132 LOAD_R10
133.endm
134
135.macro STORE_REGS_0_1
136 lwz r11, 8(r1)
137 std r4, 0(r11)
138 mr r4, r3
139 li r3, 0
140 addi r1,r1,16
141.endm
142
143.macro STORE_REGS_5_2
144 lwz r11, 16(r1)
145 std r4, 0(r11)
146 lwz r11, 24(r1)
147 std r5, 0(r11)
148.endm
149
150.macro STORE_REGS_6_1
151 lwz r11, 24(r1)
152 std r4, 0(r11)
153.endm
154
155GLOBAL lv1_get_logical_ppe_id
156 SAVE_LR
157 LOAD_REGS_0
158 HVCALL 69
159 STORE_REGS_0_1
160 LOAD_LR
161 blr
162
163GLOBAL lv1_get_logical_partition_id
164 SAVE_LR
165 LOAD_REGS_0
166 HVCALL 74
167 STORE_REGS_0_1
168 LOAD_LR
169 blr
170
171GLOBAL lv1_get_repository_node_value
172 SAVE_LR
173 LOAD_REGS_5
174 HVCALL 91
175 STORE_REGS_5_2
176 LOAD_LR
177 blr
178
179GLOBAL lv1_panic
180 SAVE_LR
181 LOAD_REGS_8
182 HVCALL 255
183 LOAD_LR
184 blr