1 /*
2 * HvCall.h
3 * Copyright (C) 2001 Mike Corrigan IBM Corporation
4 *
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.
9 *
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.
14 *
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 */
19
20 //===========================================================================
21 //
22 // This file contains the "hypervisor call" interface which is used to
23 // drive the hypervisor from the OS.
24 //
25 //===========================================================================
26
27 //-------------------------------------------------------------------
28 // Standard Includes
29 //-------------------------------------------------------------------
30 #ifndef _HVCALLSC_H
31 #include "HvCallSc.h"
32 #endif
33
34 #ifndef _HVTYPES_H
35 #include <asm/iSeries/HvTypes.h>
36 #endif
37
38 #include <asm/paca.h>
39
40 //-------------------------------------------------------------------
41 // Constants
42 //-------------------------------------------------------------------
43 #ifndef _HVCALL_H
44 #define _HVCALL_H
45 /*
46 enum HvCall_ReturnCode
47 {
48 HvCall_Good = 0,
49 HvCall_Partial = 1,
50 HvCall_NotOwned = 2,
51 HvCall_NotFreed = 3,
52 HvCall_UnspecifiedError = 4
53 };
54
55 enum HvCall_TypeOfSIT
56 {
57 HvCall_ReduceOnly = 0,
58 HvCall_Unconditional = 1
59 };
60
61 enum HvCall_TypeOfYield
62 {
63 HvCall_YieldTimed = 0, // Yield until specified time
64 HvCall_YieldToActive = 1, // Yield until all active procs have run
65 HvCall_YieldToProc = 2 // Yield until the specified processor has run
66 };
67
68 enum HvCall_InterruptMasks
69 {
70 HvCall_MaskIPI = 0x00000001,
71 HvCall_MaskLpEvent = 0x00000002,
72 HvCall_MaskLpProd = 0x00000004,
73 HvCall_MaskTimeout = 0x00000008
74 };
75
76 enum HvCall_VaryOffChunkRc
77 {
78 HvCall_VaryOffSucceeded = 0,
79 HvCall_VaryOffWithdrawn = 1,
80 HvCall_ChunkInLoadArea = 2,
81 HvCall_ChunkInHPT = 3,
82 HvCall_ChunkNotAccessible = 4,
83 HvCall_ChunkInUse = 5
84 };
85 */
86
87 /* Type of yield for HvCallBaseYieldProcessor */
88 #define HvCall_YieldTimed 0 // Yield until specified time (tb)
89 #define HvCall_YieldToActive 1 // Yield until all active procs have run
90 #define HvCall_YieldToProc 2 // Yield until the specified processor has run
91
92 /* interrupt masks for setEnabledInterrupts */
93 #define HvCall_MaskIPI 0x00000001
94 #define HvCall_MaskLpEvent 0x00000002
95 #define HvCall_MaskLpProd 0x00000004
96 #define HvCall_MaskTimeout 0x00000008
97
98 /* Log buffer formats */
99 #define HvCall_LogBuffer_ASCII 0
100 #define HvCall_LogBuffer_EBCDIC 1
101
102 #define HvCallBaseAckDeferredInts HvCallBase + 0
103 #define HvCallBaseCpmPowerOff HvCallBase + 1
104 #define HvCallBaseGetHwPatch HvCallBase + 2
105 #define HvCallBaseReIplSpAttn HvCallBase + 3
106 #define HvCallBaseSetASR HvCallBase + 4
107 #define HvCallBaseSetASRAndRfi HvCallBase + 5
108 #define HvCallBaseSetIMR HvCallBase + 6
109 #define HvCallBaseSendIPI HvCallBase + 7
110 #define HvCallBaseTerminateMachine HvCallBase + 8
111 #define HvCallBaseTerminateMachineSrc HvCallBase + 9
112 #define HvCallBaseProcessPlicInterrupts HvCallBase + 10
113 #define HvCallBaseIsPrimaryCpmOrMsdIpl HvCallBase + 11
114 #define HvCallBaseSetVirtualSIT HvCallBase + 12
115 #define HvCallBaseVaryOffThisProcessor HvCallBase + 13
116 #define HvCallBaseVaryOffMemoryChunk HvCallBase + 14
117 #define HvCallBaseVaryOffInteractivePercentage HvCallBase + 15
118 #define HvCallBaseSendLpProd HvCallBase + 16
119 #define HvCallBaseSetEnabledInterrupts HvCallBase + 17
120 #define HvCallBaseYieldProcessor HvCallBase + 18
121 #define HvCallBaseVaryOffSharedProcUnits HvCallBase + 19
122 #define HvCallBaseSetVirtualDecr HvCallBase + 20
123 #define HvCallBaseClearLogBuffer HvCallBase + 21
124 #define HvCallBaseGetLogBufferCodePage HvCallBase + 22
125 #define HvCallBaseGetLogBufferFormat HvCallBase + 23
126 #define HvCallBaseGetLogBufferLength HvCallBase + 24
127 #define HvCallBaseReadLogBuffer HvCallBase + 25
128 #define HvCallBaseSetLogBufferFormatAndCodePage HvCallBase + 26
129 #define HvCallBaseWriteLogBuffer HvCallBase + 27
130 #define HvCallBaseRouter28 HvCallBase + 28
131 #define HvCallBaseRouter29 HvCallBase + 29
132 #define HvCallBaseRouter30 HvCallBase + 30
133 #define HvCallBaseSetDebugBus HvCallBase + 31
134
135 #define HvCallCcSetDABR HvCallCc + 7
136
137 //=====================================================================================
HvCall_setVirtualDecr(void)138 static inline void HvCall_setVirtualDecr(void)
139 {
140 /* Ignore any error return codes - most likely means that the target value for the
141 * LP has been increased and this vary off would bring us below the new target. */
142 HvCall0(HvCallBaseSetVirtualDecr);
143 }
144 //=====================================================================
HvCall_yieldProcessor(unsigned typeOfYield,u64 yieldParm)145 static inline void HvCall_yieldProcessor(unsigned typeOfYield, u64 yieldParm)
146 {
147 HvCall2( HvCallBaseYieldProcessor, typeOfYield, yieldParm );
148 }
149 //=====================================================================
HvCall_setEnabledInterrupts(u64 enabledInterrupts)150 static inline void HvCall_setEnabledInterrupts(u64 enabledInterrupts)
151 {
152 HvCall1(HvCallBaseSetEnabledInterrupts,enabledInterrupts);
153 }
154
155 //=====================================================================
HvCall_clearLogBuffer(HvLpIndex lpindex)156 static inline void HvCall_clearLogBuffer(HvLpIndex lpindex)
157 {
158 HvCall1(HvCallBaseClearLogBuffer,lpindex);
159 }
160
161 //=====================================================================
HvCall_getLogBufferCodePage(HvLpIndex lpindex)162 static inline u32 HvCall_getLogBufferCodePage(HvLpIndex lpindex)
163 {
164 u32 retVal = HvCall1(HvCallBaseGetLogBufferCodePage,lpindex);
165 return retVal;
166 }
167
168 //=====================================================================
HvCall_getLogBufferFormat(HvLpIndex lpindex)169 static inline int HvCall_getLogBufferFormat(HvLpIndex lpindex)
170 {
171 int retVal = HvCall1(HvCallBaseGetLogBufferFormat,lpindex);
172 return retVal;
173 }
174
175 //=====================================================================
HvCall_getLogBufferLength(HvLpIndex lpindex)176 static inline u32 HvCall_getLogBufferLength(HvLpIndex lpindex)
177 {
178 u32 retVal = HvCall1(HvCallBaseGetLogBufferLength,lpindex);
179 return retVal;
180 }
181
182 //=====================================================================
HvCall_setLogBufferFormatAndCodepage(int format,u32 codePage)183 static inline void HvCall_setLogBufferFormatAndCodepage(int format, u32 codePage)
184 {
185 HvCall2(HvCallBaseSetLogBufferFormatAndCodePage,format, codePage);
186 }
187
188 //=====================================================================
189 int HvCall_readLogBuffer(HvLpIndex lpindex, void *buffer, u64 bufLen);
190 void HvCall_writeLogBuffer(const void *buffer, u64 bufLen);
191
192 //=====================================================================
HvCall_sendIPI(struct paca_struct * targetPaca)193 static inline void HvCall_sendIPI(struct paca_struct * targetPaca)
194 {
195 HvCall1( HvCallBaseSendIPI, targetPaca->xPacaIndex );
196 }
197
198 //=====================================================================
HvCall_sendLpProd(HvLpIndex lpindex)199 static inline void HvCall_sendLpProd(HvLpIndex lpindex)
200 {
201 HvCall1( HvCallBaseSendLpProd, lpindex );
202 }
203
204 //=====================================================================
HvCall_terminateMachineSrc(void)205 static inline void HvCall_terminateMachineSrc(void)
206 {
207 HvCall0( HvCallBaseTerminateMachineSrc );
208 }
209
HvCall_setDABR(unsigned long val)210 static inline void HvCall_setDABR(unsigned long val)
211 {
212 HvCall1(HvCallCcSetDABR, val);
213 }
214
HvCall_setDebugBus(unsigned long val)215 static inline void HvCall_setDebugBus(unsigned long val)
216 {
217 HvCall1(HvCallBaseSetDebugBus, val);
218 }
219
220 #endif // _HVCALL_H
221
222