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 * This file contains the "hypervisor call" interface which is used to
21 * drive the hypervisor from the OS.
23 #ifndef _HVCALLEVENT_H
24 #define _HVCALLEVENT_H
26 #include <asm/iSeries/HvCallSc.h>
27 #include <asm/iSeries/HvTypes.h>
28 #include <asm/abs_addr.h>
32 typedef u8 HvLpEvent_Type;
33 typedef u8 HvLpEvent_AckInd;
34 typedef u8 HvLpEvent_AckType;
36 struct HvCallEvent_PackedParms {
43 HvLpInstanceId xSourceInstId;
44 HvLpInstanceId xTargetInstId;
47 typedef u8 HvLpDma_Direction;
48 typedef u8 HvLpDma_AddressType;
50 struct HvCallEvent_PackedDmaParms {
58 HvLpInstanceId xLocalInstId;
59 HvLpInstanceId xRemoteInstId;
62 typedef u64 HvLpEvent_Rc;
63 typedef u64 HvLpDma_Rc;
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
70 #define HvCallEventDmaToSp HvCallEvent + 5
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
82 static inline void HvCallEvent_getOverflowLpEvents(u8 queueIndex)
84 HvCall1(HvCallEventGetOverflowLpEvents, queueIndex);
87 static inline void HvCallEvent_setInterLpQueueIndex(u8 queueIndex)
89 HvCall1(HvCallEventSetInterLpQueueIndex, queueIndex);
92 static inline void HvCallEvent_setLpEventStack(u8 queueIndex,
93 char *eventStackAddr, u32 eventStackSize)
97 abs_addr = virt_to_abs(eventStackAddr);
98 HvCall3(HvCallEventSetLpEventStack, queueIndex, abs_addr,
102 static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex,
103 u16 lpLogicalProcIndex)
105 HvCall2(HvCallEventSetLpEventQueueInterruptProc, queueIndex,
109 static inline HvLpEvent_Rc HvCallEvent_signalLpEvent(struct HvLpEvent *event)
113 #ifdef DEBUG_SENDEVENT
114 printk("HvCallEvent_signalLpEvent: *event = %016lx\n ",
115 (unsigned long)event);
117 abs_addr = virt_to_abs(event);
118 return HvCall1(HvCallEventSignalLpEvent, abs_addr);
121 static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp,
122 HvLpEvent_Type type, u16 subtype, HvLpEvent_AckInd ackInd,
123 HvLpEvent_AckType ackType, HvLpInstanceId sourceInstanceId,
124 HvLpInstanceId targetInstanceId, u64 correlationToken,
125 u64 eventData1, u64 eventData2, u64 eventData3,
126 u64 eventData4, u64 eventData5)
128 /* Pack the misc bits into a single Dword to pass to PLIC */
130 struct HvCallEvent_PackedParms parms;
133 packed.parms.xAckType = ackType;
134 packed.parms.xAckInd = ackInd;
135 packed.parms.xRsvd = 0;
136 packed.parms.xTargetLp = targetLp;
137 packed.parms.xType = type;
138 packed.parms.xSubtype = subtype;
139 packed.parms.xSourceInstId = sourceInstanceId;
140 packed.parms.xTargetInstId = targetInstanceId;
142 return HvCall7(HvCallEventSignalLpEventParms, packed.dword,
143 correlationToken, eventData1, eventData2,
144 eventData3, eventData4, eventData5);
147 static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event)
151 abs_addr = virt_to_abs(event);
152 return HvCall1(HvCallEventAckLpEvent, abs_addr);
155 static inline HvLpEvent_Rc HvCallEvent_cancelLpEvent(struct HvLpEvent *event)
159 abs_addr = virt_to_abs(event);
160 return HvCall1(HvCallEventCancelLpEvent, abs_addr);
163 static inline HvLpInstanceId HvCallEvent_getSourceLpInstanceId(
164 HvLpIndex targetLp, HvLpEvent_Type type)
166 return HvCall2(HvCallEventGetSourceLpInstanceId, targetLp, type);
169 static inline HvLpInstanceId HvCallEvent_getTargetLpInstanceId(
170 HvLpIndex targetLp, HvLpEvent_Type type)
172 return HvCall2(HvCallEventGetTargetLpInstanceId, targetLp, type);
175 static inline void HvCallEvent_openLpEventPath(HvLpIndex targetLp,
178 HvCall2(HvCallEventOpenLpEventPath, targetLp, type);
181 static inline void HvCallEvent_closeLpEventPath(HvLpIndex targetLp,
184 HvCall2(HvCallEventCloseLpEventPath, targetLp, type);
187 static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type,
188 HvLpIndex remoteLp, HvLpDma_Direction direction,
189 HvLpInstanceId localInstanceId,
190 HvLpInstanceId remoteInstanceId,
191 HvLpDma_AddressType localAddressType,
192 HvLpDma_AddressType remoteAddressType,
193 /* Do these need to be converted to absolute addresses? */
194 u64 localBufList, u64 remoteBufList, u32 transferLength)
196 /* Pack the misc bits into a single Dword to pass to PLIC */
198 struct HvCallEvent_PackedDmaParms parms;
202 packed.parms.xDirection = direction;
203 packed.parms.xLocalAddrType = localAddressType;
204 packed.parms.xRemoteAddrType = remoteAddressType;
205 packed.parms.xRsvd1 = 0;
206 packed.parms.xRemoteLp = remoteLp;
207 packed.parms.xType = type;
208 packed.parms.xRsvd2 = 0;
209 packed.parms.xLocalInstId = localInstanceId;
210 packed.parms.xRemoteInstId = remoteInstanceId;
212 return HvCall4(HvCallEventDmaBufList, packed.dword, localBufList,
213 remoteBufList, transferLength);
216 static inline HvLpDma_Rc HvCallEvent_dmaSingle(HvLpEvent_Type type,
217 HvLpIndex remoteLp, HvLpDma_Direction direction,
218 HvLpInstanceId localInstanceId,
219 HvLpInstanceId remoteInstanceId,
220 HvLpDma_AddressType localAddressType,
221 HvLpDma_AddressType remoteAddressType,
222 u64 localAddrOrTce, u64 remoteAddrOrTce, u32 transferLength)
224 /* Pack the misc bits into a single Dword to pass to PLIC */
226 struct HvCallEvent_PackedDmaParms parms;
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;
240 return (HvLpDma_Rc)HvCall4(HvCallEventDmaSingle, packed.dword,
241 localAddrOrTce, remoteAddrOrTce, transferLength);
244 static inline HvLpDma_Rc HvCallEvent_dmaToSp(void *local, u32 remote,
245 u32 length, HvLpDma_Direction dir)
249 abs_addr = virt_to_abs(local);
250 return HvCall4(HvCallEventDmaToSp, abs_addr, remote, length, dir);
253 #endif /* _HVCALLEVENT_H */