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 //===========================================================================
29 //-------------------------------------------------------------------
31 //-------------------------------------------------------------------
32 #include <asm/iSeries/HvCallSc.h>
33 #include <asm/iSeries/HvTypes.h>
37 enum HvCall_ReturnCode
43 HvCall_UnspecifiedError = 4
48 HvCall_ReduceOnly = 0,
49 HvCall_Unconditional = 1
52 enum HvCall_TypeOfYield
54 HvCall_YieldTimed = 0, // Yield until specified time
55 HvCall_YieldToActive = 1, // Yield until all active procs have run
56 HvCall_YieldToProc = 2 // Yield until the specified processor has run
59 enum HvCall_InterruptMasks
61 HvCall_MaskIPI = 0x00000001,
62 HvCall_MaskLpEvent = 0x00000002,
63 HvCall_MaskLpProd = 0x00000004,
64 HvCall_MaskTimeout = 0x00000008
67 enum HvCall_VaryOffChunkRc
69 HvCall_VaryOffSucceeded = 0,
70 HvCall_VaryOffWithdrawn = 1,
71 HvCall_ChunkInLoadArea = 2,
72 HvCall_ChunkInHPT = 3,
73 HvCall_ChunkNotAccessible = 4,
78 /* Type of yield for HvCallBaseYieldProcessor */
79 #define HvCall_YieldTimed 0 // Yield until specified time (tb)
80 #define HvCall_YieldToActive 1 // Yield until all active procs have run
81 #define HvCall_YieldToProc 2 // Yield until the specified processor has run
83 /* interrupt masks for setEnabledInterrupts */
84 #define HvCall_MaskIPI 0x00000001
85 #define HvCall_MaskLpEvent 0x00000002
86 #define HvCall_MaskLpProd 0x00000004
87 #define HvCall_MaskTimeout 0x00000008
89 /* Log buffer formats */
90 #define HvCall_LogBuffer_ASCII 0
91 #define HvCall_LogBuffer_EBCDIC 1
93 #define HvCallBaseAckDeferredInts HvCallBase + 0
94 #define HvCallBaseCpmPowerOff HvCallBase + 1
95 #define HvCallBaseGetHwPatch HvCallBase + 2
96 #define HvCallBaseReIplSpAttn HvCallBase + 3
97 #define HvCallBaseSetASR HvCallBase + 4
98 #define HvCallBaseSetASRAndRfi HvCallBase + 5
99 #define HvCallBaseSetIMR HvCallBase + 6
100 #define HvCallBaseSendIPI HvCallBase + 7
101 #define HvCallBaseTerminateMachine HvCallBase + 8
102 #define HvCallBaseTerminateMachineSrc HvCallBase + 9
103 #define HvCallBaseProcessPlicInterrupts HvCallBase + 10
104 #define HvCallBaseIsPrimaryCpmOrMsdIpl HvCallBase + 11
105 #define HvCallBaseSetVirtualSIT HvCallBase + 12
106 #define HvCallBaseVaryOffThisProcessor HvCallBase + 13
107 #define HvCallBaseVaryOffMemoryChunk HvCallBase + 14
108 #define HvCallBaseVaryOffInteractivePercentage HvCallBase + 15
109 #define HvCallBaseSendLpProd HvCallBase + 16
110 #define HvCallBaseSetEnabledInterrupts HvCallBase + 17
111 #define HvCallBaseYieldProcessor HvCallBase + 18
112 #define HvCallBaseVaryOffSharedProcUnits HvCallBase + 19
113 #define HvCallBaseSetVirtualDecr HvCallBase + 20
114 #define HvCallBaseClearLogBuffer HvCallBase + 21
115 #define HvCallBaseGetLogBufferCodePage HvCallBase + 22
116 #define HvCallBaseGetLogBufferFormat HvCallBase + 23
117 #define HvCallBaseGetLogBufferLength HvCallBase + 24
118 #define HvCallBaseReadLogBuffer HvCallBase + 25
119 #define HvCallBaseSetLogBufferFormatAndCodePage HvCallBase + 26
120 #define HvCallBaseWriteLogBuffer HvCallBase + 27
121 #define HvCallBaseRouter28 HvCallBase + 28
122 #define HvCallBaseRouter29 HvCallBase + 29
123 #define HvCallBaseRouter30 HvCallBase + 30
124 #define HvCallBaseSetDebugBus HvCallBase + 31
126 #define HvCallCcSetDABR HvCallCc + 7
128 //=====================================================================================
129 static inline void HvCall_setVirtualDecr(void)
131 /* Ignore any error return codes - most likely means that the target value for the
132 * LP has been increased and this vary off would bring us below the new target. */
133 HvCall0(HvCallBaseSetVirtualDecr
);
135 //=====================================================================
136 static inline void HvCall_yieldProcessor(unsigned typeOfYield
, u64 yieldParm
)
138 HvCall2( HvCallBaseYieldProcessor
, typeOfYield
, yieldParm
);
140 //=====================================================================
141 static inline void HvCall_setEnabledInterrupts(u64 enabledInterrupts
)
143 HvCall1(HvCallBaseSetEnabledInterrupts
,enabledInterrupts
);
146 //=====================================================================
147 static inline void HvCall_clearLogBuffer(HvLpIndex lpindex
)
149 HvCall1(HvCallBaseClearLogBuffer
,lpindex
);
152 //=====================================================================
153 static inline u32
HvCall_getLogBufferCodePage(HvLpIndex lpindex
)
155 u32 retVal
= HvCall1(HvCallBaseGetLogBufferCodePage
,lpindex
);
159 //=====================================================================
160 static inline int HvCall_getLogBufferFormat(HvLpIndex lpindex
)
162 int retVal
= HvCall1(HvCallBaseGetLogBufferFormat
,lpindex
);
166 //=====================================================================
167 static inline u32
HvCall_getLogBufferLength(HvLpIndex lpindex
)
169 u32 retVal
= HvCall1(HvCallBaseGetLogBufferLength
,lpindex
);
173 //=====================================================================
174 static inline void HvCall_setLogBufferFormatAndCodepage(int format
, u32 codePage
)
176 HvCall2(HvCallBaseSetLogBufferFormatAndCodePage
,format
, codePage
);
179 //=====================================================================
180 int HvCall_readLogBuffer(HvLpIndex lpindex
, void *buffer
, u64 bufLen
);
181 void HvCall_writeLogBuffer(const void *buffer
, u64 bufLen
);
183 //=====================================================================
184 static inline void HvCall_sendIPI(struct paca_struct
* targetPaca
)
186 HvCall1( HvCallBaseSendIPI
, targetPaca
->paca_index
);
189 //=====================================================================
190 static inline void HvCall_terminateMachineSrc(void)
192 HvCall0( HvCallBaseTerminateMachineSrc
);
195 static inline void HvCall_setDABR(unsigned long val
)
197 HvCall1(HvCallCcSetDABR
, val
);
200 static inline void HvCall_setDebugBus(unsigned long val
)
202 HvCall1(HvCallBaseSetDebugBus
, val
);
205 #endif /* _HVCALL_H */