2 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * This file contains the "hypervisor call" interface which is used to
19 * drive the hypervisor from the OS.
21 #ifndef _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H
22 #define _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H
24 #include <asm/iseries/hv_call_sc.h>
25 #include <asm/iseries/hv_types.h>
26 #include <asm/abs_addr.h>
30 typedef u8 HvLpEvent_Type;
31 typedef u8 HvLpEvent_AckInd;
32 typedef u8 HvLpEvent_AckType;
34 typedef u8 HvLpDma_Direction;
35 typedef u8 HvLpDma_AddressType;
37 typedef u64 HvLpEvent_Rc;
38 typedef u64 HvLpDma_Rc;
40 #define HvCallEventAckLpEvent HvCallEvent + 0
41 #define HvCallEventCancelLpEvent HvCallEvent + 1
42 #define HvCallEventCloseLpEventPath HvCallEvent + 2
43 #define HvCallEventDmaBufList HvCallEvent + 3
44 #define HvCallEventDmaSingle HvCallEvent + 4
45 #define HvCallEventDmaToSp HvCallEvent + 5
46 #define HvCallEventGetOverflowLpEvents HvCallEvent + 6
47 #define HvCallEventGetSourceLpInstanceId HvCallEvent + 7
48 #define HvCallEventGetTargetLpInstanceId HvCallEvent + 8
49 #define HvCallEventOpenLpEventPath HvCallEvent + 9
50 #define HvCallEventSetLpEventStack HvCallEvent + 10
51 #define HvCallEventSignalLpEvent HvCallEvent + 11
52 #define HvCallEventSignalLpEventParms HvCallEvent + 12
53 #define HvCallEventSetInterLpQueueIndex HvCallEvent + 13
54 #define HvCallEventSetLpEventQueueInterruptProc HvCallEvent + 14
55 #define HvCallEventRouter15 HvCallEvent + 15
57 static inline void HvCallEvent_getOverflowLpEvents(u8 queueIndex)
59 HvCall1(HvCallEventGetOverflowLpEvents, queueIndex);
62 static inline void HvCallEvent_setInterLpQueueIndex(u8 queueIndex)
64 HvCall1(HvCallEventSetInterLpQueueIndex, queueIndex);
67 static inline void HvCallEvent_setLpEventStack(u8 queueIndex,
68 char *eventStackAddr, u32 eventStackSize)
70 HvCall3(HvCallEventSetLpEventStack, queueIndex,
71 virt_to_abs(eventStackAddr), eventStackSize);
74 static inline void HvCallEvent_setLpEventQueueInterruptProc(u8 queueIndex,
75 u16 lpLogicalProcIndex)
77 HvCall2(HvCallEventSetLpEventQueueInterruptProc, queueIndex,
81 static inline HvLpEvent_Rc HvCallEvent_signalLpEvent(struct HvLpEvent *event)
83 return HvCall1(HvCallEventSignalLpEvent, virt_to_abs(event));
86 static inline HvLpEvent_Rc HvCallEvent_signalLpEventFast(HvLpIndex targetLp,
87 HvLpEvent_Type type, u16 subtype, HvLpEvent_AckInd ackInd,
88 HvLpEvent_AckType ackType, HvLpInstanceId sourceInstanceId,
89 HvLpInstanceId targetInstanceId, u64 correlationToken,
90 u64 eventData1, u64 eventData2, u64 eventData3,
91 u64 eventData4, u64 eventData5)
93 /* Pack the misc bits into a single Dword to pass to PLIC */
99 HvLpInstanceId src_inst;
100 HvLpInstanceId target_inst;
105 packed.parms.ack_and_target = (ackType << 7) | (ackInd << 6) | targetLp;
106 packed.parms.type = type;
107 packed.parms.subtype = subtype;
108 packed.parms.src_inst = sourceInstanceId;
109 packed.parms.target_inst = targetInstanceId;
111 return HvCall7(HvCallEventSignalLpEventParms, packed.dword,
112 correlationToken, eventData1, eventData2,
113 eventData3, eventData4, eventData5);
116 static inline HvLpEvent_Rc HvCallEvent_ackLpEvent(struct HvLpEvent *event)
118 return HvCall1(HvCallEventAckLpEvent, virt_to_abs(event));
121 static inline HvLpEvent_Rc HvCallEvent_cancelLpEvent(struct HvLpEvent *event)
123 return HvCall1(HvCallEventCancelLpEvent, virt_to_abs(event));
126 static inline HvLpInstanceId HvCallEvent_getSourceLpInstanceId(
127 HvLpIndex targetLp, HvLpEvent_Type type)
129 return HvCall2(HvCallEventGetSourceLpInstanceId, targetLp, type);
132 static inline HvLpInstanceId HvCallEvent_getTargetLpInstanceId(
133 HvLpIndex targetLp, HvLpEvent_Type type)
135 return HvCall2(HvCallEventGetTargetLpInstanceId, targetLp, type);
138 static inline void HvCallEvent_openLpEventPath(HvLpIndex targetLp,
141 HvCall2(HvCallEventOpenLpEventPath, targetLp, type);
144 static inline void HvCallEvent_closeLpEventPath(HvLpIndex targetLp,
147 HvCall2(HvCallEventCloseLpEventPath, targetLp, type);
150 static inline HvLpDma_Rc HvCallEvent_dmaBufList(HvLpEvent_Type type,
151 HvLpIndex remoteLp, HvLpDma_Direction direction,
152 HvLpInstanceId localInstanceId,
153 HvLpInstanceId remoteInstanceId,
154 HvLpDma_AddressType localAddressType,
155 HvLpDma_AddressType remoteAddressType,
156 /* Do these need to be converted to absolute addresses? */
157 u64 localBufList, u64 remoteBufList, u32 transferLength)
159 /* Pack the misc bits into a single Dword to pass to PLIC */
166 HvLpInstanceId local_inst;
167 HvLpInstanceId remote_inst;
172 packed.parms.flags = (direction << 7) |
173 (localAddressType << 6) | (remoteAddressType << 5);
174 packed.parms.remote = remoteLp;
175 packed.parms.type = type;
176 packed.parms.reserved = 0;
177 packed.parms.local_inst = localInstanceId;
178 packed.parms.remote_inst = remoteInstanceId;
180 return HvCall4(HvCallEventDmaBufList, packed.dword, localBufList,
181 remoteBufList, transferLength);
184 static inline HvLpDma_Rc HvCallEvent_dmaToSp(void *local, u32 remote,
185 u32 length, HvLpDma_Direction dir)
187 return HvCall4(HvCallEventDmaToSp, virt_to_abs(local), remote,
191 #endif /* _ASM_POWERPC_ISERIES_HV_CALL_EVENT_H */