blob: 029afaef1e6634cf55d3b0cf5c4505fbdfd9d186 [file] [log] [blame]
David Gibsond3d21762005-11-10 15:26:20 +11001#ifndef _ASM_POWERPC_HVCALL_H
2#define _ASM_POWERPC_HVCALL_H
Arnd Bergmann88ced032005-12-16 22:43:46 +01003#ifdef __KERNEL__
Linus Torvalds1da177e2005-04-16 15:20:36 -07004
5#define HVSC .long 0x44000022
6
Segher Boessenkool706c8c92006-03-30 14:49:40 +02007#define H_SUCCESS 0
8#define H_BUSY 1 /* Hardware busy -- retry later */
9#define H_CLOSED 2 /* Resource closed */
10#define H_CONSTRAINED 4 /* Resource request constrained to max allowed */
11#define H_IN_PROGRESS 14 /* Kind of like busy */
12#define H_PENDING 17 /* returned from H_POLL_PENDING */
13#define H_CONTINUE 18 /* Returned from H_Join on success */
14#define H_LONG_BUSY_START_RANGE 9900 /* Start of long busy range */
15#define H_LONG_BUSY_ORDER_1_MSEC 9900 /* Long busy, hint that 1msec \
16 is a good time to retry */
17#define H_LONG_BUSY_ORDER_10_MSEC 9901 /* Long busy, hint that 10msec \
18 is a good time to retry */
19#define H_LONG_BUSY_ORDER_100_MSEC 9902 /* Long busy, hint that 100msec \
20 is a good time to retry */
21#define H_LONG_BUSY_ORDER_1_SEC 9903 /* Long busy, hint that 1sec \
22 is a good time to retry */
23#define H_LONG_BUSY_ORDER_10_SEC 9904 /* Long busy, hint that 10sec \
24 is a good time to retry */
25#define H_LONG_BUSY_ORDER_100_SEC 9905 /* Long busy, hint that 100sec \
26 is a good time to retry */
27#define H_LONG_BUSY_END_RANGE 9905 /* End of long busy range */
28#define H_HARDWARE -1 /* Hardware error */
29#define H_FUNCTION -2 /* Function not supported */
30#define H_PRIVILEGE -3 /* Caller not privileged */
31#define H_PARAMETER -4 /* Parameter invalid, out-of-range or conflicting */
32#define H_BAD_MODE -5 /* Illegal msr value */
33#define H_PTEG_FULL -6 /* PTEG is full */
34#define H_NOT_FOUND -7 /* PTE was not found" */
35#define H_RESERVED_DABR -8 /* DABR address is reserved by the hypervisor on this processor" */
36#define H_NO_MEM -9
37#define H_AUTHORITY -10
38#define H_PERMISSION -11
39#define H_DROPPED -12
40#define H_SOURCE_PARM -13
41#define H_DEST_PARM -14
42#define H_REMOTE_PARM -15
43#define H_RESOURCE -16
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
45/* Long Busy is a condition that can be returned by the firmware
46 * when a call cannot be completed now, but the identical call
47 * should be retried later. This prevents calls blocking in the
Segher Boessenkool706c8c92006-03-30 14:49:40 +020048 * firmware for long periods of time. Annoyingly the firmware can return
Linus Torvalds1da177e2005-04-16 15:20:36 -070049 * a range of return codes, hinting at how long we should wait before
50 * retrying. If you don't care for the hint, the macro below is a good
51 * way to check for the long_busy return codes
52 */
Segher Boessenkool706c8c92006-03-30 14:49:40 +020053#define H_IS_LONG_BUSY(x) ((x >= H_LONG_BUSY_START_RANGE) \
54 && (x <= H_LONG_BUSY_END_RANGE))
Linus Torvalds1da177e2005-04-16 15:20:36 -070055
56/* Flags */
57#define H_LARGE_PAGE (1UL<<(63-16))
58#define H_EXACT (1UL<<(63-24)) /* Use exact PTE or return H_PTEG_FULL */
59#define H_R_XLATE (1UL<<(63-25)) /* include a valid logical page num in the pte if the valid bit is set */
60#define H_READ_4 (1UL<<(63-26)) /* Return 4 PTEs */
61#define H_AVPN (1UL<<(63-32)) /* An avpn is provided as a sanity test */
62#define H_ANDCOND (1UL<<(63-33))
63#define H_ICACHE_INVALIDATE (1UL<<(63-40)) /* icbi, etc. (ignored for IO pages) */
64#define H_ICACHE_SYNCHRONIZE (1UL<<(63-41)) /* dcbst, icbi, etc (ignored for IO pages */
65#define H_ZERO_PAGE (1UL<<(63-48)) /* zero the page before mapping (ignored for IO pages) */
66#define H_COPY_PAGE (1UL<<(63-49))
67#define H_N (1UL<<(63-61))
68#define H_PP1 (1UL<<(63-62))
69#define H_PP2 (1UL<<(63-63))
70
Anton Blanchardfd9648d2005-09-10 16:01:11 +100071/* DABRX flags */
72#define H_DABRX_HYPERVISOR (1UL<<(63-61))
73#define H_DABRX_KERNEL (1UL<<(63-62))
74#define H_DABRX_USER (1UL<<(63-63))
75
Linus Torvalds1da177e2005-04-16 15:20:36 -070076/* pSeries hypervisor opcodes */
77#define H_REMOVE 0x04
78#define H_ENTER 0x08
79#define H_READ 0x0c
80#define H_CLEAR_MOD 0x10
81#define H_CLEAR_REF 0x14
82#define H_PROTECT 0x18
83#define H_GET_TCE 0x1c
84#define H_PUT_TCE 0x20
85#define H_SET_SPRG0 0x24
86#define H_SET_DABR 0x28
87#define H_PAGE_INIT 0x2c
88#define H_SET_ASR 0x30
89#define H_ASR_ON 0x34
90#define H_ASR_OFF 0x38
91#define H_LOGICAL_CI_LOAD 0x3c
92#define H_LOGICAL_CI_STORE 0x40
93#define H_LOGICAL_CACHE_LOAD 0x44
94#define H_LOGICAL_CACHE_STORE 0x48
95#define H_LOGICAL_ICBI 0x4c
96#define H_LOGICAL_DCBF 0x50
97#define H_GET_TERM_CHAR 0x54
98#define H_PUT_TERM_CHAR 0x58
99#define H_REAL_TO_LOGICAL 0x5c
100#define H_HYPERVISOR_DATA 0x60
101#define H_EOI 0x64
102#define H_CPPR 0x68
103#define H_IPI 0x6c
104#define H_IPOLL 0x70
105#define H_XIRR 0x74
106#define H_PERFMON 0x7c
107#define H_MIGRATE_DMA 0x78
108#define H_REGISTER_VPA 0xDC
Segher Boessenkool706c8c92006-03-30 14:49:40 +0200109#define H_CEDE 0xE0
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110#define H_CONFER 0xE4
Segher Boessenkool706c8c92006-03-30 14:49:40 +0200111#define H_PROD 0xE8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112#define H_GET_PPP 0xEC
113#define H_SET_PPP 0xF0
114#define H_PURR 0xF4
Segher Boessenkool706c8c92006-03-30 14:49:40 +0200115#define H_PIC 0xF8
Linus Torvalds1da177e2005-04-16 15:20:36 -0700116#define H_REG_CRQ 0xFC
117#define H_FREE_CRQ 0x100
118#define H_VIO_SIGNAL 0x104
119#define H_SEND_CRQ 0x108
Segher Boessenkool706c8c92006-03-30 14:49:40 +0200120#define H_COPY_RDMA 0x110
Anton Blanchardfd9648d2005-09-10 16:01:11 +1000121#define H_SET_XDABR 0x134
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122#define H_STUFF_TCE 0x138
123#define H_PUT_TCE_INDIRECT 0x13C
124#define H_VTERM_PARTNER_INFO 0x150
125#define H_REGISTER_VTERM 0x154
126#define H_FREE_VTERM 0x158
Segher Boessenkool706c8c92006-03-30 14:49:40 +0200127#define H_POLL_PENDING 0x1D8
Dave C Boutcher43ccf202006-01-12 16:05:35 -0600128#define H_JOIN 0x298
129#define H_ENABLE_CRQ 0x2B0
Linus Torvalds1da177e2005-04-16 15:20:36 -0700130
131#ifndef __ASSEMBLY__
132
133/* plpar_hcall() -- Generic call interface using above opcodes
134 *
135 * The actual call interface is a hypervisor call instruction with
136 * the opcode in R3 and input args in R4-R7.
137 * Status is returned in R3 with variable output values in R4-R11.
138 * Only H_PTE_READ with H_READ_4 uses R6-R11 so we ignore it for now
139 * and return only two out args which MUST ALWAYS BE PROVIDED.
140 */
141long plpar_hcall(unsigned long opcode,
142 unsigned long arg1,
143 unsigned long arg2,
144 unsigned long arg3,
145 unsigned long arg4,
146 unsigned long *out1,
147 unsigned long *out2,
148 unsigned long *out3);
149
150/* Same as plpar_hcall but for those opcodes that return no values
151 * other than status. Slightly more efficient.
152 */
153long plpar_hcall_norets(unsigned long opcode, ...);
154
David Gibsond3d21762005-11-10 15:26:20 +1100155/*
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156 * Special hcall interface for ibmveth support.
157 * Takes 8 input parms. Returns a rc and stores the
158 * R4 return value in *out1.
159 */
160long plpar_hcall_8arg_2ret(unsigned long opcode,
161 unsigned long arg1,
Segher Boessenkool706c8c92006-03-30 14:49:40 +0200162 unsigned long arg2,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163 unsigned long arg3,
164 unsigned long arg4,
165 unsigned long arg5,
166 unsigned long arg6,
167 unsigned long arg7,
168 unsigned long arg8,
169 unsigned long *out1);
David Gibsond3d21762005-11-10 15:26:20 +1100170
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171/* plpar_hcall_4out()
172 *
David Gibsond3d21762005-11-10 15:26:20 +1100173 * same as plpar_hcall except with 4 output arguments.
174 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175 */
176long plpar_hcall_4out(unsigned long opcode,
177 unsigned long arg1,
178 unsigned long arg2,
179 unsigned long arg3,
180 unsigned long arg4,
181 unsigned long *out1,
182 unsigned long *out2,
183 unsigned long *out3,
184 unsigned long *out4);
185
186#endif /* __ASSEMBLY__ */
Arnd Bergmann88ced032005-12-16 22:43:46 +0100187#endif /* __KERNEL__ */
David Gibsond3d21762005-11-10 15:26:20 +1100188#endif /* _ASM_POWERPC_HVCALL_H */