3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
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.
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.
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
21 * This file contains the "hypervisor call" interface which is used to
22 * drive the hypervisor from the OS.
24 #ifndef _HVCALLEVENT_H
25 #define _HVCALLEVENT_H
30 #include <asm/iSeries/HvCallSc.h>
31 #include <asm/iSeries/HvTypes.h>
32 #include <asm/abs_addr.h>
36 typedef u8 HvLpEvent_Type
;
37 typedef u8 HvLpEvent_AckInd
;
38 typedef u8 HvLpEvent_AckType
;
40 struct HvCallEvent_PackedParms
{
47 HvLpInstanceId xSourceInstId
;
48 HvLpInstanceId xTargetInstId
;
51 typedef u8 HvLpDma_Direction
;
52 typedef u8 HvLpDma_AddressType
;
54 struct HvCallEvent_PackedDmaParms
{
62 HvLpInstanceId xLocalInstId
;
63 HvLpInstanceId xRemoteInstId
;
66 typedef u64 HvLpEvent_Rc
;
67 typedef u64 HvLpDma_Rc
;
69 #define HvCallEventAckLpEvent HvCallEvent + 0
70 #define HvCallEventCancelLpEvent HvCallEvent + 1
71 #define HvCallEventCloseLpEventPath HvCallEvent + 2
72 #define HvCallEventDmaBufList HvCallEvent + 3
73 #define HvCallEventDmaSingle HvCallEvent + 4
74 #define HvCallEventDmaToSp HvCallEvent + 5
75 #define HvCallEventGetOverflowLpEvents HvCallEvent + 6
76 #define HvCallEventGetSourceLpInstanceId HvCallEvent + 7
77 #define HvCallEventGetTargetLpInstanceId HvCallEvent + 8
78 #define HvCallEventOpenLpEventPath HvCallEvent + 9
79 #define HvCallEventSetLpEventStack HvCallEvent + 10
80 #define HvCallEventSignalLpEvent HvCallEvent + 11
81 #define HvCallEventSignalLpEventParms HvCallEvent + 12
82 #define HvCallEventSetInterLpQueueIndex HvCallEvent + 13
83 #define HvCallEventSetLpEventQueueInterruptProc HvCallEvent + 14
84 #define HvCallEventRouter15 HvCallEvent + 15
86 static inline void HvCallEvent_getOverflowLpEvents(u8 queueIndex
)
88 HvCall1(HvCallEventGetOverflowLpEvents
,queueIndex
);
89 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
92 static inline void HvCallEvent_setInterLpQueueIndex(u8 queueIndex
)
94 HvCall1(HvCallEventSetInterLpQueueIndex
,queueIndex
);
95 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
98 static inline void HvCallEvent_setLpEventStack(u8 queueIndex
,
99 char *eventStackAddr
, u32 eventStackSize
)
103 abs_addr
= virt_to_abs(eventStackAddr
);
104 HvCall3(HvCallEventSetLpEventStack
, queueIndex
, abs_addr
,
106 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
109 static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex
,
110 u16 lpLogicalProcIndex
)
112 HvCall2(HvCallEventSetLpEventQueueInterruptProc
, queueIndex
,
114 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
117 static inline HvLpEvent_Rc
HvCallEvent_signalLpEvent(struct HvLpEvent
*event
)
122 #ifdef DEBUG_SENDEVENT
123 printk("HvCallEvent_signalLpEvent: *event = %016lx\n ",
124 (unsigned long)event
);
126 abs_addr
= virt_to_abs(event
);
127 retVal
= (HvLpEvent_Rc
)HvCall1(HvCallEventSignalLpEvent
, abs_addr
);
128 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
132 static inline HvLpEvent_Rc
HvCallEvent_signalLpEventFast(HvLpIndex targetLp
,
133 HvLpEvent_Type type
, u16 subtype
, HvLpEvent_AckInd ackInd
,
134 HvLpEvent_AckType ackType
, HvLpInstanceId sourceInstanceId
,
135 HvLpInstanceId targetInstanceId
, u64 correlationToken
,
136 u64 eventData1
, u64 eventData2
, u64 eventData3
,
137 u64 eventData4
, u64 eventData5
)
141 // Pack the misc bits into a single Dword to pass to PLIC
143 struct HvCallEvent_PackedParms parms
;
146 packed
.parms
.xAckType
= ackType
;
147 packed
.parms
.xAckInd
= ackInd
;
148 packed
.parms
.xRsvd
= 0;
149 packed
.parms
.xTargetLp
= targetLp
;
150 packed
.parms
.xType
= type
;
151 packed
.parms
.xSubtype
= subtype
;
152 packed
.parms
.xSourceInstId
= sourceInstanceId
;
153 packed
.parms
.xTargetInstId
= targetInstanceId
;
155 retVal
= (HvLpEvent_Rc
)HvCall7(HvCallEventSignalLpEventParms
,
156 packed
.dword
, correlationToken
, eventData1
,eventData2
,
157 eventData3
,eventData4
, eventData5
);
158 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
162 static inline HvLpEvent_Rc
HvCallEvent_ackLpEvent(struct HvLpEvent
*event
)
167 abs_addr
= virt_to_abs(event
);
168 retVal
= (HvLpEvent_Rc
)HvCall1(HvCallEventAckLpEvent
, abs_addr
);
169 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
173 static inline HvLpEvent_Rc
HvCallEvent_cancelLpEvent(struct HvLpEvent
*event
)
178 abs_addr
= virt_to_abs(event
);
179 retVal
= (HvLpEvent_Rc
)HvCall1(HvCallEventCancelLpEvent
, abs_addr
);
180 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
184 static inline HvLpInstanceId
HvCallEvent_getSourceLpInstanceId(
185 HvLpIndex targetLp
, HvLpEvent_Type type
)
187 HvLpInstanceId retVal
;
189 retVal
= HvCall2(HvCallEventGetSourceLpInstanceId
, targetLp
, type
);
190 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
194 static inline HvLpInstanceId
HvCallEvent_getTargetLpInstanceId(
195 HvLpIndex targetLp
, HvLpEvent_Type type
)
197 HvLpInstanceId retVal
;
199 retVal
= HvCall2(HvCallEventGetTargetLpInstanceId
, targetLp
, type
);
200 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
204 static inline void HvCallEvent_openLpEventPath(HvLpIndex targetLp
,
207 HvCall2(HvCallEventOpenLpEventPath
, targetLp
, type
);
208 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
211 static inline void HvCallEvent_closeLpEventPath(HvLpIndex targetLp
,
214 HvCall2(HvCallEventCloseLpEventPath
, targetLp
, type
);
215 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
218 static inline HvLpDma_Rc
HvCallEvent_dmaBufList(HvLpEvent_Type type
,
219 HvLpIndex remoteLp
, HvLpDma_Direction direction
,
220 HvLpInstanceId localInstanceId
,
221 HvLpInstanceId remoteInstanceId
,
222 HvLpDma_AddressType localAddressType
,
223 HvLpDma_AddressType remoteAddressType
,
224 /* Do these need to be converted to absolute addresses? */
225 u64 localBufList
, u64 remoteBufList
, u32 transferLength
)
228 // Pack the misc bits into a single Dword to pass to PLIC
230 struct HvCallEvent_PackedDmaParms parms
;
234 packed
.parms
.xDirection
= direction
;
235 packed
.parms
.xLocalAddrType
= localAddressType
;
236 packed
.parms
.xRemoteAddrType
= remoteAddressType
;
237 packed
.parms
.xRsvd1
= 0;
238 packed
.parms
.xRemoteLp
= remoteLp
;
239 packed
.parms
.xType
= type
;
240 packed
.parms
.xRsvd2
= 0;
241 packed
.parms
.xLocalInstId
= localInstanceId
;
242 packed
.parms
.xRemoteInstId
= remoteInstanceId
;
244 retVal
= (HvLpDma_Rc
)HvCall4(HvCallEventDmaBufList
,
245 packed
.dword
, localBufList
, remoteBufList
,
247 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
251 static inline HvLpDma_Rc
HvCallEvent_dmaSingle(HvLpEvent_Type type
,
252 HvLpIndex remoteLp
, HvLpDma_Direction direction
,
253 HvLpInstanceId localInstanceId
,
254 HvLpInstanceId remoteInstanceId
,
255 HvLpDma_AddressType localAddressType
,
256 HvLpDma_AddressType remoteAddressType
,
257 u64 localAddrOrTce
, u64 remoteAddrOrTce
, u32 transferLength
)
260 // Pack the misc bits into a single Dword to pass to PLIC
262 struct HvCallEvent_PackedDmaParms parms
;
266 packed
.parms
.xDirection
= direction
;
267 packed
.parms
.xLocalAddrType
= localAddressType
;
268 packed
.parms
.xRemoteAddrType
= remoteAddressType
;
269 packed
.parms
.xRsvd1
= 0;
270 packed
.parms
.xRemoteLp
= remoteLp
;
271 packed
.parms
.xType
= type
;
272 packed
.parms
.xRsvd2
= 0;
273 packed
.parms
.xLocalInstId
= localInstanceId
;
274 packed
.parms
.xRemoteInstId
= remoteInstanceId
;
276 retVal
= (HvLpDma_Rc
)HvCall4(HvCallEventDmaSingle
,
277 packed
.dword
, localAddrOrTce
, remoteAddrOrTce
,
279 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
283 static inline HvLpDma_Rc
HvCallEvent_dmaToSp(void* local
, u32 remote
,
284 u32 length
, HvLpDma_Direction dir
)
289 abs_addr
= virt_to_abs(local
);
290 retVal
= (HvLpDma_Rc
)HvCall4(HvCallEventDmaToSp
, abs_addr
, remote
,
292 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
297 #endif /* _HVCALLEVENT_H */