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