Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * HvCallEvent.h | |
3 | * Copyright (C) 2001 Mike Corrigan IBM Corporation | |
45dc76aa | 4 | * |
1da177e4 LT |
5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation; either version 2 of the License, or | |
8 | * (at your option) any later version. | |
45dc76aa | 9 | * |
1da177e4 LT |
10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
45dc76aa | 14 | * |
1da177e4 LT |
15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | |
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | */ | |
1da177e4 | 19 | /* |
45dc76aa SR |
20 | * This file contains the "hypervisor call" interface which is used to |
21 | * drive the hypervisor from the OS. | |
1da177e4 LT |
22 | */ |
23 | #ifndef _HVCALLEVENT_H | |
24 | #define _HVCALLEVENT_H | |
25 | ||
1da177e4 LT |
26 | #include <asm/iSeries/HvCallSc.h> |
27 | #include <asm/iSeries/HvTypes.h> | |
28 | #include <asm/abs_addr.h> | |
29 | ||
30 | struct HvLpEvent; | |
31 | ||
32 | typedef u8 HvLpEvent_Type; | |
33 | typedef u8 HvLpEvent_AckInd; | |
34 | typedef u8 HvLpEvent_AckType; | |
35 | ||
36 | struct HvCallEvent_PackedParms { | |
37 | u8 xAckType:1; | |
38 | u8 xAckInd:1; | |
39 | u8 xRsvd:1; | |
40 | u8 xTargetLp:5; | |
41 | u8 xType; | |
42 | u16 xSubtype; | |
43 | HvLpInstanceId xSourceInstId; | |
44 | HvLpInstanceId xTargetInstId; | |
45 | }; | |
46 | ||
47 | typedef u8 HvLpDma_Direction; | |
48 | typedef u8 HvLpDma_AddressType; | |
49 | ||
50 | struct HvCallEvent_PackedDmaParms { | |
51 | u8 xDirection:1; | |
52 | u8 xLocalAddrType:1; | |
53 | u8 xRemoteAddrType:1; | |
54 | u8 xRsvd1:5; | |
55 | HvLpIndex xRemoteLp; | |
56 | u8 xType; | |
57 | u8 xRsvd2; | |
58 | HvLpInstanceId xLocalInstId; | |
59 | HvLpInstanceId xRemoteInstId; | |
60 | }; | |
61 | ||
62 | typedef u64 HvLpEvent_Rc; | |
63 | typedef u64 HvLpDma_Rc; | |
64 | ||
65 | #define HvCallEventAckLpEvent HvCallEvent + 0 | |
66 | #define HvCallEventCancelLpEvent HvCallEvent + 1 | |
67 | #define HvCallEventCloseLpEventPath HvCallEvent + 2 | |
68 | #define HvCallEventDmaBufList HvCallEvent + 3 | |
69 | #define HvCallEventDmaSingle HvCallEvent + 4 | |
45dc76aa | 70 | #define HvCallEventDmaToSp HvCallEvent + 5 |
1da177e4 LT |
71 | #define HvCallEventGetOverflowLpEvents HvCallEvent + 6 |
72 | #define HvCallEventGetSourceLpInstanceId HvCallEvent + 7 | |
73 | #define HvCallEventGetTargetLpInstanceId HvCallEvent + 8 | |
74 | #define HvCallEventOpenLpEventPath HvCallEvent + 9 | |
75 | #define HvCallEventSetLpEventStack HvCallEvent + 10 | |
76 | #define HvCallEventSignalLpEvent HvCallEvent + 11 | |
77 | #define HvCallEventSignalLpEventParms HvCallEvent + 12 | |
78 | #define HvCallEventSetInterLpQueueIndex HvCallEvent + 13 | |
79 | #define HvCallEventSetLpEventQueueInterruptProc HvCallEvent + 14 | |
80 | #define HvCallEventRouter15 HvCallEvent + 15 | |
81 | ||
82 | static inline void HvCallEvent_getOverflowLpEvents(u8 queueIndex) | |
83 | { | |
45dc76aa | 84 | HvCall1(HvCallEventGetOverflowLpEvents, queueIndex); |
1da177e4 LT |
85 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); |
86 | } | |
87 | ||
88 | static inline void HvCallEvent_setInterLpQueueIndex(u8 queueIndex) | |
89 | { | |
45dc76aa | 90 | HvCall1(HvCallEventSetInterLpQueueIndex, queueIndex); |
1da177e4 LT |
91 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); |
92 | } | |
93 | ||
94 | static inline void HvCallEvent_setLpEventStack(u8 queueIndex, | |
95 | char *eventStackAddr, u32 eventStackSize) | |
96 | { | |
97 | u64 abs_addr; | |
98 | ||
99 | abs_addr = virt_to_abs(eventStackAddr); | |
100 | HvCall3(HvCallEventSetLpEventStack, queueIndex, abs_addr, | |
101 | eventStackSize); | |
102 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | |
103 | } | |
104 | ||
105 | static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex, | |
106 | u16 lpLogicalProcIndex) | |
107 | { | |
108 | HvCall2(HvCallEventSetLpEventQueueInterruptProc, queueIndex, | |
109 | lpLogicalProcIndex); | |
110 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | |
111 | } | |
112 | ||
113 | static inline HvLpEvent_Rc HvCallEvent_signalLpEvent(struct HvLpEvent *event) | |
114 | { | |
115 | u64 abs_addr; | |
116 | HvLpEvent_Rc retVal; | |
117 | ||
118 | #ifdef DEBUG_SENDEVENT | |
119 | printk("HvCallEvent_signalLpEvent: *event = %016lx\n ", | |
120 | (unsigned long)event); | |
121 | #endif | |
122 | abs_addr = virt_to_abs(event); | |
123 | retVal = (HvLpEvent_Rc)HvCall1(HvCallEventSignalLpEvent, abs_addr); | |
124 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | |
125 | return retVal; | |
126 | } | |
127 | ||
128 | static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp, | |
129 | HvLpEvent_Type type, u16 subtype, HvLpEvent_AckInd ackInd, | |
130 | HvLpEvent_AckType ackType, HvLpInstanceId sourceInstanceId, | |
131 | HvLpInstanceId targetInstanceId, u64 correlationToken, | |
132 | u64 eventData1, u64 eventData2, u64 eventData3, | |
133 | u64 eventData4, u64 eventData5) | |
134 | { | |
135 | HvLpEvent_Rc retVal; | |
136 | ||
45dc76aa | 137 | /* Pack the misc bits into a single Dword to pass to PLIC */ |
1da177e4 LT |
138 | union { |
139 | struct HvCallEvent_PackedParms parms; | |
140 | u64 dword; | |
141 | } packed; | |
142 | packed.parms.xAckType = ackType; | |
143 | packed.parms.xAckInd = ackInd; | |
144 | packed.parms.xRsvd = 0; | |
145 | packed.parms.xTargetLp = targetLp; | |
146 | packed.parms.xType = type; | |
147 | packed.parms.xSubtype = subtype; | |
148 | packed.parms.xSourceInstId = sourceInstanceId; | |
149 | packed.parms.xTargetInstId = targetInstanceId; | |
150 | ||
151 | retVal = (HvLpEvent_Rc)HvCall7(HvCallEventSignalLpEventParms, | |
152 | packed.dword, correlationToken, eventData1,eventData2, | |
153 | eventData3,eventData4, eventData5); | |
154 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | |
155 | return retVal; | |
156 | } | |
157 | ||
158 | static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event) | |
159 | { | |
160 | u64 abs_addr; | |
161 | HvLpEvent_Rc retVal; | |
162 | ||
163 | abs_addr = virt_to_abs(event); | |
164 | retVal = (HvLpEvent_Rc)HvCall1(HvCallEventAckLpEvent, abs_addr); | |
165 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | |
166 | return retVal; | |
167 | } | |
168 | ||
169 | static inline HvLpEvent_Rc HvCallEvent_cancelLpEvent(struct HvLpEvent *event) | |
170 | { | |
171 | u64 abs_addr; | |
172 | HvLpEvent_Rc retVal; | |
173 | ||
174 | abs_addr = virt_to_abs(event); | |
175 | retVal = (HvLpEvent_Rc)HvCall1(HvCallEventCancelLpEvent, abs_addr); | |
176 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | |
177 | return retVal; | |
178 | } | |
179 | ||
180 | static inline HvLpInstanceId HvCallEvent_getSourceLpInstanceId( | |
181 | HvLpIndex targetLp, HvLpEvent_Type type) | |
182 | { | |
183 | HvLpInstanceId retVal; | |
184 | ||
185 | retVal = HvCall2(HvCallEventGetSourceLpInstanceId, targetLp, type); | |
186 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | |
187 | return retVal; | |
188 | } | |
189 | ||
190 | static inline HvLpInstanceId HvCallEvent_getTargetLpInstanceId( | |
191 | HvLpIndex targetLp, HvLpEvent_Type type) | |
192 | { | |
193 | HvLpInstanceId retVal; | |
194 | ||
195 | retVal = HvCall2(HvCallEventGetTargetLpInstanceId, targetLp, type); | |
196 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | |
197 | return retVal; | |
198 | } | |
199 | ||
200 | static inline void HvCallEvent_openLpEventPath(HvLpIndex targetLp, | |
201 | HvLpEvent_Type type) | |
202 | { | |
203 | HvCall2(HvCallEventOpenLpEventPath, targetLp, type); | |
204 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | |
205 | } | |
206 | ||
207 | static inline void HvCallEvent_closeLpEventPath(HvLpIndex targetLp, | |
208 | HvLpEvent_Type type) | |
209 | { | |
210 | HvCall2(HvCallEventCloseLpEventPath, targetLp, type); | |
211 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | |
212 | } | |
213 | ||
214 | static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type, | |
215 | HvLpIndex remoteLp, HvLpDma_Direction direction, | |
216 | HvLpInstanceId localInstanceId, | |
217 | HvLpInstanceId remoteInstanceId, | |
218 | HvLpDma_AddressType localAddressType, | |
219 | HvLpDma_AddressType remoteAddressType, | |
220 | /* Do these need to be converted to absolute addresses? */ | |
221 | u64 localBufList, u64 remoteBufList, u32 transferLength) | |
222 | { | |
223 | HvLpDma_Rc retVal; | |
45dc76aa | 224 | /* Pack the misc bits into a single Dword to pass to PLIC */ |
1da177e4 LT |
225 | union { |
226 | struct HvCallEvent_PackedDmaParms parms; | |
227 | u64 dword; | |
228 | } packed; | |
229 | ||
230 | packed.parms.xDirection = direction; | |
231 | packed.parms.xLocalAddrType = localAddressType; | |
232 | packed.parms.xRemoteAddrType = remoteAddressType; | |
233 | packed.parms.xRsvd1 = 0; | |
234 | packed.parms.xRemoteLp = remoteLp; | |
235 | packed.parms.xType = type; | |
236 | packed.parms.xRsvd2 = 0; | |
237 | packed.parms.xLocalInstId = localInstanceId; | |
238 | packed.parms.xRemoteInstId = remoteInstanceId; | |
239 | ||
240 | retVal = (HvLpDma_Rc)HvCall4(HvCallEventDmaBufList, | |
241 | packed.dword, localBufList, remoteBufList, | |
242 | transferLength); | |
243 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | |
244 | return retVal; | |
245 | } | |
246 | ||
247 | static inline HvLpDma_Rc HvCallEvent_dmaSingle(HvLpEvent_Type type, | |
248 | HvLpIndex remoteLp, HvLpDma_Direction direction, | |
249 | HvLpInstanceId localInstanceId, | |
250 | HvLpInstanceId remoteInstanceId, | |
251 | HvLpDma_AddressType localAddressType, | |
252 | HvLpDma_AddressType remoteAddressType, | |
253 | u64 localAddrOrTce, u64 remoteAddrOrTce, u32 transferLength) | |
254 | { | |
255 | HvLpDma_Rc retVal; | |
45dc76aa | 256 | /* Pack the misc bits into a single Dword to pass to PLIC */ |
1da177e4 LT |
257 | union { |
258 | struct HvCallEvent_PackedDmaParms parms; | |
259 | u64 dword; | |
260 | } packed; | |
261 | ||
262 | packed.parms.xDirection = direction; | |
263 | packed.parms.xLocalAddrType = localAddressType; | |
264 | packed.parms.xRemoteAddrType = remoteAddressType; | |
265 | packed.parms.xRsvd1 = 0; | |
266 | packed.parms.xRemoteLp = remoteLp; | |
267 | packed.parms.xType = type; | |
268 | packed.parms.xRsvd2 = 0; | |
269 | packed.parms.xLocalInstId = localInstanceId; | |
270 | packed.parms.xRemoteInstId = remoteInstanceId; | |
271 | ||
272 | retVal = (HvLpDma_Rc)HvCall4(HvCallEventDmaSingle, | |
273 | packed.dword, localAddrOrTce, remoteAddrOrTce, | |
274 | transferLength); | |
275 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | |
276 | return retVal; | |
277 | } | |
278 | ||
45dc76aa | 279 | static inline HvLpDma_Rc HvCallEvent_dmaToSp(void *local, u32 remote, |
1da177e4 LT |
280 | u32 length, HvLpDma_Direction dir) |
281 | { | |
282 | u64 abs_addr; | |
283 | HvLpDma_Rc retVal; | |
284 | ||
285 | abs_addr = virt_to_abs(local); | |
286 | retVal = (HvLpDma_Rc)HvCall4(HvCallEventDmaToSp, abs_addr, remote, | |
287 | length, dir); | |
288 | // getPaca()->adjustHmtForNoOfSpinLocksHeld(); | |
289 | return retVal; | |
290 | } | |
291 | ||
1da177e4 | 292 | #endif /* _HVCALLEVENT_H */ |