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
20 //==================================================================
22 // This file contains the "hypervisor call" interface which is used to
23 // drive the hypervisor from the OS.
25 //==================================================================
27 //-------------------------------------------------------------------
29 //-------------------------------------------------------------------
31 #include <asm/iSeries/HvCallSc.h>
35 #include <asm/iSeries/HvTypes.h>
38 #include <asm/abs_addr.h>
40 //-------------------------------------------------------------------
42 //-------------------------------------------------------------------
44 //-------------------------------------------------------------------
46 //-------------------------------------------------------------------
47 #ifndef _HVCALLEVENT_H
48 #define _HVCALLEVENT_H
52 typedef u8 HvLpEvent_Type;
53 typedef u8 HvLpEvent_AckInd;
54 typedef u8 HvLpEvent_AckType;
56 struct HvCallEvent_PackedParms
64 HvLpInstanceId xSourceInstId;
65 HvLpInstanceId xTargetInstId;
68 typedef u8 HvLpDma_Direction;
69 typedef u8 HvLpDma_AddressType;
71 struct HvCallEvent_PackedDmaParms
80 HvLpInstanceId xLocalInstId;
81 HvLpInstanceId xRemoteInstId;
84 typedef u64 HvLpEvent_Rc;
85 typedef u64 HvLpDma_Rc;
87 #define HvCallEventAckLpEvent HvCallEvent + 0
88 #define HvCallEventCancelLpEvent HvCallEvent + 1
89 #define HvCallEventCloseLpEventPath HvCallEvent + 2
90 #define HvCallEventDmaBufList HvCallEvent + 3
91 #define HvCallEventDmaSingle HvCallEvent + 4
92 #define HvCallEventDmaToSp HvCallEvent + 5
93 #define HvCallEventGetOverflowLpEvents HvCallEvent + 6
94 #define HvCallEventGetSourceLpInstanceId HvCallEvent + 7
95 #define HvCallEventGetTargetLpInstanceId HvCallEvent + 8
96 #define HvCallEventOpenLpEventPath HvCallEvent + 9
97 #define HvCallEventSetLpEventStack HvCallEvent + 10
98 #define HvCallEventSignalLpEvent HvCallEvent + 11
99 #define HvCallEventSignalLpEventParms HvCallEvent + 12
100 #define HvCallEventSetInterLpQueueIndex HvCallEvent + 13
101 #define HvCallEventSetLpEventQueueInterruptProc HvCallEvent + 14
102 #define HvCallEventRouter15 HvCallEvent + 15
104 //======================================================================
105 static inline void HvCallEvent_getOverflowLpEvents(u8 queueIndex)
107 HvCall1(HvCallEventGetOverflowLpEvents,queueIndex);
108 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
110 //======================================================================
111 static inline void HvCallEvent_setInterLpQueueIndex(u8 queueIndex)
113 HvCall1(HvCallEventSetInterLpQueueIndex,queueIndex);
114 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
116 //======================================================================
117 static inline void HvCallEvent_setLpEventStack(u8 queueIndex,
118 char * eventStackAddr,
122 abs_addr = virt_to_absolute( (unsigned long) eventStackAddr );
124 HvCall3(HvCallEventSetLpEventStack, queueIndex, abs_addr, eventStackSize);
125 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
127 //======================================================================
128 static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex,
129 u16 lpLogicalProcIndex)
131 HvCall2(HvCallEventSetLpEventQueueInterruptProc,queueIndex,lpLogicalProcIndex);
132 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
134 //=====================================================================
135 static inline HvLpEvent_Rc HvCallEvent_signalLpEvent(struct HvLpEvent* event)
139 #ifdef DEBUG_SENDEVENT
140 printk("HvCallEvent_signalLpEvent: *event = %016lx\n ", (unsigned long)event);
142 abs_addr = virt_to_absolute( (unsigned long) event );
143 retVal = (HvLpEvent_Rc)HvCall1(HvCallEventSignalLpEvent, abs_addr);
144 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
147 //=====================================================================
148 static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp,
151 HvLpEvent_AckInd ackInd,
152 HvLpEvent_AckType ackType,
153 HvLpInstanceId sourceInstanceId,
154 HvLpInstanceId targetInstanceId,
155 u64 correlationToken,
164 // Pack the misc bits into a single Dword to pass to PLIC
167 struct HvCallEvent_PackedParms parms;
170 packed.parms.xAckType = ackType;
171 packed.parms.xAckInd = ackInd;
172 packed.parms.xRsvd = 0;
173 packed.parms.xTargetLp = targetLp;
174 packed.parms.xType = type;
175 packed.parms.xSubtype = subtype;
176 packed.parms.xSourceInstId = sourceInstanceId;
177 packed.parms.xTargetInstId = targetInstanceId;
179 retVal = (HvLpEvent_Rc)HvCall7(HvCallEventSignalLpEventParms,
182 eventData1,eventData2,
183 eventData3,eventData4,
185 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
188 //====================================================================
189 static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent* event)
193 abs_addr = virt_to_absolute( (unsigned long) event );
195 retVal = (HvLpEvent_Rc)HvCall1(HvCallEventAckLpEvent, abs_addr);
196 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
199 //====================================================================
200 static inline HvLpEvent_Rc HvCallEvent_cancelLpEvent(struct HvLpEvent* event)
204 abs_addr = virt_to_absolute( (unsigned long) event );
206 retVal = (HvLpEvent_Rc)HvCall1(HvCallEventCancelLpEvent, abs_addr);
207 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
210 //===================================================================
211 static inline HvLpInstanceId HvCallEvent_getSourceLpInstanceId(HvLpIndex targetLp, HvLpEvent_Type type)
213 HvLpInstanceId retVal;
214 retVal = HvCall2(HvCallEventGetSourceLpInstanceId,targetLp,type);
215 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
218 //===================================================================
219 static inline HvLpInstanceId HvCallEvent_getTargetLpInstanceId(HvLpIndex targetLp, HvLpEvent_Type type)
221 HvLpInstanceId retVal;
222 retVal = HvCall2(HvCallEventGetTargetLpInstanceId,targetLp,type);
223 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
226 //===================================================================
227 static inline void HvCallEvent_openLpEventPath(HvLpIndex targetLp,
230 HvCall2(HvCallEventOpenLpEventPath,targetLp,type);
231 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
233 //===================================================================
234 static inline void HvCallEvent_closeLpEventPath(HvLpIndex targetLp,
237 HvCall2(HvCallEventCloseLpEventPath,targetLp,type);
238 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
240 //===================================================================
241 static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type,
243 HvLpDma_Direction direction,
244 HvLpInstanceId localInstanceId,
245 HvLpInstanceId remoteInstanceId,
246 HvLpDma_AddressType localAddressType,
247 HvLpDma_AddressType remoteAddressType,
248 // Do these need to be converted to
249 // absolute addresses?
256 // Pack the misc bits into a single Dword to pass to PLIC
259 struct HvCallEvent_PackedDmaParms parms;
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;
272 retVal = (HvLpDma_Rc)HvCall4(HvCallEventDmaBufList,
277 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
280 //=================================================================
281 static inline HvLpDma_Rc HvCallEvent_dmaSingle(HvLpEvent_Type type,
283 HvLpDma_Direction direction,
284 HvLpInstanceId localInstanceId,
285 HvLpInstanceId remoteInstanceId,
286 HvLpDma_AddressType localAddressType,
287 HvLpDma_AddressType remoteAddressType,
293 // Pack the misc bits into a single Dword to pass to PLIC
296 struct HvCallEvent_PackedDmaParms parms;
299 packed.parms.xDirection = direction;
300 packed.parms.xLocalAddrType = localAddressType;
301 packed.parms.xRemoteAddrType = remoteAddressType;
302 packed.parms.xRsvd1 = 0;
303 packed.parms.xRemoteLp = remoteLp;
304 packed.parms.xType = type;
305 packed.parms.xRsvd2 = 0;
306 packed.parms.xLocalInstId = localInstanceId;
307 packed.parms.xRemoteInstId = remoteInstanceId;
309 retVal = (HvLpDma_Rc)HvCall4(HvCallEventDmaSingle,
314 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
317 //=================================================================
318 static inline HvLpDma_Rc HvCallEvent_dmaToSp(void* local, u32 remote, u32 length, HvLpDma_Direction dir)
322 abs_addr = virt_to_absolute( (unsigned long) local );
324 retVal = (HvLpDma_Rc)HvCall4(HvCallEventDmaToSp,
329 // getPaca()->adjustHmtForNoOfSpinLocksHeld();
332 //================================================================
334 #endif // _HVCALLEVENT_H